Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3512396pxb; Mon, 24 Jan 2022 11:06:46 -0800 (PST) X-Google-Smtp-Source: ABdhPJy61PA+gVE/4NLspaOnTvJpUmJFWhGgGYUXEuMJff6gcJaicLlQr5fpEDjWZn6HcjbOU9r3 X-Received: by 2002:a17:903:1ce:b0:14b:e03:2d with SMTP id e14-20020a17090301ce00b0014b0e03002dmr15069730plh.128.1643051206457; Mon, 24 Jan 2022 11:06:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643051206; cv=none; d=google.com; s=arc-20160816; b=ZLLvVaIrQtCMBafBmv5tuUPkYdPD3WQc2CbCep9gwQoDbATQUvV/XKqUNdWrWHfUJ5 HRs7Ds3X7kLB0TNhFVEBd14mbp2bZhqjkACCI92OCGQ+UTWqSw4GPOCwGu9ZoqmMFKx+ hQiPN/OTkzCiwfbU1UbMdBugdXD6K6JlFOV4gO5YfkNP4mLO8iXZFlBKPP/v4xyG5Jbo 0bQXjSzJDHXYGSFZ1Z2qTR0P69I+ITF3uLqCxHJ+BsoxBO6jKdkA3+bQTVqR7Ajb0+BG dd2suIdi0wdhnxwwMy60DeTnfPaL1rqOzKqjD95AI/mtY3qV8ba/OJgJ9x4rIL7yOLCE rMHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=HDkM4IiHfUKgbkZ+J9zwOceHsfDsj5OClEazZRmTBPg=; b=EnWABtLtVst3QwpvbXwt+utj1mz1hqdeyC7ORhVlU73IydwKjIhtpyPYgTbqidxHdU lUPPpWw6QaVsVteG2irlfqZSBP2i2NyGq4mwchure/DC6Qv0bRZ3+Q3NVN7HzN6zB1GY gRtDeArFly/vsA/ZKqnB6CE9V6aclW0wAXAxNI3ZKNYWwFMWUgaqmHnJjdV5bYSQ70M6 NHlnNSqcq/4DTULaTx3H1Qke0qJxOTBT/IegmR5gH34au7FF8+GY59oQ/vlshB/9RhJa il8dp7H2f2T1v1C+w3S1YJj5aWUPaVkOk5w/zMIPrS0BCYBrc617+s3KyME4EzKQd12F wfCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b="HvPmu/lB"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q18si6763792pll.369.2022.01.24.11.06.31; Mon, 24 Jan 2022 11:06:46 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b="HvPmu/lB"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237872AbiAXLpa (ORCPT + 99 others); Mon, 24 Jan 2022 06:45:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54490 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237737AbiAXLp3 (ORCPT ); Mon, 24 Jan 2022 06:45:29 -0500 Received: from mail-oi1-x22c.google.com (mail-oi1-x22c.google.com [IPv6:2607:f8b0:4864:20::22c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1CD35C06173B for ; Mon, 24 Jan 2022 03:45:29 -0800 (PST) Received: by mail-oi1-x22c.google.com with SMTP id bf5so25059992oib.4 for ; Mon, 24 Jan 2022 03:45:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=HDkM4IiHfUKgbkZ+J9zwOceHsfDsj5OClEazZRmTBPg=; b=HvPmu/lBdXu8USCBrVJHyisE10/1/FUkHikq4c8GIPsSYm3FNw2nsTcVpUYzL2eImy KRPCPFeV3Tshd07oaAWPdk9SbLFOvylwUAsPbprhOKo5XBBCQVw+ScTKVlvUFG++Y6/1 lx1VV1kGsX0K6v4MLt6YPphNRqfd5UmLF/xPVH+FKQ2w2y98JLaQVx0keZYxGWAremLp 3RnysEQLgZsQDKLK8OXiTKhyGADOnXG0jhLcvOZFW3vrzauSMpNf7aQzJKdPM2WnUAf/ CBoN+6qEVRT5y+mVYWx1EEGhzGYS4d65LMa8tApwuPNuKBw3dvCFWzs8xcM9ZAkDH3By hwZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=HDkM4IiHfUKgbkZ+J9zwOceHsfDsj5OClEazZRmTBPg=; b=50H8c3JVtqdp/GTxg/g6t3ESxqavLdf170C8HOdZUgXB1MTF4Ned7iRogWBCAP6Pno VvDZMinqpzV1OLzhuLmz6yQZ/AImxG+SqhI76P0ADLsKF+RT3VUxcPU8Hr+P9PRNvnj2 f0yibcqmXaintMscYVMzu4Wz6vuJkhm0P7KpfmVIVAe2yvQLmHr7y8j2TrhHzK9FXNRt pkO9DEwRkMtjfjV2C6hF54FXRjXGnaiXiHvXHRYAoU7wEletnhNk0XX3KTWx1tzz6MtE iEpNTb5C+EkU7Z/tusG0QS+7lDvlq4fPzEPO73spQH8jUs6YMKlEXLaAkwURqqhGYRJI bYOg== X-Gm-Message-State: AOAM5318ALwSWx0LyNoTFEjsDGtsKjM98LkbXvKvuCor56JXzNqA8FQs IeeQluz9DAxT5bwb69yl498t+LvwcoT+Nt51xXQR2A== X-Received: by 2002:a05:6808:15a6:: with SMTP id t38mr1044668oiw.154.1643024728284; Mon, 24 Jan 2022 03:45:28 -0800 (PST) MIME-Version: 1.0 References: <20220124025205.329752-1-liupeng256@huawei.com> <20220124025205.329752-2-liupeng256@huawei.com> <6eb16a68-9a56-7aea-3dd6-bd719a9ce700@huawei.com> In-Reply-To: <6eb16a68-9a56-7aea-3dd6-bd719a9ce700@huawei.com> From: Marco Elver Date: Mon, 24 Jan 2022 12:45:16 +0100 Message-ID: Subject: Re: [PATCH RFC 1/3] kfence: Add a module parameter to adjust kfence objects To: "liupeng (DM)" Cc: glider@google.com, dvyukov@google.com, corbet@lwn.net, sumit.semwal@linaro.org, christian.koenig@amd.com, akpm@linux-foundation.org, kasan-dev@googlegroups.com, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linaro-mm-sig@lists.linaro.org, linux-mm@kvack.org Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ FYI, your reply was not plain text, so LKML may have rejected it. I advise that you switch your email client for LKML emails to plain text. ] On Mon, 24 Jan 2022 at 12:24, liupeng (DM) wrote: [...] > > I think the only reasonable way forward is if you add immediate patching > > support to the kernel as the "Note" suggests. > > May you give us more details about "immediate patching"? [...] > Thank you for your patient suggestions, it's actually helpful and inspired. > We have integrated your latest work "skipping already covered allocations", > and will do more experiments about KFENCE. Finally, we really hope you can > give us more introductions about "immediate patching". "Immediate patching" would, similar to "static branches" or "alternatives" be based on code hot patching. https://www.kernel.org/doc/html/latest/staging/static-keys.html "Patching immediates" would essentially patch the immediate operands of certain (limited) instructions. I think designing this properly to work across various architectures (like static_keys/jump_label) is very complex. So it may not be a viable near-term option. What Dmitry suggests using a constant virtual address carveout is more realistic. But this means having to discuss with arch maintainers which virtual address ranges can be reserved. The nice thing about just relying on memblock and nothing else is that it is very portable and simple. You can have a look at how KASAN deals with organizing its shadow memory if you are interested. Thanks, -- Marco