From patchwork Tue Jan 9 20:55:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 10153327 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 9A61E602CA for ; Tue, 9 Jan 2018 20:58:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 91C0F2040D for ; Tue, 9 Jan 2018 20:58:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 86008204C4; Tue, 9 Jan 2018 20:58:56 +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 960012040D for ; Tue, 9 Jan 2018 20:58:55 +0000 (UTC) Received: (qmail 7761 invoked by uid 550); 9 Jan 2018 20:57:12 -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 7670 invoked from network); 9 Jan 2018 20:57:11 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=rce/8yLxCDvKGLUc4g1e41q5D0vc20s6LbKhcE+fd7Y=; b=HsU19qbmil+s2ZchrGsbBSNKeo4ka0+IjBIyjWifrWMhijps4879NaLShmGyYpeFsP B+aLKPJzhBDEIWrafMQk2KERtGBIvuVN7OQLAH2eDNCa71y6SuXPjivwsZSIw92+Y/f6 MibfeehJldDg5AHQSlSe/NrmZ2dH5cRb1klIw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=rce/8yLxCDvKGLUc4g1e41q5D0vc20s6LbKhcE+fd7Y=; b=aChW2VD/3xspGTytvpvL5Tn+0hjsmxy2+lQPjKKaBf5vn01MnHAJqj8BR7GA26LBuB e/HVGDEoWfl4j5MH6OJRZh1/qkWUsD9hBk+O5cbXsgxKUvcQEBTq19Dc8iylKH3YWh5V TfE5GhRFpIEhzoEHDnNs86wr2CVxrtjQQpKrZqaJrdb9jPZqoR07/9YIYZ8F9m9vEFME jNX4t9mv1bkv8JgM1kgzTEbMUf8IjoKtIWRaKJaN4UgZNEw3P1xowImAgsGsYmEzfhDF r1aUQZgpqEnNL+DwGOpXxupnA0S8uygFvMNzd5WBJIjPBM4hOuqjHKPsG/IGPD0nsHDU cpwA== X-Gm-Message-State: AKGB3mIa81RXJ0KbWh7XFMqcR0tPeHlNDNBA1IYKhRWF48htflSaaxyk v4hJpbKaIQtf7mvgbgPBgObc2Q== X-Google-Smtp-Source: ACJfBot+JTTtUM3E0y2qowihSOiepKeOXIlJnghdkKtn7qtPClEbGGlPpFclQm0gxSXhrOa7T1QADA== X-Received: by 10.99.149.5 with SMTP id p5mr12691688pgd.186.1515531419749; Tue, 09 Jan 2018 12:56:59 -0800 (PST) From: Kees Cook To: linux-kernel@vger.kernel.org Cc: Kees Cook , Linus Torvalds , David Windsor , Alexander Viro , Andrew Morton , Andy Lutomirski , Christoph Hellwig , Christoph Lameter , "David S. Miller" , Laura Abbott , Mark Rutland , "Martin K. Petersen" , Paolo Bonzini , Christian Borntraeger , Christoffer Dall , Dave Kleikamp , Jan Kara , Luis de Bethencourt , Marc Zyngier , Rik van Riel , Matthew Garrett , linux-fsdevel@vger.kernel.org, linux-arch@vger.kernel.org, netdev@vger.kernel.org, linux-mm@kvack.org, kernel-hardening@lists.openwall.com Date: Tue, 9 Jan 2018 12:55:30 -0800 Message-Id: <1515531365-37423-2-git-send-email-keescook@chromium.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1515531365-37423-1-git-send-email-keescook@chromium.org> References: <1515531365-37423-1-git-send-email-keescook@chromium.org> Subject: [kernel-hardening] [PATCH 01/36] usercopy: Remove pointer from overflow report X-Virus-Scanned: ClamAV using ClamSMTP Using %p was already mostly useless in the usercopy overflow reports, so this removes it entirely to avoid confusion now that %p-hashing is enabled. Fixes: ad67b74d2469d9b8 ("printk: hash addresses printed with %p") Signed-off-by: Kees Cook --- mm/usercopy.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/mm/usercopy.c b/mm/usercopy.c index a9852b24715d..5df1e68d4585 100644 --- a/mm/usercopy.c +++ b/mm/usercopy.c @@ -58,12 +58,11 @@ static noinline int check_stack_object(const void *obj, unsigned long len) return GOOD_STACK; } -static void report_usercopy(const void *ptr, unsigned long len, - bool to_user, const char *type) +static void report_usercopy(unsigned long len, bool to_user, const char *type) { - pr_emerg("kernel memory %s attempt detected %s %p (%s) (%lu bytes)\n", + pr_emerg("kernel memory %s attempt detected %s '%s' (%lu bytes)\n", to_user ? "exposure" : "overwrite", - to_user ? "from" : "to", ptr, type ? : "unknown", len); + to_user ? "from" : "to", type ? : "unknown", len); /* * For greater effect, it would be nice to do do_group_exit(), * but BUG() actually hooks all the lock-breaking and per-arch @@ -261,6 +260,6 @@ void __check_object_size(const void *ptr, unsigned long n, bool to_user) return; report: - report_usercopy(ptr, n, to_user, err); + report_usercopy(n, to_user, err); } EXPORT_SYMBOL(__check_object_size);