Received: by 10.192.165.148 with SMTP id m20csp128803imm; Thu, 19 Apr 2018 14:26:04 -0700 (PDT) X-Google-Smtp-Source: AIpwx4++Mpz2pDJCtWIBDCgvhezwLO47cPWD/DuY63xqm/iBWS2gwHe15fRV9ls6SZVPXyT4xq3s X-Received: by 10.99.125.75 with SMTP id m11mr6300282pgn.391.1524173164319; Thu, 19 Apr 2018 14:26:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524173164; cv=none; d=google.com; s=arc-20160816; b=krWdG3sW7xDIARx/6zW7SCR3iRIvIwLveXI9Ngv3xHPNJ8v+CWp6rk6YOww//PEk4R 03kNnwiRKitO1m2Q8jFaJ3GIdjbHhuuON+f9fmpuLGwLVRK3eXHrRCepz3waw68vD+Bc N+1Er3XiUO+z3dXWgVxvUJ6JwZBRPnmvAJo1DzLMMXtyWAdRrJjDRknWaf1Abt5T9Plr df2vTHRJ5Ouu89+0SrCvRKWGS03+iwgIbV9hFADYV8j6Ucc36ExnGb7cwLb9RhM3MqxY gFB3kLT0cQRPnHH3J0iX8xduqmREdXnUltiTQt1iB9hfiHPhf2H9VjNnFRWaN2Vl1ghK n55g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=TNNvxt/jOfO4nxX6IZlUGxBso8HHjDoce+ZhmRAVAks=; b=vuMosUtyx+Q9vtgklM3Bfj2RhZ+D4jQvlPlJlndKRRD2byFz8GH4TnuI9mBad7qme3 B7CP89dMC1V0OloVdgqTG7jxqFAPi81ut8rfd1RbDJZRNwCJtumB1Y9ItaRTXWczZ+z0 dUeQn9d9SVMUVw1q8L3o0ZilwiYfaWZDF2pvS8Ug0Nx1PWknKXuPRxgB2I/boAyjpVAS PqDK1KnycH2/C/VmYh9wKtQejgSVsqnJEggMiKe+datd/yqs2VYWRDQ883/1/1pcJdar lCYJL7yAzFNlcg4vZ7PtaLjqgpyoAWH5TFX4Ap5oe8PP07Z/dpSsWCDfqIEu3vKNuSwK W9ZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=PwCk3/d0; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e29-v6si4260377plj.518.2018.04.19.14.25.48; Thu, 19 Apr 2018 14:26:04 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=PwCk3/d0; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753500AbeDSVYl (ORCPT + 99 others); Thu, 19 Apr 2018 17:24:41 -0400 Received: from mail-io0-f196.google.com ([209.85.223.196]:41444 "EHLO mail-io0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752725AbeDSVYi (ORCPT ); Thu, 19 Apr 2018 17:24:38 -0400 Received: by mail-io0-f196.google.com with SMTP id o7-v6so6454381iob.8; Thu, 19 Apr 2018 14:24:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=TNNvxt/jOfO4nxX6IZlUGxBso8HHjDoce+ZhmRAVAks=; b=PwCk3/d0XN/9CJvxEtVZCncc6TXVB5Ck9UoYUwGq9aF3jhi3XQI5WRtjDEh/AkAjnu Ah9Yd6TGdet5bKWoA96u/mC4+9XBpFH+LaZrPeZPkGm26CV2HKek3oTeTMxlY+tkew+m WPaYCesfz5sRG82Z+q5CqrfqyYGeBNx0mk+4ntQ7xxpnDO7+Zsdjp/p5AOmajAqPYti1 dzQxGc585mLsA3lTGt2tjo9tHLA99rCBFUj+URdOrYBQ5cjBerN02f0gs3tKfLQeHLzF WzGJGQG0sQHFBsnPleUL1PhGT4nmJLbXsFNm1yf2yzZ5Dzg76CPTAgsUWGBJ3oAHYn8d NBOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=TNNvxt/jOfO4nxX6IZlUGxBso8HHjDoce+ZhmRAVAks=; b=Ik34SOfICbdtdGwZvjU3ia6GeqDKeAK0dknlDZUazEZpCyy5EzWRdvHKBtDEj7iT9u A9Y2r98ZM9cxHGMr03tHV7PbuI68riXWtK3OZ9Cf/zwcEhEnjIExqFmrE/dadYv9NRIP JeO6OcClrA9hThEDu0Oj7qnd9/4uqERBk+GLISv9vMSqyjHSsjR+NKDuYnOYkNNr4H7L xhIvRXbXTbJA72xTU8oDpct+PUHyWpI55VODmb7U9yBvSqQ3fcrzDLsqfDSZFaK6ZdY2 w4kbwJqmr4rJ4xoa6aInqiIDEcPvj07roFbp5qktTLshkfLjm+UW7GtIcA4f3fISQP+a wtVw== X-Gm-Message-State: ALQs6tCsfHLKInuGkhr3DDHVoVF7wiL/6Bz7KBskwL854xWp1gNm2Axd M4phez5q+9q3phiSaZlYVVTCp0HLD9GLsSAogGg= X-Received: by 2002:a6b:2cc7:: with SMTP id s190-v6mr8473726ios.0.1524173077726; Thu, 19 Apr 2018 14:24:37 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a4f:935b:0:0:0:0:0 with HTTP; Thu, 19 Apr 2018 14:24:36 -0700 (PDT) In-Reply-To: References: <20180419143737.606138-1-arnd@arndb.de> <20180419143737.606138-2-arnd@arndb.de> <87efjbnswr.fsf@xmission.com> From: Arnd Bergmann Date: Thu, 19 Apr 2018 23:24:36 +0200 X-Google-Sender-Auth: sfBM_45QNy4kZ-7Da423oVXWhFk Message-ID: Subject: Re: [PATCH v3 01/17] y2038: asm-generic: Extend sysvipc data structures To: "Eric W. Biederman" Cc: y2038 Mailman List , Linux Kernel Mailing List , Linux API , linux-arch , GNU C Library , Thomas Gleixner , Deepa Dinamani , Al Viro , Albert ARIBAUD , linux-s390 , Martin Schwidefsky , "the arch/x86 maintainers" , Catalin Marinas , Will Deacon , "open list:RALINK MIPS ARCHITECTURE" , James Hogan , Ralf Baechle , linuxppc-dev , sparclinux Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Apr 19, 2018 at 5:20 PM, Arnd Bergmann wrote: > On Thu, Apr 19, 2018 at 4:59 PM, Eric W. Biederman wrote: >> I suspect you want to use __kernel_ulong_t here instead of a raw >> unsigned long. If nothing else it seems inconsistent to use typedefs >> in one half of the structure and no typedefs in the other half. > > Good catch, there is definitely something wrong here, but I think using > __kernel_ulong_t for all members would also be wrong, as that > still changes the layout on x32, which effectively is > > struct msqid64_ds { > ipc64_perm msg_perm; > u64 msg_stime; > u32 __unused1; > /* 32 bit implict padding */ > u64 msg_rtime; > u32 __unused2; > /* 32 bit implict padding */ > u64 msg_ctime; > u32 __unused3; > /* 32 bit implict padding */ > __kernel_pid_t shm_cpid; /* pid of creator */ > __kernel_pid_t shm_lpid; /* pid of last operator */ > .... > }; > > The choices here would be to either use a mix of > __kernel_ulong_t and unsigned long, or taking the x32 > version back into arch/x86/include/uapi/asm/ so the > generic version at least makes some sense. > > I can't use __kernel_time_t for the lower half on 32-bit > since it really should be unsigned. After thinking about it some more, I conclude that the structure is simply incorrect on x32: The __kernel_ulong_t usage was introduced in 2013 in commit b9cd5ca22d67 ("uapi: Use __kernel_ulong_t in struct msqid64_ds") and apparently was correct initially as __BITS_PER_LONG evaluated to 64, but it broke with commit f4b4aae18288 ("x86/headers/uapi: Fix __BITS_PER_LONG value for x32 builds") that changed the value of __BITS_PER_LONG and introduced the extra padding in 2015. The same change apparently also broke a lot of other definitions, e.g. $ echo "#include " | gcc -mx32 -E -xc - | grep -A3 __kernel_size_t typedef unsigned int __kernel_size_t; typedef int __kernel_ssize_t; typedef int __kernel_ptrdiff_t; Those used to be defined as 'unsigned long long' and 'long long' respectively, so now all kernel interfaces using those on x32 became incompatible! Arnd