From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.5 required=3.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 31C5FC433E2 for ; Thu, 17 Sep 2020 13:26:29 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 52B922083B for ; Thu, 17 Sep 2020 13:26:28 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 52B922083B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=sina.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 915D66B0003; Thu, 17 Sep 2020 09:26:27 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8C6216B0037; Thu, 17 Sep 2020 09:26:27 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7DB496B0055; Thu, 17 Sep 2020 09:26:27 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0091.hostedemail.com [216.40.44.91]) by kanga.kvack.org (Postfix) with ESMTP id 64A076B0003 for ; Thu, 17 Sep 2020 09:26:27 -0400 (EDT) Received: from smtpin25.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 1D601362C for ; Thu, 17 Sep 2020 13:26:27 +0000 (UTC) X-FDA: 77272627614.25.quiet99_5a01bf827122 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin25.hostedemail.com (Postfix) with ESMTP id DFD191804E3A9 for ; Thu, 17 Sep 2020 13:26:26 +0000 (UTC) X-HE-Tag: quiet99_5a01bf827122 X-Filterd-Recvd-Size: 2590 Received: from mail3-164.sinamail.sina.com.cn (mail3-164.sinamail.sina.com.cn [202.108.3.164]) by imf32.hostedemail.com (Postfix) with SMTP for ; Thu, 17 Sep 2020 13:26:25 +0000 (UTC) Received: from unknown (HELO localhost.localdomain)([123.115.166.229]) by sina.com with ESMTP id 5F6363FC00037E06; Thu, 17 Sep 2020 21:26:22 +0800 (CST) X-Sender: hdanton@sina.com X-Auth-ID: hdanton@sina.com X-SMAIL-MID: 7305815073777 From: Hillf Danton To: Marco Elver Cc: akpm@linux-foundation.org, glider@google.com, andreyknvl@google.com, linux-arm-kernel@lists.infradead.org, linux-mm@kvack.org Subject: Re: [PATCH v2 01/10] mm: add Kernel Electric-Fence infrastructure Date: Thu, 17 Sep 2020 21:26:10 +0800 Message-Id: <20200917132610.1964-1-hdanton@sina.com> In-Reply-To: <20200915132046.3332537-2-elver@google.com> References: <20200915132046.3332537-1-elver@google.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: DFD191804E3A9 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam03 Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000001, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Tue, 15 Sep 2020 15:20:37 +0200 > From: Alexander Potapenko >=20 > This adds the Kernel Electric-Fence (KFENCE) infrastructure. KFENCE is = a > low-overhead sampling-based memory safety error detector of heap > use-after-free, invalid-free, and out-of-bounds access errors. >=20 > KFENCE is designed to be enabled in production kernels, and has near > zero performance overhead. Compared to KASAN, KFENCE trades performance > for precision. The main motivation behind KFENCE's design, is that with > enough total uptime KFENCE will detect bugs in code paths not typically > exercised by non-production test workloads. One way to quickly achieve = a > large enough total uptime is when the tool is deployed across a large > fleet of machines. >=20 > KFENCE objects each reside on a dedicated page, at either the left or > right page boundaries. The pages to the left and right of the object > page are "guard pages", whose attributes are changed to a protected > state, and cause page faults on any attempted access to them. Such page > faults are then intercepted by KFENCE, which handles the fault > gracefully by reporting a memory access error. To help understand the magic of KFENCE, a simple diagram looks needed to illustrate the relations between obj and guard pages, something like the below asiic chart. |-----------------|-----------------------------------|-----------------= -| | left guard page | the page containing KFENCE object | right guard page= | |-----------------|-----------------------------------|-----------------= -|