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: 10153467 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 ED8BA60223 for ; Tue, 9 Jan 2018 21:06:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E3291205F6 for ; Tue, 9 Jan 2018 21:06:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D722F2434C; Tue, 9 Jan 2018 21:06:55 +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=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 57AC6205F6 for ; Tue, 9 Jan 2018 21:06:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758744AbeAIU5J (ORCPT ); Tue, 9 Jan 2018 15:57:09 -0500 Received: from mail-pg0-f67.google.com ([74.125.83.67]:34782 "EHLO mail-pg0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757900AbeAIU5A (ORCPT ); Tue, 9 Jan 2018 15:57:00 -0500 Received: by mail-pg0-f67.google.com with SMTP id j4so8822643pgp.1 for ; Tue, 09 Jan 2018 12:57:00 -0800 (PST) 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=TqU7IuaeR6zlOMlsHa3HqdBxH25PphLILKPEi/yX8IfH4lYpd8lfvVGycFn2vW1Eli FTiE+ev/5nJ7UUetBd6nQ7U9kQBfO6FRswTGQCAljGbn32MwbGlJAkczfsZTe1RfmxAN 7KltoSShlzmPNtUNFVzzx+iSfa0lJrgemPRcecSbZ+vHLBCwifAbgDckwAPO1tLkmpgN L9ZcKpgauRUp60rk5iQPV4Lx/o7xkps4nLQT6jrcf2Mh0pfIyWONYSzLU9iiq2fC+Q5T YjyH8e0y/Hecn9KioDS0agvSkUqk4kilRdrxRxFQfq4FnCzXu4Oo08pu7yhYishMw1J9 NtIw== X-Gm-Message-State: AKGB3mKZNU3q0MHmtjN5M57o4kaNIzui6ApRw6+ScrKj9k2bjtVngWJh 38t3atoaidJ7Sac7JboQ3GLKgA== 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) Received: from www.outflux.net (173-164-112-133-Oregon.hfc.comcastbusiness.net. [173.164.112.133]) by smtp.gmail.com with ESMTPSA id 67sm30417814pfz.171.2018.01.09.12.56.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Jan 2018 12:56:19 -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 Subject: [PATCH 01/36] usercopy: Remove pointer from overflow report 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> Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org 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);