From patchwork Thu Dec 7 22:27:56 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tobin Harding X-Patchwork-Id: 10101189 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 760DA60360 for ; Thu, 7 Dec 2017 22:28:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 689A328713 for ; Thu, 7 Dec 2017 22:28:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5C0D72882F; Thu, 7 Dec 2017 22:28:54 +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 CA60B28713 for ; Thu, 7 Dec 2017 22:28:52 +0000 (UTC) Received: (qmail 30636 invoked by uid 550); 7 Dec 2017 22:28:34 -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 30432 invoked from network); 7 Dec 2017 22:28:32 -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=HXTT1AQ0+s5jvYpX5 XYxlz3UgX5D/8Lmoz4Y85lEAUY=; b=ScHs644gJO2o38sMUxkoGaYQTW5+TpFVO 48l++TQi0iy83jZL0BuaKCPPS20C/Edoox4OeruUyEY0Ld2+JCKamYiApBZ58osN hT9s4oSXIIkItcHD11neUZUf2hjNXlxo9Aer06Wo/hbohoeyles6xgSf11qnjoCv z8OmXLIF3civVViR2co0IN1aq+ixeZTyFUnlA35PzJgWT3Rxo4hzCVDXMaOmOC1c TQlUBFclTm5zpPBoTC3QIX1BI1DMCraTU981x8wGPDGYBSKGCMokWHzWVrz0gc7X /7Dk0DEBKQUuDJkwDWL3+Mb0EK44+A0QjWZZcqqeXnaCIDnjXDixQ== 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=HXTT1AQ0+s5jvYpX5XYxlz3UgX5D/8Lmoz4Y85lEAUY=; b=UNpGJQGM 2/yPlYDCe3xW7zgmeTbMJiS86KnQeJigsOo76rhgqEGOClf3qhVyTMS5WjZppkf2 SEEQ0hOPbPEFu8lK/rmHdFjUwfcgZsMrGZK6yn03Y1HdMjGqz03fDdcVKYS3B1y5 vHw2l9OINe4W93czj9EDKh7ghj4E5N8InAaWlUxHnv/rdngmZvj2rI6/BjX8N8th nPUTbj5LXZaoLbcLOuHFsgwdMS3i1k96JZnlrc4FkhxeGImhMlBSjJ7oeqf1iD2o AJIxbFCpg4q7nwUMPdmShRtCx2whaAyqlGkCQfmAVkfYiEqegIw7/qCmmrBiBoVH rHMsE+cT7U1LzQ== 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 , kernel-hardening@lists.openwall.com Date: Fri, 8 Dec 2017 09:27:56 +1100 Message-Id: <1512685676-21933-4-git-send-email-me@tobin.cc> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1512685676-21933-1-git-send-email-me@tobin.cc> References: <1512685676-21933-1-git-send-email-me@tobin.cc> Subject: [kernel-hardening] [PATCH 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 Acked-by: Kees Cook --- 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..392b5660337e 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 +currently printed. If KALLSYMS is not enabled the address is printed. + Unique identifiers ------------------