From patchwork Mon Dec 18 22:29:05 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tobin Harding X-Patchwork-Id: 10121995 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 32FEA603FA for ; Mon, 18 Dec 2017 22:29:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2587E28757 for ; Mon, 18 Dec 2017 22:29:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 199B728794; Mon, 18 Dec 2017 22:29:59 +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=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from mother.openwall.net (mother.openwall.net [195.42.179.200]) by mail.wl.linuxfoundation.org (Postfix) with SMTP id 45BA428757 for ; Mon, 18 Dec 2017 22:29:58 +0000 (UTC) Received: (qmail 18251 invoked by uid 550); 18 Dec 2017 22:29:40 -0000 Mailing-List: contact kernel-hardening-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Delivered-To: mailing list kernel-hardening@lists.openwall.com Received: (qmail 18198 invoked from network); 18 Dec 2017 22:29:39 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tobin.cc; h=cc :date:from:in-reply-to:message-id:references:subject:to :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=P4nNslQqgXwxJEDlI 4gVYO7MG52X1GcK6SvqMexSYRQ=; b=Le52rtpXsS3M1vl1ZvUn9DH8Ls1wC7beg Dl8N5nZenpdXbVNFGo3NPIubGv/srFjVEvqt9x5wYHO294LvAGsaupabcxFrcUh/ EEYAyU6+OjyhyxONfJN9CY28Sf8Oa6PJmJpfUtF2gEyzFoKPs8ndH28wBOMV8A3e UK79yJqKym+s24liOvdNQqUGIGMeKaRYYJVw9X+OuG3SAhiQAJ0UFDPB9/abaLpt 8OolaldIy+y+wGE9pnpqS7Gf4JpLi7b4xSNvJKiFhjpF3P57qYvQkYVNFQLMfVpH 0tMynQITWPucHy5hANYlNAhVJb3i13n0NVA7VIGyAa/lkKsxJ0Efw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=P4nNslQqgXwxJEDlI4gVYO7MG52X1GcK6SvqMexSYRQ=; b=d1CQG9nI FRnUkOc2olV4OUwYPRakKpls/cSxqWzwI28B+OhRnvOynGFJEO6hM0J3rg4X1No3 JqbsX672NV9/fU24UXOGs5SHTpxcvOXNLmI+CJmmLYvgx/YY/PeIvJg5JCXc9aXi VDTW3qkjbNi4+E/O8dDKVzjwJ6+M4ho3VPFlZfmL7PNWVHa0mQP5GF0/kJ/tbpu3 YSVxMmoBEeinWCbJQlQCI8UifiRNJA44MQShNBxo5Lba9BlgVUbPUv29GxgpSHn2 zVEoekpfLNCUQ5+HH/NKQUj3jZBSiNm4f3ZfuSHx42Pnz/WIA7jj9q9T9Mlxeiwm Oq+OGDH7fnzLOA== X-ME-Sender: From: "Tobin C. Harding" To: Jonathan Corbet Cc: "Tobin C. Harding" , Randy Dunlap , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, Kees Cook , Alexander Popov , Joe Perches , kernel-hardening@lists.openwall.com Date: Tue, 19 Dec 2017 09:29:05 +1100 Message-Id: <1513636145-30033-4-git-send-email-me@tobin.cc> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1513636145-30033-1-git-send-email-me@tobin.cc> References: <1513636145-30033-1-git-send-email-me@tobin.cc> Subject: [kernel-hardening] [PATCH v3 3/3] doc: add documentation on printing kernel addresses X-Virus-Scanned: ClamAV using ClamSMTP Hashing addresses printed with printk specifier %p was implemented recently. During development a number of issues were raised regarding leaking kernel addresses to userspace. Other documentation was updated but security/self-protection missed out. Add self-protection documentation regarding printing kernel addresses. Signed-off-by: Tobin C. Harding --- Documentation/security/self-protection.rst | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Documentation/security/self-protection.rst b/Documentation/security/self-protection.rst index 60c8bd8b77bf..0f53826c78b9 100644 --- a/Documentation/security/self-protection.rst +++ b/Documentation/security/self-protection.rst @@ -270,6 +270,21 @@ attacks, it is important to defend against exposure of both kernel memory addresses and kernel memory contents (since they may contain kernel addresses or other sensitive things like canary values). +Kernel addresses +---------------- + +Printing kernel addresses to userspace leaks sensitive information about +the kernel memory layout. Care should be exercised when using any printk +specifier that prints the raw address, currently %px, %p[ad], (and %p[sSb] +in certain circumstances [*]). Any file written to using one of these +specifiers should be readable only by privileged processes. + +Kernels 4.14 and older printed the raw address using %p. As of 4.15-rc1 +addresses printed with the specifier %p are hashed before printing. + +[*] If KALLSYMS is enabled and symbol lookup fails, the raw address is +printed. If KALLSYMS is not enabled the raw address is printed. + Unique identifiers ------------------