Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1243383imu; Tue, 11 Dec 2018 15:39:37 -0800 (PST) X-Google-Smtp-Source: AFSGD/VttWtadZblkhanNTQS/zBmLXcWTZ7v18XGqQ8lj6LPKpjZa9UoXcK+xKRfhsvHjHpiY/N1 X-Received: by 2002:a63:4a0a:: with SMTP id x10mr16296765pga.237.1544571577102; Tue, 11 Dec 2018 15:39:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544571577; cv=none; d=google.com; s=arc-20160816; b=XSyxy2B4cSiaB63tUPOznpsEGopwRPEQ1Ke1E/SAssbKOGuFhe+zD3WbKQoNIfSSVU 4qT2pTltp9Fok42EP+ReIFyQRLJKU1HmXCv1zQy1ytLRTzhnlMgieb2UcBc2nHLWgmWw LRPsgYL9ZjcZIzdDWryaJZwz+uxZp0a+PZpFNfhogJ+GN9o4/sknVa/I6sGuJo059bGL zGHhn5GiZScfTby80YgvVqf/4FGvwZVYaaBPgsqoTBtkrOho/pwyKBFHFgvMHsDJ7Lvp KpkTbOFSyw5IzdhmBWGd+0BO3Brrhu6zxdvPcvhCPBtvdvuW7V9tDTl6ijFgDjzTBB/2 Ln2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=p8Gu6i44yAzdbGn9cFVFHenQqz/9cOWS2ZxWDoxTisQ=; b=Y5c0Yk5cq4biCv1SW7PDdToGhqLXhcj7OTDQAg/dX1Qy58BggpLvUNEGUqn6KpNNkL EdA5k28d0XQgt1nD4zoRpfdssaOqSD0JO6ElmI9aTvoL+ZqUzfyWpP+89WsMyNyfzQLn MB3jZd38hTT81nn3Jce8fPhWdLxYPRbgQNIN2Se4RxiXO2hyCmbintfDQqkrVuTaQ29E iWC0Pfc8Jv6zAd1kRseA6BE+AxokNXUKfQR2TfPCvo16xmjQkl0Abdxq5AODMLoDkuFR PCgy+wKBnK3LPU+8UBYV+Hj6Wm8YAX7vEUoEmPRPBM1Td4ri7rh/Ny58fJW5Hbb6Kain 6dIQ== 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 o27si12605760pgl.53.2018.12.11.15.39.22; Tue, 11 Dec 2018 15:39:37 -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 S1726253AbeLKXiK (ORCPT + 99 others); Tue, 11 Dec 2018 18:38:10 -0500 Received: from 216-12-86-13.cv.mvl.ntelos.net ([216.12.86.13]:58778 "EHLO brightrain.aerifal.cx" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726158AbeLKXiK (ORCPT ); Tue, 11 Dec 2018 18:38:10 -0500 Received: from dalias by brightrain.aerifal.cx with local (Exim 3.15 #2) id 1gWrbJ-0007pV-00; Tue, 11 Dec 2018 23:38:05 +0000 Date: Tue, 11 Dec 2018 18:38:05 -0500 From: Rich Felker To: Andy Lutomirski Cc: tg@mirbsd.de, Linus Torvalds , X86 ML , LKML , Linux API , "H. Peter Anvin" , Peter Zijlstra , Borislav Petkov , Florian Weimer , Mike Frysinger , "H. J. Lu" , x32@buildd.debian.org, Arnd Bergmann , Will Deacon , Catalin Marinas Subject: Re: Can we drop upstream Linux x32 support? Message-ID: <20181211233805.GO23599@brightrain.aerifal.cx> References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) 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 03:22:43PM -0800, Andy Lutomirski wrote: > On Tue, Dec 11, 2018 at 2:14 PM Thorsten Glaser wrote: > > I was also considering investing a nontrivial amount of > > work into porting klibc to x32, since hpa does not wish > > to do it himself. Thankfully I have only done a bit yet. > > > > Furthermore, x32 was the first of the many *64ilp32 > > architectures; I know I’ve seen amd64ilp32 and at least > > one other I don’t recall. It will have prototyped many > > of the problems users of these will run in, and I’d prefer > > to keep it (completely selfish because I don’t wish to > > have to crossgrade a whole system yet again). > > it kind of seems like arm64's lesson is "don't do it like x32". > > There's some effort going on right now to make it possible to add > syscalls without having to muck with every single architecture. I > don't really want x32 to derail that effort. I suppose we could say > that x32 stays but that it simply gets no new syscalls, but that seems > a bit lame. Unfortunately, on x86, x32 really is a third ABI that is > not compatible in a structure-memory-layout sense with the other two. > What happens if someone adds a struct like: > > struct nasty_on_x32 { > __kernel_long_t a; > void * __user b; > }; > > On x86_64, that's two 8-byte fields. On x86_32, it's two four-byte > fields. On x32, it's an 8-byte field and a 4-byte field. Now what? > > I'm sure we could have some magic gcc plugin or other nifty tool that gives us: > > copy_from_user(struct struct_name, kernel_ptr, user_ptr); > > where it automatically generates code for all possible ABIs to copy > over the struct and dispatches dynamically based on the current > syscall ABI, but I have trouble imagining anyone volunteering to > actually do this work. Instead we get ad hoc fixes for each syscall, > along the lines of preadv64v2(), which get done when somebody notices > a problem. For what it's worth, this is exactly what I plan to do if/when I ever get to doing my kernel with multiple/universal userspace ABI support: pure-data markup for the data structures (and syscall argument arrangements) userspace is speaking, with generic marshalling code. But I don't think it's easy to retrofit to Linux, and probably wouldn't be welcome there. Rich