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 AF3B8C433ED for ; Mon, 12 Apr 2021 09:39:28 +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 121EF61221 for ; Mon, 12 Apr 2021 09:39:28 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 121EF61221 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=CIj0OrzSJhnRTUaMHwB+knEMj+ad6H7vmCP6ffFLbP4=; b=MACeR9X0I4PJzh98nOh5MBk6H eHTNlmuVEHPnTmk0ZOy+3epKzTzAuXM4KH0pU+TON9ZGis8e8jSZlEd8IW8GSSe6uJg66uFYd91Xe pnnAATsCyoESZJrKph63j/FlDS/yNApmu3o3Ao0MYWOqAKqf7Zso9uIa5Yxx1pcIltPrzLrLNJ1ar 4Ikfmn8L67pcBnNX7Y9s/gTZvjdfAxInriF7L9SH1SjHK8LH7q2hTUMA9eVEvZzjvye+06h9yxXmc YXHe1TUPWg6tM54A2e+69vAAD58XSqSfUV2vm+8A138NH/W1Ou9jRqU0y6y4orLYerRc2faY6QpzA 8iYRswUdg==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lVt0p-006J49-0e; Mon, 12 Apr 2021 09:37:43 +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 1lVt0g-006J3H-Qb for linux-arm-kernel@desiato.infradead.org; Mon, 12 Apr 2021 09:37:35 +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=luD5uIFmUAJTfX6PRbfmMFPKqBDuCxLUv+CVzNc1Wzc=; b=f2pMYKLUzQgaqBIzwQnhahhW+l L19kLAa9rSszNZTf0VoXjDlnFdEwCpZEFSEAwscnl2gYYbij7ZGoPzqsOemesIDCqIhXLSU4fPl1p QYJbZUwC8RcOkXZLXU36/tTve/bS/dhlngsFMhlbwYu7Y1T4jsGQXIs4VFPhVnR3jDXkNzmRhP0G3 HxGv43Al1xwE0KfoW4sqy43U2EmUaXIKgZDELx9VCrUu8IwQoKqs/6p0ct/9y6JOpfkTy3QIhaFxj 3fAX0VyZPZKDJWVr01KCQkjSlovQexN1e8mfO+sJ0kcdReO5VBK3BeJBtaxKY1PuuBkHBSbC57swO EwXV5DNw==; Received: from eu-smtp-delivery-151.mimecast.com ([185.58.85.151]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lVt0d-0064ek-T5 for linux-arm-kernel@lists.infradead.org; Mon, 12 Apr 2021 09:37:33 +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-82-C7COxs-EPmWmM_DfUiqZhw-1; Mon, 12 Apr 2021 10:37:23 +0100 X-MC-Unique: C7COxs-EPmWmM_DfUiqZhw-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 10:37:22 +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 10:37:22 +0100 From: David Laight To: '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" , Arnd Bergmann CC: "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: AQHXL3nAXViKKuH90kqxIUkBtWSuL6qwmWXw Date: Mon, 12 Apr 2021 09:37:21 +0000 Message-ID: <15be19af19174c7692dd795297884096@AcuMS.aculab.com> References: <20210412085545.2595431-1-hch@lst.de> <20210412085545.2595431-6-hch@lst.de> In-Reply-To: <20210412085545.2595431-6-hch@lst.de> 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_023732_213799_A22EB886 X-CRM114-Status: GOOD ( 14.93 ) 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: Christoph Hellwig > Sent: 12 April 2021 09:56 > > Provide a single common definition for the compat_flock and > compat_flock64 structures using the same tricks as for the native > variants. An extra define is added for the packing required on x86. > ... > /* > - * IA32 uses 4 byte alignment for 64 bit quantities, > - * so we need to pack this structure. > + * IA32 uses 4 byte alignment for 64 bit quantities, so we need to pack the > + * compat flock64 structure. > */ > -struct compat_flock64 { > - short l_type; > - short l_whence; > - compat_loff_t l_start; > - compat_loff_t l_len; > - compat_pid_t l_pid; > -} __attribute__((packed)); > +#define __ARCH_NEED_COMPAT_FLOCK64_PACKED That shouldn't need to be packed at all. (Since the 32bit variant isn't packed.) compat_loff_t should itself have __attribute__((aligned(4))) probably inherited from compat_s64. So l_start will be at offset 4 without the __packed. 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. If the padding need not be named for the 64bit system calls. (Where there is probably rather more padding all over the place.) then it doesn't need to be named for the compat variants. Even the mips extra padding could be removed. F_GETLK might be expected to do a read-write of them, so return EFAULT if not mapped. But nothing should be testing the EFAULT is returned! 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