Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp926209ybt; Wed, 1 Jul 2020 13:38:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJypAIaq1G5L4cLyFETLdXVfI3/0i/suMYX1q6kXia5EjDWMe6twH6jv5RqWxQohv1PZLxlq X-Received: by 2002:a17:907:724d:: with SMTP id ds13mr24072269ejc.73.1593635930030; Wed, 01 Jul 2020 13:38:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593635930; cv=none; d=google.com; s=arc-20160816; b=yCIZAo7OSmWs1S33vSL/jg82zY6G22AuR7jWoDHkGoojVlSbT4WgVLTpHTCUty2OO8 40i/jUI6whj+k6BniUTtSy6qRliM/qCAQkOmLYwYF5Jc3hhym7hzugc7vKBZ1mdDtNBl iFUVDiBu4T5ZrJyc1FSNnXBZRdsWdbuUAoKNdzmQhTDeflcq1dvgjZKIu8+aA9NhhYza Ho8FoQE48zThKFWWNS+9iImgpgG+i6KFbhujpBesGwAagFpwMPjr21rcQuov/qhc6esH qC831DXctJZBWC6eeiUYt7ENgMU7v5jPn+lPG7+UQpROU0uQwTZpW9jJoJJ91ti2/U5M QPbw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:in-reply-to:cc:references:message-id :date:subject:mime-version:from:content-transfer-encoding :dkim-signature; bh=Ml7h1RVx99WBpFKay7KhhYcDTfjcQtiJ3hL/JQFsxaw=; b=Llgr6TycIEL6CUCMeywywOfdlQnabIcGaa3PA8+mG4EZs+PNrfgDhMrg8K2XV/dHb/ wlGVSZWat6O/T+g21KiFPoEdlejqzTwHbZ8wKDTV40yHPp/tkbAxZNujRjt8dSFdljZz gL5tEgzOnWE4Wek7uW0W9LyYphW40CoHJxgogMWFN9cZrdwXVqYiVyIAsKpPA30dzL2W u7iNw42wHBBdamNEpvXvEFNkfYS1jzDpoVPp/By8rM/3EO4BpszWTkYJR1sad/csCl2U Xh92CvGG4+eav73onnaLn+nVVyMYtFvbe0kjx4PmUq8sM5vJpydLLmH5sP15xbBg+bL9 fMmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amacapital-net.20150623.gappssmtp.com header.s=20150623 header.b=vqKoS74T; 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 dt5si5938919ejc.335.2020.07.01.13.38.26; Wed, 01 Jul 2020 13:38:50 -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; dkim=pass header.i=@amacapital-net.20150623.gappssmtp.com header.s=20150623 header.b=vqKoS74T; 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 S1726573AbgGAUg1 (ORCPT + 99 others); Wed, 1 Jul 2020 16:36:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51370 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725535AbgGAUg0 (ORCPT ); Wed, 1 Jul 2020 16:36:26 -0400 Received: from mail-pg1-x533.google.com (mail-pg1-x533.google.com [IPv6:2607:f8b0:4864:20::533]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4DAFAC08C5C1 for ; Wed, 1 Jul 2020 13:36:26 -0700 (PDT) Received: by mail-pg1-x533.google.com with SMTP id m22so1907515pgv.9 for ; Wed, 01 Jul 2020 13:36:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amacapital-net.20150623.gappssmtp.com; s=20150623; h=content-transfer-encoding:from:mime-version:subject:date:message-id :references:cc:in-reply-to:to; bh=Ml7h1RVx99WBpFKay7KhhYcDTfjcQtiJ3hL/JQFsxaw=; b=vqKoS74TQnzmoAPXc661uI/GMGxdpNdaBZTZQxL1pSs4vIipZ2me8BZvCXyL13ghqf MVMjyCat4XWCs/AfCxZQ1ZxDnnsY1CFSa2cWYUwDJ8RcUpS82qBYGyz7WH3N88QJe0km S/WWPs78A/S12EzMphJGD3rjtuhoSIv0F+Un8H0tweuWLlqM9Mb8qFKjOOcZZZAGmR0w 3p/mE1XJEELSg8qArLrrz6/fkUGIZRWfteySCJYr6eY+OKOGYJJikHLLCWXSn8BklLFt Lg0+IhvSPEgXxhOvG43Y88golPITpMAZu35/zVKkl5/cmUZAapILcpCCyb9T3onGDrZD kzQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:content-transfer-encoding:from:mime-version :subject:date:message-id:references:cc:in-reply-to:to; bh=Ml7h1RVx99WBpFKay7KhhYcDTfjcQtiJ3hL/JQFsxaw=; b=MR0SWD4c0WQdeH98VNz806ABSta0317vIcUc7VP//c3dAR3upX2x+hjU7Gs1XqeX3M FvnoszZol4mVEspk9PTwnmFEpv5Q3p50Qc0KYZISMkQcpzgPbbKwVg7Qnhp+nLNjnf9a Po6VT9M2qY06h/RWU3ogmLbXF4hyZfpPcguZYDiVv6aiDTBIcSKjmuBkMJ/lUshizZBo 7kI4FATdixTp46xuMjlfFlWVecDETZONfw/rym9gFLc1i6jbZi5J/mIJ+7ZKuZRO4aW1 MQH5GD3qM/uv3wye7xMaz4D/RArSvySOgBLAN/pIYK1lTlw7PLOF6cmC2zrJJXvc0U07 sYbg== X-Gm-Message-State: AOAM5300Mjry3wPYgqjaTgxObaogOlJrjAOC8NSS3Te/PsimxYT1BKrx O/dHYUJGoDLo4el/LASc+/Inww== X-Received: by 2002:aa7:871a:: with SMTP id b26mr19365029pfo.294.1593635785869; Wed, 01 Jul 2020 13:36:25 -0700 (PDT) Received: from ?IPv6:2600:1010:b04f:a97a:115b:a679:8f4f:946b? ([2600:1010:b04f:a97a:115b:a679:8f4f:946b]) by smtp.gmail.com with ESMTPSA id t126sm6565239pfd.214.2020.07.01.13.36.24 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 01 Jul 2020 13:36:24 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: Andy Lutomirski Mime-Version: 1.0 (1.0) Subject: Re: objtool clac/stac handling change.. Date: Wed, 1 Jul 2020 13:36:22 -0700 Message-Id: <5F1767D0-416A-4BA4-9DFF-E82D1EA3F5EE@amacapital.net> References: Cc: Andy Lutomirski , Josh Poimboeuf , Peter Zijlstra , the arch/x86 maintainers , Linux Kernel Mailing List In-Reply-To: To: Linus Torvalds X-Mailer: iPhone Mail (17F80) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > On Jul 1, 2020, at 12:35 PM, Linus Torvalds wrote: >=20 > =EF=BB=BFOn Wed, Jul 1, 2020 at 11:29 AM Andy Lutomirski = wrote: >>=20 >> Do we really want the exception handling to do the CLAC? Having >> unsafe_get_user() do CLAC seems surprising to me, and it will break >> use cases like: >>=20 >> if (!user_access_begin(...) >> goto out; >>=20 >> ret =3D unsafe_get_user(...); >>=20 >> user_access_end(); >>=20 >> check ret; >=20 > That's not how unsafe_get_user() works. >=20 > unsafe_get_user() always jumps to the error label, it never returns a > value. So the code is actually now what you claim above, but >=20 > if (!user_access_begin(...) > goto out; >=20 > unsafe_get_user(..., out_fault); > user_access_end(); > .. this is good, use the value we got.. >=20 > out_fault: > user_access_end(); > out: > return -EFAULT; Ugh, right. But maybe, with the asm goto magic, we can=E2=80=99t get rid of t= his. I=E2=80=99ve always disliked the pattern where we enable user access, d= o a bunch of accesses that branch on error, and finish up. We ought to be ab= le to do it the way I described and get decent code generation too. If we do this extable change, we end up with a different mess: some exceptio= n handlers will clear AC and some won=E2=80=99t. I=E2=80=99m sure objtool c= an deal with this with some effort, but I=E2=80=99m not convinced it=E2=80=99= s worth it.=