Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1244683imu; Tue, 11 Dec 2018 15:41:38 -0800 (PST) X-Google-Smtp-Source: AFSGD/UyxPBS7Q9bLdW13Djgk7ytPKe1ucVaJYBye4YWsY3jXojJFLdsEjQTo16vmWtfOz/csMYK X-Received: by 2002:a62:b2c3:: with SMTP id z64mr17959536pfl.120.1544571698665; Tue, 11 Dec 2018 15:41:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544571698; cv=none; d=google.com; s=arc-20160816; b=g5aoX+ieRk6ynqYJ67BP18Jnnpi1tpixECPb3AH+qM3YycQgzO9oe3SjXXADCJfqTF FKIfwjHGVdVKkMb3gzOMR4BJ7mPmFgZLNHCilT5qi+BQUKXiHGJoAbIv/MEPhC6eO3YK nhPJFdfSd/ogofPzL0xBn/DAQrsmWhlj+LA3H6ePp0l82fjbyUKp14MW1Ac8vLapyNWO oINVPae+/giw4WnHPLqs+Lsi4qnzdrKMfU4VhNROSJm173r0wTdkVcNkX1EKwt4UKT5y qtGOXiM/sSeD45BZe5eTNPIPYfpBR8kAb13BcKh+wb1oLEW1d/Fsd/bgwKURTOi7F/Sc Pv7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :content-language:references:message-id:in-reply-to:subject:cc:to :from:date; bh=zANc3HK+y5/OSANw9iDYDr9x+VsxXjsD37b9YXznBZk=; b=JI3VKOaR3d0cjNtyzxxixfsPZgVsHzDkwczucRrVbyOJoiIBtPZc25P0YzD0KS+Pim uZA3I36NK2C88WLD+1W8JxYYTyY0QNb6+LFTr1L6wLbNBodecgey9uWAZXnAtnHpPoDR Rw41suTrrW1pcJZDxs2hTIu+Do+CZppNQNfhh0Ka5jGr9tCogBBJNM+tU/HC8gUk9Ukj RnFKv6WKJDTyQNqlyCMhQdQyOvrNrB6OVQ2vcWOBroOQnONgqwVoy/N6jCZ4O3tUPwyn EaNdzVnSVAPmnS8Y/ftvcwLHOqja8oarkVj3m8+VrTRdZgWcmfODr9kK0sRaZtrn2DVz sFfA== 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 d9si13471462plr.127.2018.12.11.15.41.01; Tue, 11 Dec 2018 15:41:38 -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 S1726283AbeLKXj2 convert rfc822-to-8bit (ORCPT + 99 others); Tue, 11 Dec 2018 18:39:28 -0500 Received: from static-87-79-237-121.netcologne.de ([87.79.237.121]:7619 "EHLO herc.mirbsd.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726158AbeLKXj2 (ORCPT ); Tue, 11 Dec 2018 18:39:28 -0500 Received: from herc.mirbsd.org (tg@herc.mirbsd.org [192.168.0.82]) by herc.mirbsd.org (8.14.9/8.14.5) with ESMTP id wBBNZbgp028297 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 11 Dec 2018 23:35:38 GMT Date: Tue, 11 Dec 2018 23:35:36 +0000 (UTC) From: Thorsten Glaser X-X-Sender: tg@herc.mirbsd.org To: Andy Lutomirski cc: Linus Torvalds , X86 ML , LKML , Linux API , "H. Peter Anvin" , Peter Zijlstra , Borislav Petkov , Florian Weimer , Mike Frysinger , "H. J. Lu" , Rich Felker , x32@buildd.debian.org, Arnd Bergmann , Will Deacon , Catalin Marinas Subject: Re: Can we drop upstream Linux x32 support? In-Reply-To: Message-ID: References: Content-Language: de-DE-1901, en-GB X-Message-Flag: Your mailer is broken. Get an update at http://www.washington.edu/pine/getpine/pcpine.html for free. MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=utf-8 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Andy Lutomirski dixit: >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? Yes, that’s indeed ugly. I understand. But don’t we already have this problem with architectures which support multiple ABIs at the same time? An amd64 kernel with i386 userspace comes to mind, or the multiple MIPS ABIs. >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); Something like that might be useful. Generate call stubs, which then call the syscall implementation with the actual user-space struct contents as arguments. Hm, that might be too generic to be useful. Generate macros that can read from or write specific structures to userspace? I think something like this could solve other more general problems as well, so it might be “nice to have anyway”. Of course it’s work, and I’m not involved enough in Linux kernel programming to be able to usefully help with it (doing too much elsewhere already). >actually do this work. Instead we get ad hoc fixes for each syscall, >along the lines of preadv64v2(), which get done when somebody notices Yes, that’s absolutely ugly and ridiculous and all kinds of bad. On the other hand, from my current experience, someone (Arnd?) noticed all the currently existing baddies for x32 already and fixed them. New syscalls are indeed an issue, but perhaps something generating copyinout stubs could help. This might allow other architectures that could do with a new ABI but have until now feared the overhead as well. (IIRC, m68k could do with a new ABI that reserves a register for TLS, but Geert would know. At the same time, time_t and off_t could be bumped to 64 bit. Something like that. If changing sizes of types shared between kernel and user spaces is not something feared…) Thanks for considering, //mirabilos -- „Cool, /usr/share/doc/mksh/examples/uhr.gz ist ja ein Grund, mksh auf jedem System zu installieren.“ -- XTaran auf der OpenRheinRuhr, ganz begeistert (EN: “[…]uhr.gz is a reason to install mksh on every system.”)