From patchwork Wed Jul 25 22:38:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 10544895 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B5A8F112E for ; Wed, 25 Jul 2018 22:38:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A1DDC2AAD0 for ; Wed, 25 Jul 2018 22:38:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 963032AAD3; Wed, 25 Jul 2018 22:38:39 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 668C92AAD0 for ; Wed, 25 Jul 2018 22:38:38 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0AEC66B0003; Wed, 25 Jul 2018 18:38:37 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 05DD46B0005; Wed, 25 Jul 2018 18:38:37 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E41AB6B0006; Wed, 25 Jul 2018 18:38:36 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pl0-f72.google.com (mail-pl0-f72.google.com [209.85.160.72]) by kanga.kvack.org (Postfix) with ESMTP id 9FB746B0003 for ; Wed, 25 Jul 2018 18:38:36 -0400 (EDT) Received: by mail-pl0-f72.google.com with SMTP id c2-v6so1068572plz.17 for ; Wed, 25 Jul 2018 15:38:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:date:from:to:cc:subject :message-id:mime-version:content-disposition; bh=oxY++LSQOfleh6kuZ6Nnmu39HCHVekdNBgalBw0zoSQ=; b=EDYRLAt4Kd2tc8h6T7+frJ9v60VOHPzaqISi1FWE8Theh6+WSd+zvSZGj+DbCz7Avr Y+mrJ98AE+0oExyP8VkVZvaFp/M0nohTxVAkzpvn+aiptYJN/0NRknT62xWtL5eoHvxJ +xkN/rNJrh21lBrDui62RZ5m8US/qbnIuQ7X1tAeprxJHroh/CMwx1M29t/jHslUuDnV GeMgQRy0tGfAEVwPXxrOpZZjLML+JWe0Sao5Qo/AjjWNKal4Gs7Ksdj54G5sPAUO+hsr Q9Q79Yd4FzxTMbMEPzq62gMWoikslGgWBYazN59Ye/srhfHMuAWGq5yo3stC6SoRyrXB CbzA== X-Gm-Message-State: AOUpUlFHi7ixPrXDof3ktWY6L/WOUbgAU7L0tvPz788uRhlJZav5bplL iqoz4t7J/B959nmwp+nPMFlD7MwkoOr0uXb25nINRs24R+yf9QZwP+hYprzoq5KoYcwlz4M7R6v hJ4SnD/nW5y2HAhPfLoUEj8uDGK+ebVFZoOG9mgWsP8e+52jPcOCPGjvJUyfl3XfqVtQdn7hdQ9 dqJ0rQOQ6GeRsTKEQzMdZXNSzJ8FvWCAK/Jd3HfcAZAn7bbqyzTV2T1BeYmXe9ti1a+HK3WZXPg yGXXKTvCuBGseNVnvW7qZsR4z15iAbXoGxYU75WBNOTERpGx4PcDiIOjVcLsgZkjCv+gZ9wwYU+ tY+79vDvAMYnbOqAF7XwPQZOsbGo+lrPOnHmkMoJ1cBBT4/TGkV9QZjfGhIv58ydp1JZy4escdU a X-Received: by 2002:a62:c0c4:: with SMTP id g65-v6mr23809680pfk.72.1532558316213; Wed, 25 Jul 2018 15:38:36 -0700 (PDT) X-Received: by 2002:a62:c0c4:: with SMTP id g65-v6mr23809652pfk.72.1532558315474; Wed, 25 Jul 2018 15:38:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532558315; cv=none; d=google.com; s=arc-20160816; b=wIbZuFEGUMD5o1L9VTBZFuHPhTELQGr0YCvLyAejfc/A9tYOl1xVoCO1tuXh5BXqPq fMe7Kblp7fN+BYlVXGqT0llDiDDk4s6tIKeP20jpt6jnqtX21/mWZdyS7RuWS6+6E7+y RLr6nfvD4nCVAI0R6aWmqdgGI7FiWAqSWYKk+iWliFN9EK/CXHpZ/cAzsxpEUH8aWCfC CGvaIm/dOOuONIG3WXfJBszeV4MVgpPLUnYWD6Ww+8XT3/tF8tdGXpHgudM1IfFh38wL mcene+l3arCqO068JveZKlon8f7bROMBfEoGCfzTn0PR7t3aA2eSRTfodnq5X7GK9QXP qpIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :dkim-signature:arc-authentication-results; bh=oxY++LSQOfleh6kuZ6Nnmu39HCHVekdNBgalBw0zoSQ=; b=QW/lT+8Ds3orpqdxXtC3F7zIAY0WdJ4cCx5WsBHuFcV1zWbtHEx0g0ndwHjMBh0Jm4 Hu4RO60P97L+N58wZDpnUacMstZkCechheTdAzHHUF1dd3sXnviG56Ce0ARtQ/4E1ynF 0EBuBfh0FEaDdlqtZid+rh4ARW+SV7tT8svKM8kT8cxto5+/jWtyH3xSdtkjbOE/UJok 5uaYER2rS1M112EH3O7QcJhKRA4nQmUyTaz34mnd8iRyPSZ/i8vjZoRzqBJB0tIH+ZFb 0ELwHD7WdXyv6B9JVMoErVs/WGDqSD7EVYMwsYZX5ZOquiTTOAcPsiEavz6HFUj0W7W9 gSXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=dNw1lwGR; spf=pass (google.com: domain of keescook@chromium.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=keescook@chromium.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id z4-v6sor4409742pff.50.2018.07.25.15.38.35 for (Google Transport Security); Wed, 25 Jul 2018 15:38:35 -0700 (PDT) Received-SPF: pass (google.com: domain of keescook@chromium.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=dNw1lwGR; spf=pass (google.com: domain of keescook@chromium.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=keescook@chromium.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:mime-version:content-disposition; bh=oxY++LSQOfleh6kuZ6Nnmu39HCHVekdNBgalBw0zoSQ=; b=dNw1lwGRgCROauGjwQ4GoQAxHZzBADqcxn2rXvCFmB0EStqG1axxxJ402+bbVMHvlM uU2rrDj+5wqSAPa3FOCCAyc+wz4CdCa8rLyTGrJWfDevP34w6rbhJnVku+ub9ftF1E3J +XlHPoRn9gxLtUmiEmjSfKndNLpVwNIfzYJ3M= X-Google-Smtp-Source: AAOMgpc44xQ1r3QIZ4JTE3F4cmZcxLppeXn7MLZLY4/bVR9cxKfCFWH3+QfUHLuhKFk8EL2KY0oMPg== X-Received: by 2002:a62:57dc:: with SMTP id i89-v6mr23972397pfj.65.1532558315208; Wed, 25 Jul 2018 15:38:35 -0700 (PDT) Received: from www.outflux.net (173-164-112-133-Oregon.hfc.comcastbusiness.net. [173.164.112.133]) by smtp.gmail.com with ESMTPSA id r83-v6sm18241486pgr.8.2018.07.25.15.38.33 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Jul 2018 15:38:33 -0700 (PDT) Date: Wed, 25 Jul 2018 15:38:32 -0700 From: Kees Cook To: Andrew Morton Cc: Jonathan Corbet , Laura Abbott , linux-doc@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH] mm: Clarify CONFIG_PAGE_POISONING and usage Message-ID: <20180725223832.GA43733@beast> MIME-Version: 1.0 Content-Disposition: inline X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP The Kconfig text for CONFIG_PAGE_POISONING doesn't mention that it has to be enabled explicitly. This updates the documentation for that and adds a note about CONFIG_PAGE_POISONING to the "page_poison" command line docs. While here, change description of CONFIG_PAGE_POISONING_ZERO too, as it's not "random" data, but rather the fixed debugging value that would be used when not zeroing. Additionally removes a stray "bool" in the Kconfig. Signed-off-by: Kees Cook --- Documentation/admin-guide/kernel-parameters.txt | 5 +++-- mm/Kconfig.debug | 6 +++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt index 533ff5c68970..f8a81b929089 100644 --- a/Documentation/admin-guide/kernel-parameters.txt +++ b/Documentation/admin-guide/kernel-parameters.txt @@ -2933,8 +2933,9 @@ on: enable the feature page_poison= [KNL] Boot-time parameter changing the state of - poisoning on the buddy allocator. - off: turn off poisoning + poisoning on the buddy allocator, available with + CONFIG_PAGE_POISONING=y. + off: turn off poisoning (default) on: turn on poisoning panic= [KNL] Kernel behaviour on panic: delay diff --git a/mm/Kconfig.debug b/mm/Kconfig.debug index e5e606ee5f71..9a7b8b049d04 100644 --- a/mm/Kconfig.debug +++ b/mm/Kconfig.debug @@ -46,7 +46,8 @@ config PAGE_POISONING Fill the pages with poison patterns after free_pages() and verify the patterns before alloc_pages. The filling of the memory helps reduce the risk of information leaks from freed data. This does - have a potential performance impact. + have a potential performance impact if enabled with the + "page_poison=1" kernel boot option. Note that "poison" here is not the same thing as the "HWPoison" for CONFIG_MEMORY_FAILURE. This is software poisoning only. @@ -65,7 +66,7 @@ config PAGE_POISONING_NO_SANITY say N. config PAGE_POISONING_ZERO - bool "Use zero for poisoning instead of random data" + bool "Use zero for poisoning instead of debugging value" depends on PAGE_POISONING ---help--- Instead of using the existing poison value, fill the pages with @@ -75,7 +76,6 @@ config PAGE_POISONING_ZERO allocation. If unsure, say N - bool config DEBUG_PAGE_REF bool "Enable tracepoint to track down page reference manipulation"