Received: by 2002:ac0:8845:0:0:0:0:0 with SMTP id g63csp422220img; Thu, 28 Feb 2019 01:41:17 -0800 (PST) X-Google-Smtp-Source: AHgI3IYoiMO8l8UuWFlRW1BzY8N6RSSqpKYOz8cN5Wnr4m987qkYeXfZ24q0Z0IytsQrWGKF8QBS X-Received: by 2002:a63:5f0f:: with SMTP id t15mr7598520pgb.272.1551346877005; Thu, 28 Feb 2019 01:41:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551346876; cv=none; d=google.com; s=arc-20160816; b=F8pznS7hSQoQGvwgyaQFNaOAC67NZJWUtD584vcMNnoFnESAnj6r52QjTFYcarodTq cyVofzvlhaLxCDGwSdaaQM+mAC37JupUqghUzB3BrCZM4hSkCSzyT2Mk9sPDBd6meA3a 56FtPvA8wbI0K0QAiG+mKIgKCWTrrhXnDWsrn5M9LSmkoHt+TxUks6wQfEo7vz44wux6 5sIP+sRkIG2MDqthfYBk4SmROH8X6tzVTN0D9S9zH0LHXo3qjmLyLK+XMyCLx2+8Rwwi G1viFtoU9xIcVL2hKiE7ltCYi2VHlOJBgQsWoS6EyOhkcU5J3qCPKUoWa1TkWFNoYO+x Ibzw== 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-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=mtG2cZrZu4KFo/UQIs1mKFZuJRKp411TcL/1RPXaVeQ=; b=aF3KPfW4TUntq6gXK7/lpvJMP14DQFuaVJjfNKT4Sv+ERM14mab8VJS6BypjiDqnXJ 00HftpjJFr8O70s2xqZEsVtcKgT39YhChbgPWO7VCObTHvFZH6GNyJF4NvZM3XkEwDDz Gm3yQGozRUo4lexD+XgIGq/RPrqat8brUFgINbLZNtNJ6+qeeipp3N/p2k9Osfiq96Gz xh1eH+xG3qmH34eHR1rU5RzG74w4VHc5AahRzDMmE/KnNDIuGYqSo04bfgIcS2/2mRXs Q0t82DWbd8GN3QiCa+n3gqljYKZOOP4D/hT0HY6TExWLRMZazaPXeRoR9y/uStrqe3p3 B4pA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@infradead.org header.s=bombadil.20170209 header.b=o+yMb32y; 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 u27si17242297pgk.555.2019.02.28.01.41.01; Thu, 28 Feb 2019 01:41:16 -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=neutral (body hash did not verify) header.i=@infradead.org header.s=bombadil.20170209 header.b=o+yMb32y; 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 S1732195AbfB1Jk1 (ORCPT + 99 others); Thu, 28 Feb 2019 04:40:27 -0500 Received: from bombadil.infradead.org ([198.137.202.133]:51014 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726135AbfB1Jk1 (ORCPT ); Thu, 28 Feb 2019 04:40:27 -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-Transfer-Encoding :Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Sender:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=1X8rm+mkHYV5hDNCom+woWNoJIpi3EPhQTeOVRpuf38=; b=o+yMb32y6odrMIS2EOIJ7nCS3W ZD9SXv8TvDr2VyeGfG/36sYaVBzMbvZT/rRgd2WizW8zi5gpni9Ig5y6TQUA0xdasd5KLI5X1+TJX V7IJVAS7OvwKnHmQT+CPLk7bceYda5G0T2hMXM3mkkoH/KY8oTE7yzEIsfOZCcqfcO7SMwucj1HI7 8czyUogWDqHsjj4CkEiFVT+eYzxQmYQXHk8B8rxr0YtSnBdGZLd/s8A8HKgbHTilkrwYFGTKXU4jY MRQno6T3CSptzHbo9XJzaQXm0jmBxhBxluJEULBFq08F2Vtgdcn/my82vfs8ExGbqGJ0WjnVPz1Mi o1Mkyoww==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1gzIAk-0005lo-Ij; Thu, 28 Feb 2019 09:40:10 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id B7116202CD43E; Thu, 28 Feb 2019 10:40:08 +0100 (CET) Date: Thu, 28 Feb 2019 10:40:08 +0100 From: Peter Zijlstra To: Dmitry Vyukov Cc: Andrey Ryabinin , Linus Torvalds , Thomas Gleixner , "H. Peter Anvin" , Julien Thierry , Will Deacon , Andy Lutomirski , Ingo Molnar , Catalin Marinas , James Morse , valentin.schneider@arm.com, Brian Gerst , Josh Poimboeuf , Andy Lutomirski , Borislav Petkov , Denys Vlasenko , LKML , Alexander Potapenko Subject: Re: [PATCH 5/6] objtool: Add UACCESS validation Message-ID: <20190228094008.GN32534@hirez.programming.kicks-ass.net> References: <20190225124330.613028745@infradead.org> <20190225125232.191698923@infradead.org> <20190227140830.GP32494@hirez.programming.kicks-ass.net> <19b35cb1-9527-2e15-6deb-9ce7c1ef1d66@virtuozzo.com> <20190227142623.GR32494@hirez.programming.kicks-ass.net> <20190227143313.GK32534@hirez.programming.kicks-ass.net> <20190227172816.GT32494@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20190227172816.GT32494@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 Wed, Feb 27, 2019 at 06:28:16PM +0100, Peter Zijlstra wrote: > On Wed, Feb 27, 2019 at 04:40:28PM +0100, Dmitry Vyukov wrote: > > On Wed, Feb 27, 2019 at 3:33 PM Peter Zijlstra wrote: > > > > Urgh, kasan_report() is definitely unsafe. Now, admitedly we should > > > 'never' hit that, but it does leave us up a creek without a paddle. > > > If SMAP detects additional bugs, then it would be pity to disable it > > with KASAN (detect bugs in production but not during testing). > > > > You mentioned that exception save/restore the UACCESS state. Is it > > possible to do the same in kasan_report? At the very least we need to > > survive report printing, what happens after that does not matter much > > (we've corrupted memory by now anyway). > > Ideally we'll put all of kasan_report() in an exception, much like we do > for WARN. But there's a distinct lack of arch hooks there to play with. > I suppose I can try and create some. > > On top of that we'll have to mark these __asan functions with notrace. > > Maybe a little something horrible like so... completely untested. OK, I got that to compile; the next problem is: ../include/linux/kasan.h:90:1: error: built-in function ‘__asan_loadN_noabort’ must be directly called UACCESS_SAFE(__asan_loadN_noabort); Which doesn't make any sense; since we actually generated that symbol, it clearly is not built-in. What gives?