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=-3.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS 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 1A849C433ED for ; Mon, 12 Apr 2021 13:13:46 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 86FB661288 for ; Mon, 12 Apr 2021 13:13:45 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 86FB661288 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=ACULAB.COM Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:In-Reply-To:References:Message-ID:Date: Subject:CC:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=VG4Mi2TPtCKwghyBEpnmVvh4rMrE6hB973UWS2zqZzU=; b=igVxYOnXcQpzsLupdQXg4jqsW aV5vqTEzOwmulcqP46drjW1A9I3EWiId6psGLG4vQY+XuIrjxJb3M/EmxmMXnN+CNJgv3vdJc4K1T 3Km152GlkwdxN4yT2Xj/OlEMAyLZSLdketAmK3MVp936IDZO3moMvkveG4a+0CNlZq7fkd0RIRQ9Q CRdQ/q6BxxBh9dlE51S2LyHa7U/ayfFWG/8ffLBVKZ5ljG0PEhGO0eNxBAt6YuIx1bGVyXPrqlgca Z3htQR0uGAOhtMYpolEyFoLJ7t7KKyxfUAh9nshR2dL2uVQbRodz6hUSe9dck5Tdjnmkks128DA4C nQ/BlyPpg==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lVwML-006n5p-99; Mon, 12 Apr 2021 13:12:09 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lVwM8-006n4f-Md for linux-arm-kernel@desiato.infradead.org; Mon, 12 Apr 2021 13:11:56 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: Content-Type:MIME-Version:In-Reply-To:References:Message-ID:Date:Subject:CC: To:From:Sender:Reply-To:Content-ID:Content-Description; bh=I3vdZdZUlxcUp2rMi3dIEldVlfPekEITfW1xlf0puAk=; b=b99QwimoZwFBvvP5Yvzd676Hdd iHig5h+YE+qsleQeOL//f8bFr3KjudEkeP57LQ00RtcUb4p4/NhFDsqn/wcRt4BD23Bneju2ZERp3 N4jYm24018ChOA3N6LTbtbZ75TZbgVwIALaefR7JXdyvu80mNZj0Mlr0sii7wE4R3SUWZBJ+AxvCr HFlVoOnPB3gRzLJBKkgMQ8l+J8NL+ZAXQZDO0QBauzKAxFQOmbsS7HSgLxKfB857bHj4bEy+MbZTF +3RKaFgPP5utBGp4Mii9MvzQ5WK3digvIE4Zq/6c4q98N3cCE5Yh/pp2RQh7Cirxh0+NTDtY7IQfj kKDSFbQA==; Received: from eu-smtp-delivery-151.mimecast.com ([185.58.86.151]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lVwM3-006Fm1-AP for linux-arm-kernel@lists.infradead.org; Mon, 12 Apr 2021 13:11:55 +0000 Received: from AcuMS.aculab.com (156.67.243.121 [156.67.243.121]) (Using TLS) by relay.mimecast.com with ESMTP id uk-mta-107-jlA7rlBNM9W_p6yNzfFSUA-1; Mon, 12 Apr 2021 14:11:46 +0100 X-MC-Unique: jlA7rlBNM9W_p6yNzfFSUA-1 Received: from AcuMS.Aculab.com (fd9f:af1c:a25b:0:994c:f5c2:35d6:9b65) by AcuMS.aculab.com (fd9f:af1c:a25b:0:994c:f5c2:35d6:9b65) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 12 Apr 2021 14:11:45 +0100 Received: from AcuMS.Aculab.com ([fe80::994c:f5c2:35d6:9b65]) by AcuMS.aculab.com ([fe80::994c:f5c2:35d6:9b65%12]) with mapi id 15.00.1497.012; Mon, 12 Apr 2021 14:11:45 +0100 From: David Laight To: 'Arnd Bergmann' CC: Christoph Hellwig , Catalin Marinas , Will Deacon , Thomas Bogendoerfer , "James E.J. Bottomley" , Helge Deller , Michael Ellerman , Heiko Carstens , Vasily Gorbik , Christian Borntraeger , "David S. Miller" , "x86@kernel.org" , "linux-arch@vger.kernel.org" , "linux-s390@vger.kernel.org" , "linux-parisc@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-mips@vger.kernel.org" , "sparclinux@vger.kernel.org" , "linuxppc-dev@lists.ozlabs.org" , "linux-arm-kernel@lists.infradead.org" Subject: RE: [PATCH 5/5] compat: consolidate the compat_flock{,64} definition Thread-Topic: [PATCH 5/5] compat: consolidate the compat_flock{, 64} definition Thread-Index: AQHXL3nAXViKKuH90kqxIUkBtWSuL6qwmWXwgAATjVCAAACRAIAAKVLA Date: Mon, 12 Apr 2021 13:11:45 +0000 Message-ID: <0bef075082b244d2b7a5a140336a40d5@AcuMS.aculab.com> References: <20210412085545.2595431-1-hch@lst.de> <20210412085545.2595431-6-hch@lst.de> <15be19af19174c7692dd795297884096@AcuMS.aculab.com> <5c3635a2b44a496b88d665e8686d9436@AcuMS.aculab.com> In-Reply-To: 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 X-Mimecast-Originator: aculab.com Content-Language: en-US X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210412_061151_639056_38A2413C X-CRM114-Status: GOOD ( 25.99 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Arnd Bergmann > Sent: 12 April 2021 12:26 > > On Mon, Apr 12, 2021 at 12:54 PM David Laight wrote: > > From: David Laight > Sent: 12 April 2021 10:37 > > ... > > > I'm guessing that compat_pid_t is 16 bits? > > > So the native 32bit version has an unnamed 2 byte structure pad. > > > The 'packed' removes this pad from the compat structure. > > > > > > AFAICT (apart from mips) the __ARCH_COMPAT_FLOCK_PAD is just > > > adding an explicit pad for the implicit pad the compiler > > > would generate because compat_pid_t is 16 bits. > > > > I've just looked at the header. > > compat_pid_t is 32 bits. > > So Linux must have gained 32bit pids at some earlier time. > > (Historically Unix pids were 16 bit - even on 32bit systems.) > > > > Which makes the explicit pad in 'sparc' rather 'interesting'. > > I saw it was there since the sparc kernel support got merged in > linux-1.3, possibly copied from an older sunos version. Which had a 16bit pid when I used it. So this is a bug in the sparc merge! The explicit 'short' pad could be removed from the 64bit variant because there are always 4 bytes of pad after l_pid. But it does extend the application structure on 32bit sparc so must remain in the uapi header. It doesn't need to be in the 'compat' definition. > > oh - compat_loff_t is only used in a couple of other places. > > neither care in any way about the alignment. > > (Provided get_user() doesn't fault on a 8n+4 aligned address.) > > Ah right, I also see that after this series it's only used in to other > places: compat_resume_swap_area, which could also lose the > __packed annotation, That structure just defines 0 and 8, the structure size doesn't matter and the offsets are 'passed to' get_user() so byte accesses aren't performed. > and in the declaration of > compat_sys_sendfile64, where it makes no difference. Which should probably use get_user() rather than copy_from_user(). Although some architectures may need fallback code for misaligned get_user() ? Or is there a general 'cop out' that structures passed to the kernel are required to be correctly aligned. They should be aligned unless the kernel is 'playing games' like reading 'struct pollfd' as a 64bit item. David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales) _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel