Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp856754ybt; Wed, 1 Jul 2020 11:42:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyPpsd+cOWEcVc4+29DfBaYuFjwxiL3UFEtxCqIz6IkL6HsScFM7J9bihhIRsV8jor7lkwz X-Received: by 2002:a50:ba8b:: with SMTP id x11mr31615458ede.201.1593628955587; Wed, 01 Jul 2020 11:42:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593628955; cv=none; d=google.com; s=arc-20160816; b=uI7yNagARruNbnBycv7/39e8Z4U0FDJPR5fIvW9FhecCnj/6vRtnUE/UP2ZTaWNuWk FiKhwVUJ0LP4oIx23GMcHB7Zvf9qLpE1FL8b065me0DgX4qzi/D8hb68iXBpirRljLW3 wSeVNLkbTe6hEVz6a34sodX04elYdXWKjRIUSnrJLXeuHoCWxyEkluyN6y18m9sqRyO6 9rgBkQW7kHrh2k5uItwz5ZTidpJSFBTjdAgj3RkIJcdTj6cy/1FG/NjAah2NXPTNmVCu jrA0VqGKCgoJd2IQ20ZImOcVOCd1gwZiw6D30LxJcyRXCcUKI8gVewFYbb4f9jE6bxle Ju0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=4SVI7figybdN9q2Lz02x29XlploW4XvSK1grElo37N8=; b=d7nIZ/hZXS/iQurfv4rqnbFmIOqInPD+nShYHTg9UmtLXwSWuiwtlANvW+z6YwKgDR WeYp+rrY/TwsWeHLTKL6MAOC0ImcLQzzx4jMMoE2VzBqjOKm7YOeBRVR1upoAmDQZWS5 VSfmBvAmZz37qkC/82ChJgHDuYNUkOpQ3FlmlcLb3ZLnD6ll2eNIanQ1Qyn5j1g9qNZH 0BHz01ywZSbwvkkaOusY61bj6nOn105u8ymw5zpswiG9WHCi3+xwYmzCOuBuo+uVo/G+ /W/p+IQurBiFzEPss70Bzu5JR+C2R7AUe2D3/1XLQDKx8t58jYDxxe15IsOLDqhGztz7 /ukQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v6si4589708edy.149.2020.07.01.11.42.12; Wed, 01 Jul 2020 11:42:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726281AbgGASln (ORCPT + 99 others); Wed, 1 Jul 2020 14:41:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33630 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725440AbgGASln (ORCPT ); Wed, 1 Jul 2020 14:41:43 -0400 Received: from ZenIV.linux.org.uk (zeniv.linux.org.uk [IPv6:2002:c35c:fd02::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7EFADC08C5C1 for ; Wed, 1 Jul 2020 11:41:43 -0700 (PDT) Received: from viro by ZenIV.linux.org.uk with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1jqhfn-003Vzq-Dz; Wed, 01 Jul 2020 18:41:31 +0000 Date: Wed, 1 Jul 2020 19:41:31 +0100 From: Al Viro To: Linus Torvalds Cc: Josh Poimboeuf , Peter Zijlstra , the arch/x86 maintainers , Linux Kernel Mailing List Subject: Re: objtool clac/stac handling change.. Message-ID: <20200701184131.GI2786714@ZenIV.linux.org.uk> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jul 01, 2020 at 11:22:01AM -0700, Linus Torvalds wrote: > Josh / PeterZ, > it turns out that clang seems to now have fixed the last known > nagging details with "asm goto" with outputs, so I'm looking at > actually trying to merge the support for that in the kernel. > > The main annoyance isn't actually using "asm goto" at all, the main > annoyance is just that it will all have to be conditional on whether > the compiler supports it or not. We have the config option for that > already, but it will just end up with two copies of the code depending > on that option. > > It's not a huge deal: the recent cleanups wrt the x86 uaccess code > have made the code _much_ more straightforward and legible, and I'm > not so worried about it all. > > Except that when I looked at this, I realized that I really had picked > the wrong model for how exceptions are handled wrt stac/clac. In > particular user access exceptions return with stac set, so we end up > having a code pattern where the error case will also have to do the > user_access_end() to finish the STAC region. > > Adding a user_access_end() to the user exception fault handler is trivial. > > But the thing I'm asking you for is how nasty it would be to change > objtool to have those rules? > > IOW, right now we have > > if (!user_acces_begin(...)) > goto efault; > unsafe_get/put_user(ptr, val, label); > user_access_end(); > return 0; > > label: > user_access_end(); > efaulr: > return -EFAULT; > > and I'd like to make the "label" case just go to "efault", with > objtool knowing that the exception handling already did the > user_access_end(). > > That would end up cleaning up the flow for a number of cases. > > Nasty? Trivial? Rather nasty for ppc; they have separate user_read_access_end() and user_write_access_end().