From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, TVD_SUBJ_WIPE_DEBT,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6EB9CC433E2 for ; Thu, 10 Sep 2020 15:34:34 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A5BED2087C for ; Thu, 10 Sep 2020 15:34:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A5BED2087C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=ACULAB.COM Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 4BnNGt6RvVzDqjR for ; Fri, 11 Sep 2020 01:34:30 +1000 (AEST) Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=aculab.com (client-ip=207.82.80.151; helo=eu-smtp-delivery-151.mimecast.com; envelope-from=david.laight@aculab.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=ACULAB.COM Received: from eu-smtp-delivery-151.mimecast.com (eu-smtp-delivery-151.mimecast.com [207.82.80.151]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4BnND43dXbzDqcl for ; Fri, 11 Sep 2020 01:32:02 +1000 (AEST) Received: from AcuMS.aculab.com (156.67.243.126 [156.67.243.126]) (Using TLS) by relay.mimecast.com with ESMTP id uk-mta-276-Rr3yeOHPPMud0l-oIQnsyA-1; Thu, 10 Sep 2020 16:31:54 +0100 X-MC-Unique: Rr3yeOHPPMud0l-oIQnsyA-1 Received: from AcuMS.Aculab.com (fd9f:af1c:a25b:0:43c:695e:880f:8750) by AcuMS.aculab.com (fd9f:af1c:a25b:0:43c:695e:880f:8750) with Microsoft SMTP Server (TLS) id 15.0.1347.2; Thu, 10 Sep 2020 16:31:53 +0100 Received: from AcuMS.Aculab.com ([fe80::43c:695e:880f:8750]) by AcuMS.aculab.com ([fe80::43c:695e:880f:8750%12]) with mapi id 15.00.1347.000; Thu, 10 Sep 2020 16:31:53 +0100 From: David Laight To: 'Segher Boessenkool' Subject: RE: remove the last set_fs() in common code, and remove it for x86 and powerpc v3 Thread-Topic: remove the last set_fs() in common code, and remove it for x86 and powerpc v3 Thread-Index: AQHWhvDyD2c/lZfV3kC0Ftay5UVebqlhgjnw///zuACAABnIEIAAOoMggAAi9ACAABJI8A== Date: Thu, 10 Sep 2020 15:31:53 +0000 Message-ID: <18fdbaeacba349a0a8bf7568f709e991@AcuMS.aculab.com> References: <20200903142242.925828-1-hch@lst.de> <20200903142803.GM1236603@ZenIV.linux.org.uk> <20200909184001.GB28786@gate.crashing.org> <3beb8b019e4a4f7b81fdb1bc68bd1e2d@AcuMS.aculab.com> <186a62fc-042c-d6ab-e7dc-e61b18945498@csgroup.eu> <59a64e9a210847b59f70f9bd2d02b5c3@AcuMS.aculab.com> <5050b43687c84515a49b345174a98822@AcuMS.aculab.com> <20200910152030.GJ28786@gate.crashing.org> In-Reply-To: <20200910152030.GJ28786@gate.crashing.org> Accept-Language: en-GB, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.202.205.107] MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=C51A453 smtp.mailfrom=david.laight@aculab.com X-Mimecast-Spam-Score: 0.001 X-Mimecast-Originator: aculab.com Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Language: en-US X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arch , Kees Cook , linuxppc-dev , the arch/x86 maintainers , Nick Desaulniers , Linux Kernel Mailing List , Christoph Hellwig , Luis Chamberlain , Al Viro , linux-fsdevel , 'Linus Torvalds' , Alexey Dobriyan Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" > -----Original Message----- > From: Segher Boessenkool > Sent: 10 September 2020 16:21 > To: David Laight > Cc: 'Christophe Leroy' ; 'Linus Torvalds' foundation.org>; linux-arch ; Kees Cook ; the > arch/x86 maintainers ; Nick Desaulniers ; Linux Kernel > Mailing List ; Alexey Dobriyan ; Luis Chamberlain > ; Al Viro ; linux-fsdevel ; > linuxppc-dev ; Christoph Hellwig > Subject: Re: remove the last set_fs() in common code, and remove it for x= 86 and powerpc v3 >=20 > On Thu, Sep 10, 2020 at 12:26:53PM +0000, David Laight wrote: > > Actually this is pretty sound: > > =09__label__ label; > > =09register int eax asm ("eax"); > > =09// Ensure eax can't be reloaded from anywhere > > =09// In particular it can't be reloaded after the asm goto line > > =09asm volatile ("" : "=3Dr" (eax)); >=20 > This asm is fine. It says it writes the "eax" variable, which lives in > the eax register *in that asm* (so *not* guaranteed after it!). >=20 > > =09// Provided gcc doesn't save eax here... > > =09asm volatile goto ("xxxxx" ::: "eax" : label); >=20 > So this is incorrect. >From the other email: > It is neither input nor output operand here! Only *then* is a local > register asm guaranteed to be in the given reg: as input or output to an > inline asm. Ok, so adding '"r" (eax)' to the input section helps a bit. > > =09// ... and reload the saved value here. > > =09// The input value here will be that modified by the 'asm goto'. > > =09// Since this modifies eax it can't be moved before the 'asm goto'. > > =09asm volatile ("" : "+r" (eax)); > > =09// So here eax must contain the value set by the "xxxxx" instruction= s. >=20 > No, the register eax will contain the value of the eax variable. In the > asm; it might well be there before or after the asm as well, but none of > that is guaranteed. Perhaps not 'guaranteed', but very unlikely to be wrong. It doesn't give gcc much scope for not generating the desired code. =09David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1= PT, UK Registration No: 1397386 (Wales)