From patchwork Tue Dec 19 21:17:17 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tobin Harding X-Patchwork-Id: 10124415 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 C68456019C for ; Tue, 19 Dec 2017 21:18:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B8CF6294FB for ; Tue, 19 Dec 2017 21:18:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AD84629570; Tue, 19 Dec 2017 21:18:07 +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 D3C84294FB for ; Tue, 19 Dec 2017 21:18:06 +0000 (UTC) Received: (qmail 32468 invoked by uid 550); 19 Dec 2017 21:17:51 -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 32356 invoked from network); 19 Dec 2017 21:17:50 -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=lOjFIjV+QS9bQgVUaHoT+GRPeF2Uy9oBO vBsWB5Gu0FXT+kNYcZFANr7LPm1hAooXOqd3uGt3qg2vfm/Q7kbTHrsG9BaWV+s8 bLGCZbYWJvywxRr5h0AYx9lQnbcjmLAiFFQH9cTWGtsgQsHJhA1Q3b/hPtvUGU/W Ytoe61X3id8e6S0Ej3dKMRznB2jma1IWosEZV7WgJXsHuAOcPkoPQdszaSIZabwo zPsZcjA93vCAz7iRbNLgFog5GPh0oWaDajdGJUeOwox5bkpNPyCXJBXEuk2mlaNJ IeUw4th4VZvLauS1AByp6fBWy06cY/XHlg5uTMq0V8aml2oc95gXg== 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=l0mzYq9p n1lZ5og85OXITtkyWsHR+wE+5vGYCvNlPdp3d28CZ5gJuUKxX0HVcX+abr0Xu+4H PpzuCdpgx7W3Sl6d9HjrtS/96EBI6iVM366gM2beRfWRNzcfMWZc8IfngGjcLvLd k/mnsWb7e0x8LVV2uISreUWN8jB7gFADtKE0yNfTj+spSDa8qfzoFYFqy8E7KTh2 Wcj9PwxaZwjJKHygxw7gYMGdZpfbrxBlZBeyRaJOobqYATq4BLAcFYoLcUZ1nObJ 4QovC/19+DcBN4FzwNSb1i0/Q5ePxcj88etzAaLJUPNqfYQJiwXkRHgzLAy1umhe HUACbyh8tra0vQ== 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: Wed, 20 Dec 2017 08:17:17 +1100 Message-Id: <1513718237-24140-4-git-send-email-me@tobin.cc> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1513718237-24140-1-git-send-email-me@tobin.cc> References: <1513718237-24140-1-git-send-email-me@tobin.cc> Subject: [kernel-hardening] [PATCH v4 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 ------------------