From patchwork Sun Dec 17 22:30:07 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tobin Harding X-Patchwork-Id: 10117961 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 3C1A560327 for ; Sun, 17 Dec 2017 22:31:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 308D829239 for ; Sun, 17 Dec 2017 22:31:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 24E0E291F8; Sun, 17 Dec 2017 22:31:15 +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 4A0B729239 for ; Sun, 17 Dec 2017 22:31:14 +0000 (UTC) Received: (qmail 26245 invoked by uid 550); 17 Dec 2017 22:30:58 -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 26139 invoked from network); 17 Dec 2017 22:30:57 -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=dFTLC5UsddoNiIkK6Ie6PSpmx0apiXkKe VbqI+zM3SfdSTtVimTMgsA2gzs2cH8hlNVPUXWyHBKRNdkrXkT/Qjp8269ox9L1n FRKegYvLOz79Oy/VN//f54VLqI4/YapOKalRSzlhKy8rQRJWX6I2fNkyGroF/pgw Qcann7CJlMX40cwb1q9SOnGL+oeZPjTd5rSjucwMlxlOyrz8+D5W89jeieWir/M2 S3W5TdHExIO7TbStyQr686MiOJbPtZ3NKNpyeAb7Ogu9gKJjaJdkuyH3Bp8yXBQo oIl9DBFcmOWewTGtMR//ibvT9tDAFCTMK48qfKYJ0c03O2/y9CJIg== 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=l8ZYLpgV 0jAYQKwLblnGirBFE22MhqxarSfWLYsKuqeeyoGKUu68ra5QQMS+YVZfTAJs3s33 vKZPgN9qKQf3F3l3gNbrL8DwfToD+JZRK60DX4UYkd+VRlwnAnnNQe1OCnFpJMpc Sp50YURaRFbXfjy0GMAqQ/cYq7iBOleBZTPV7UtU2uK0gLGZryS7Wscq0GdFAEk5 G1e9wlCK/7/tT+OgNbo2oqSCo9DUoJYi4UIgzACp4nKKk75LzHu00QAGZqs6ZG9l Ly66kNHE2JXjQ53UqfOfx9HdtvHBfunMZmeoz2BYSWzn45DPuE89kFe7pHz9xXRA V9mtVQeRdYNdTg== 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: Mon, 18 Dec 2017 09:30:07 +1100 Message-Id: <1513549807-20287-4-git-send-email-me@tobin.cc> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1513549807-20287-1-git-send-email-me@tobin.cc> References: <1513549807-20287-1-git-send-email-me@tobin.cc> Subject: [kernel-hardening] [PATCH v2 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 ------------------