Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp5421357ybf; Thu, 5 Mar 2020 00:19:27 -0800 (PST) X-Google-Smtp-Source: ADFU+vt1tX6nNwNDWiY03HHuVR/i6mLkhQvbx22PXq0QzuPLKdWQ8ktdMghN/icwUL306oEdZPry X-Received: by 2002:a05:6808:3d1:: with SMTP id o17mr4812116oie.6.1583396367678; Thu, 05 Mar 2020 00:19:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583396367; cv=none; d=google.com; s=arc-20160816; b=Ot4E23kRkwqYapq9evlu9ETKBqO71ZbUwWU5xf1WiVFanAKzZIg6e8yHa5J4OuvmO7 rKRY7FADu0jNl93LR5C0DFSEGyPSIS7JniirQ2X9oxphE7BjGAd2MpJ6E2lo27Zb/uEe G1CH66W0yIX6Baw02SsKlmpyM29Ksf62sUcHpZpgGvt7E0Cblen8vgwDWFTOUEUp8Mpj xNaPFa0Y0BvdtHXC650rzSsETI+fV6mvswkXqwW6wJn/XRoPtqmIaxBrO5gU3BLLdGGK eumCUXVjd7k5SHV57zwMeOJcsT1i0p3+n3utfBX/YOixfqsjviI996kqSNQFudu6h2s6 D9Qw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=3m703ypRjAtYhbKTkAxqNaRn33lkF344lR7igeRi5dw=; b=dUeAZ0H4RJMx5F5yvX9qYn1gZSLsrs6cwseltguAvGUcee9Q8VhNEJgRmC65u4kDSE 0fxh7ZWDsn9Syzct0RTDoNiPaD2XMYeINgQhUnBI4FcJ3dPYUTt0P2p0Zf79hNCEq+24 zfPvev5hT1WvIQ2AweObaI6tPWzvdaO+XtBjRPKt+7IFdJKzXpyUyc3vcbSzXY4TJSKn OBt7JewcCIeePRKcGj/QQ6/pSZUWg+JxaPV9ALB8YToMwy/MKgZnst4lyTSmPYm4wn1/ GMQ5TJp4kAvFHQz6QiQhO6tK5/z8po1mdF7xNjrlogeBr3MwId+OfZg9aJHWInZ7cnu9 RBLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=QeDESQWx; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 5si3375329otm.88.2020.03.05.00.19.16; Thu, 05 Mar 2020 00:19:27 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=QeDESQWx; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726222AbgCEISu (ORCPT + 99 others); Thu, 5 Mar 2020 03:18:50 -0500 Received: from bombadil.infradead.org ([198.137.202.133]:35708 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725877AbgCEISu (ORCPT ); Thu, 5 Mar 2020 03:18:50 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=3m703ypRjAtYhbKTkAxqNaRn33lkF344lR7igeRi5dw=; b=QeDESQWxblcd1ICzrOjpd4hCUd qsEvNamu4phC6ep6Go1fma5VlXhdDamQawtlV0GF1uJ/nY66ALRpwbJquIX4xw+ldXjLejEWIg7YH uXcyDaNH7zXvWAmMYuLZRDUOJeeAZGqvTEc0U6f7Zr8W8/wpcDEmip3IXXXupMOacO+KA6/AJxbbe VbaB9MadDZ/5IxdnJYyeBdbmY3HmJmUKL/VVl0bcSvl7EUyDm3EY7EYt80tfpwVptOQ1sPdS8Idkf QBkBdclOUqOhXgHaRRBGtYB5nc/xE8r/VfTl7NdVhXIuinI1KKF38twaZ4Xp19Y+qNsB4JE2+RpcJ oKF9xrMg==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1j9liO-0003xf-73; Thu, 05 Mar 2020 08:18:44 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 9EBB630066E; Thu, 5 Mar 2020 09:16:43 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 8F9FE20D3014E; Thu, 5 Mar 2020 09:18:42 +0100 (CET) Date: Thu, 5 Mar 2020 09:18:42 +0100 From: Peter Zijlstra To: Randy Dunlap Cc: akpm@linux-foundation.org, broonie@kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-next@vger.kernel.org, mhocko@suse.cz, mm-commits@vger.kernel.org, sfr@canb.auug.org.au, Josh Poimboeuf , walter-zh.wu@mediatek.com, dvyukov@google.com Subject: Re: mmotm 2020-03-03-22-28 uploaded (warning: objtool:) Message-ID: <20200305081842.GB2619@hirez.programming.kicks-ass.net> References: <20200304062843.9yA6NunM5%akpm@linux-foundation.org> <20200305081717.GT2596@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200305081717.GT2596@hirez.programming.kicks-ass.net> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Mar 05, 2020 at 09:17:17AM +0100, Peter Zijlstra wrote: > On Wed, Mar 04, 2020 at 09:34:49AM -0800, Randy Dunlap wrote: > > mm/kasan/common.o: warning: objtool: kasan_report()+0x13: call to report_enabled() with UACCESS enabled > > I used next/master instead, and found the below broken commit > responsible for this. > @@ -634,12 +637,20 @@ void kasan_free_shadow(const struct vm_struct *vm) > #endif > > extern void __kasan_report(unsigned long addr, size_t size, bool is_write, unsigned long ip); > +extern bool report_enabled(void); > > -void kasan_report(unsigned long addr, size_t size, bool is_write, unsigned long ip) > +bool kasan_report(unsigned long addr, size_t size, bool is_write, unsigned long ip) > { > - unsigned long flags = user_access_save(); > + unsigned long flags; > + > + if (likely(!report_enabled())) > + return false; This adds an explicit call before the user_access_save() and that is a straight on bug. > + > + flags = user_access_save(); > __kasan_report(addr, size, is_write, ip); > user_access_restore(flags); > + > + return true; > }