From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751081AbeABUhr (ORCPT + 1 other); Tue, 2 Jan 2018 15:37:47 -0500 Received: from mail-pl0-f65.google.com ([209.85.160.65]:34154 "EHLO mail-pl0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751055AbeABUhp (ORCPT ); Tue, 2 Jan 2018 15:37:45 -0500 X-Google-Smtp-Source: ACJfBosLZeRYR+AV+tEaBy1R39xAXDtrwO188YJm9R/g00f4FGIkzAb73spfy/H2HI2M+vRQL0nVQw== Date: Tue, 2 Jan 2018 12:37:42 -0800 From: Kees Cook To: Linus Torvalds Cc: linux-kernel@vger.kernel.org Subject: [PATCH] usercopy: Remove pointer from overflow report Message-ID: <20180102203742.GA27518@beast> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: 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 --- I have follow-ups to this that include the offset in reporting, but it's a large enough refactoring that I don't think it should go into a late -rc like this. I'll send it as part of the 4.16 merge window instead. --- 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); -- 2.7.4 -- Kees Cook Pixel Security