From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Morton Subject: + kasan-detect-negative-size-in-memory-operation-function-fix-2.patch added to -mm tree Date: Wed, 11 Mar 2020 18:04:40 -0700 Message-ID: <20200312010440.uTD8arQg5%akpm@linux-foundation.org> References: <20200305222751.6d781a3f2802d79510941e4e@linux-foundation.org> Reply-To: linux-kernel@vger.kernel.org Return-path: Received: from mail.kernel.org ([198.145.29.99]:40238 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387480AbgCLBEl (ORCPT ); Wed, 11 Mar 2020 21:04:41 -0400 In-Reply-To: <20200305222751.6d781a3f2802d79510941e4e@linux-foundation.org> Sender: mm-commits-owner@vger.kernel.org List-Id: mm-commits@vger.kernel.org To: mm-commits@vger.kernel.org, peterz@infradead.org, rdunlap@infradead.org, walter-zh.wu@mediatek.com The patch titled Subject: kasan-detect-negative-size-in-memory-operation-function-fix-2 has been added to the -mm tree. Its filename is kasan-detect-negative-size-in-memory-operation-function-fix-2.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/kasan-detect-negative-size-in-memory-operation-function-fix-2.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/kasan-detect-negative-size-in-memory-operation-function-fix-2.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Peter Zijlstra Subject: kasan-detect-negative-size-in-memory-operation-function-fix-2 fix objtool warning mm/kasan/common.o: warning: objtool: kasan_report()+0x13: call to report_enabled() with UACCESS enabled Link: http://lkml.kernel.org/r/20200305095436.GV2596@hirez.programming.kicks-ass.net Reported-by: Randy Dunlap Reviewed-by: Walter Wu Tested-by: Walter Wu Signed-off-by: Andrew Morton --- mm/kasan/common.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) --- a/mm/kasan/common.c~kasan-detect-negative-size-in-memory-operation-function-fix-2 +++ a/mm/kasan/common.c @@ -641,16 +641,17 @@ extern bool report_enabled(void); bool kasan_report(unsigned long addr, size_t size, bool is_write, unsigned long ip) { - unsigned long flags; + unsigned long flags = user_access_save(); + bool ret = false; - if (likely(!report_enabled())) - return false; + if (likely(report_enabled())) { + __kasan_report(addr, size, is_write, ip); + ret = true; + } - flags = user_access_save(); - __kasan_report(addr, size, is_write, ip); user_access_restore(flags); - return true; + return ret; } #ifdef CONFIG_MEMORY_HOTPLUG _ Patches currently in -mm which might be from peterz@infradead.org are kasan-detect-negative-size-in-memory-operation-function-fix-2.patch