Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp418191imu; Tue, 11 Dec 2018 01:04:20 -0800 (PST) X-Google-Smtp-Source: AFSGD/XeW/LgHgmcSusXDU4SnX9rDEXfMRbz/fUTarRaz/bfUHINDrmdcNTgwjaI4cpGjPPJHHr8 X-Received: by 2002:a17:902:7005:: with SMTP id y5mr15360182plk.7.1544519060454; Tue, 11 Dec 2018 01:04:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544519060; cv=none; d=google.com; s=arc-20160816; b=RXxu7mkhgRxiGrfbGBTO9ZlVrSAfKAztw6OotSy7EPIdILIE+u9zDBmUi98iJctw1Y HIoG0uHecrneSTguKqO5WYLYB+x/OYWiZ62iUo7lMzTDq7DudAhLWyOwvxBqhJ+0VaoE 6eMmBkUKye9okgm6CmEddBfxHPGxAZMJRQ7VEUGAPq62xe3FbSusfHE/nlY2C7rr/HuU tSgOs4gxZykPUDbTvDZcfS3oOYgjfyx70f07KWvfU4wf5O0WvFh2h5PWpDoUgAXbeh3c kS3RwZBmg0PUY7WvOSz93r/THiA2cT6sqtSV3KyEXnUP5laAWRm2PxxdLyhJPioAqILg uYBQ== 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 :in-reply-to:references:mime-version; bh=oeWJmY84JG6eAX2k07pciE7NYOZrbaPRTVaeLim/GR0=; b=fc3BZCeXear9Qd/yJk+xxO0arUHtarFHz+DNObedzg07+iVET4xaIydszCP/aRch/T ebEF2igbrGUcnCqUVvqHq8VXiXslUzmP7kHmC7a+yYGGBlYvJ5p4lNovYaDHEgzuyLt1 KHDGzS0ON6E9FsxKjsPs/Bungv/I4/sn02ZHdb1GUrUTuN5qpi52lZs7fE2f1JmoV5g0 V00Z+6Ti7q7fZyIYmq2yGAXTvKUJjl+hWY9tcw0eAJbopk3E/BMSZ794632WGUCu74cC voo7Tk3GlQUcBWMXbV3TzyFKaNx5df+mQHzbSoU4Ezef0SFuHQtF46x7xx59txhObICc +qBw== ARC-Authentication-Results: i=1; mx.google.com; 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 b18si10770149pgj.399.2018.12.11.01.04.04; Tue, 11 Dec 2018 01:04:20 -0800 (PST) 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; 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 S1726154AbeLKJDG (ORCPT + 99 others); Tue, 11 Dec 2018 04:03:06 -0500 Received: from mail-qk1-f195.google.com ([209.85.222.195]:33077 "EHLO mail-qk1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726085AbeLKJDF (ORCPT ); Tue, 11 Dec 2018 04:03:05 -0500 Received: by mail-qk1-f195.google.com with SMTP id o89so8182709qko.0; Tue, 11 Dec 2018 01:03:04 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=oeWJmY84JG6eAX2k07pciE7NYOZrbaPRTVaeLim/GR0=; b=VShOFWPXfyxhnKLoG8Goxl8xI7RjLSpv9mhke8F/RL8bW2pisyY1qWdpma5uqKfGf3 rbuOmlrOdsEEiRxyLaq8ro2wDjWb/mcSGybUjBdw34dfAbGedqcAE1xiUUzPai8LPesX 1wMs8NTh6agKpVEwRD5a+Am1FfHrvo6uvfwfb9hfINDG0ngsO0Sj1mrnyF/LKc01ajaj 3E0dA8Ut5wGOMAT6FdxqOXaOKng/a1A+qkvtof/U6RaxS2GgGu7T9h23snE9iFELbA0p ArWQXTn2ln7nIVWxYnlVAZz5s6XM+QII0vkZIq1C0IAKgjGuZvNpBBYKwd2FQ0ugfhCr lOHA== X-Gm-Message-State: AA+aEWZ59dxeqzVY3nFvAoLW2+PHNV07FJhIFupKHC+0YfYj7vLw9tA/ jir8L90rxkpSZGJ/qjkR5G1rQcLVKv1kk5U8AZQ= X-Received: by 2002:ae9:d8c2:: with SMTP id u185mr13129956qkf.107.1544518984309; Tue, 11 Dec 2018 01:03:04 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Arnd Bergmann Date: Tue, 11 Dec 2018 10:02:45 +0100 Message-ID: Subject: Re: Can we drop upstream Linux x32 support? To: Andy Lutomirski Cc: "H.J. Lu" , "the arch/x86 maintainers" , Linux Kernel Mailing List , Linux API , "H. Peter Anvin" , Peter Zijlstra , Borislav Petkov , Florian Weimer , vapier@gentoo.org, Rich Felker , x32@buildd.debian.org, Will Deacon , Catalin Marinas , Linus Torvalds 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 Tue, Dec 11, 2018 at 6:35 AM Andy Lutomirski wrote: > On Mon, Dec 10, 2018 at 7:15 PM H.J. Lu wrote: > > On Mon, Dec 10, 2018 at 5:23 PM Andy Lutomirski wrote: > Right. My question wasn't whether x32 had developers -- it was > whether it had users. If the only users are a small handful of people > who keep the toolchain and working and some people who benchmark it, > then I think the case for keeping it in upstream Linux is a bit weak. +1 > > > Conversely, if you call a syscall in the 512 range with bit 31 > > > *clear*, then the compat entry is set with in_compat_syscall() > > > *clear*. This is also nutty. > > > > This is to share syscalls between LP64 and ILP32 (x32) in x86-64 kernel. > > > > I tried to understand what's going on. As far as I can tell, most of > the magic is the fact that __kernel_long_t and __kernel_ulong_t are > 64-bit as seen by x32 user code. This means that a decent number of > uapi structures are the same on x32 and x86_64. Syscalls that only > use structures like this should route to the x86_64 entry points. But > the implementation is still highly dubious -- in_compat_syscall() will > be *true* in such system calls, I think the fundamental issue was that the intention had always been to use only the 64-bit entry points for system calls, but the most complex one we have -- ioctl() -- has to use the compat entry point because device drivers define their own data structures using 'long' and pointer members and they need translation, as well as matching in_compat_syscall() checks. This in turn breaks down again whenever a driver defines an ioctl command that takes a __kernel_long_t or a derived type like timespec as its argument. > which means that, if someone changes: > ... > where one argument has x32 and x86_64 matching but the other has x32 > and x86_32 matching. > > This whole thing seems extremely fragile. It definitely is. We have lots of workarounds specifically for x32 in device drivers, but in the time_t conversion for y2038 I still found ones that had not been caught earlier, and for each y2038 conversion that someone did to a driver or syscall, we have to make sure that it doesn't break x32 in the process. Arnd