Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp2202140pxk; Sat, 19 Sep 2020 17:16:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx6+GXJgg1/3aWNbyZ0vHexXfQzn6DKnzR1x6et8RNFCnA8AIX/ss3qa+sZHStXgqDy/9pT X-Received: by 2002:a17:906:d7ab:: with SMTP id pk11mr42680457ejb.472.1600561017013; Sat, 19 Sep 2020 17:16:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600561017; cv=none; d=google.com; s=arc-20160816; b=xvNSNxFfF6sWq0cc1lqs5uPdouzz9V5gDm4TBgXzZz7z/2xaoU0veJb6zwlPT1ISy1 w8DYlrYwBhT3HqEjL/FCShp+Ep8l/IDv3Ai2AUu7OfkXnS+qhn1dziDO+qJBZTdPOk7G 0obHwr1fgHgc5FkKoBaclaciIpckTFrn+sBW2co6busJ+7a9+b90vEbTO7++LSDUkMJc ilV0B7VadeaYGl4dx0eAr5rO7aOlRo1kkNWqMAKtf42oJpjgwg6wGhsop6NWdsvMLSeG wb14iXMoTrVuPS0MpzHqD9EdO5wz5Liy3yxbzjuyZqO0Gbto+FdkOwTK+0+jq5rPZ1TM UAcA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=kNWau8YsUJsYJitgm4MM9VoRuT6tGfDuEiCRKt9rgEQ=; b=ppvnFBpFHfHDWlcY678Ym/tDLD+5HCvNzsTPaNtrhceahXQ5t3zIRpDYQ5zEnkgH46 c0vkyl5wl5aOZKwGtN/uHYA2SzDW9vDJzO3yjylRcz5Ashud7YiKTHO8DAQnu6smqRte HJVxp9eAhq7Ji0loZezMKRFSYBhNksJAgeLZ+ZI0jTYrhkXNLeWImdN7uPJ3sxuuQa8b ZnYO1BA7pw5adO3PSP1n7D/2BNCwHQiLT5wos0ywATPZxr3+WuuNwGU2l3KAl/B6382o I+tq1XmoTkkT5emWRLGTGRi3pxtS6yjsOhfcPEslzYlnirgSA45Nvb7ngrNex5OPN084 P9ag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=puNMNVSI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v11si5161444edx.325.2020.09.19.17.16.22; Sat, 19 Sep 2020 17:16:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=puNMNVSI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726845AbgITAO5 (ORCPT + 99 others); Sat, 19 Sep 2020 20:14:57 -0400 Received: from mail.kernel.org ([198.145.29.99]:60876 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726680AbgITAO4 (ORCPT ); Sat, 19 Sep 2020 20:14:56 -0400 Received: from mail-wr1-f52.google.com (mail-wr1-f52.google.com [209.85.221.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id F34FA23730 for ; Sun, 20 Sep 2020 00:14:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600560895; bh=hFlNFuPTeOm0L/kdCL4zZ1r5D8O6dPLmjujTGrKOlYM=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=puNMNVSIh3nOcXZR2bsSX89mx7JsoFWoBEe7Ak/z+DHmLOhb+Kh9sSU8Baw2xkYcL D2jd4AOn8hF0K/zn41LjhaaVl7xocGLJmOT8gdJrwj7qZg0ejYTZECwuJzlzHWv+kO OFRT3p90VCBE1oiQrCZZUJZydIgvG/SANufNNLCU= Received: by mail-wr1-f52.google.com with SMTP id t10so9181030wrv.1 for ; Sat, 19 Sep 2020 17:14:54 -0700 (PDT) X-Gm-Message-State: AOAM533F29XMaaqLSLu/4wUhuzKs8uXldhUCtf0OJw+XwONjHWoAM4Mb ZqHOpCWUJsijISztTX8chlmusPOGiVE0ZCrFiwtImQ== X-Received: by 2002:adf:a3c3:: with SMTP id m3mr251480wrb.70.1600560893353; Sat, 19 Sep 2020 17:14:53 -0700 (PDT) MIME-Version: 1.0 References: <20200919224122.GJ3421308@ZenIV.linux.org.uk> <36CF3DE7-7B4B-41FD-9818-FDF8A5B440FB@amacapital.net> <20200919232411.GK3421308@ZenIV.linux.org.uk> In-Reply-To: <20200919232411.GK3421308@ZenIV.linux.org.uk> From: Andy Lutomirski Date: Sat, 19 Sep 2020 17:14:41 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 1/9] kernel: add a PF_FORCE_COMPAT flag To: Al Viro Cc: Christoph Hellwig , Andrew Morton , Jens Axboe , Arnd Bergmann , David Howells , linux-arm-kernel , X86 ML , LKML , "open list:MIPS" , Parisc List , linuxppc-dev , linux-s390 , sparclinux , linux-block , Linux SCSI List , Linux FS Devel , linux-aio@kvack.org, io-uring@vger.kernel.org, linux-arch , Linux-MM , Network Development , keyrings@vger.kernel.org, LSM List Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Sep 19, 2020 at 4:24 PM Al Viro wrote: > > On Sat, Sep 19, 2020 at 03:53:40PM -0700, Andy Lutomirski wrote: > > > > It would not be a win - most of the syscalls don't give a damn > > > about 32bit vs. 64bit... > > > > Any reasonable implementation would optimize it out for syscalls that d= on=E2=80=99t care. Or it could be explicit: > > > > DEFINE_MULTIARCH_SYSCALL(...) > > 1) what would that look like? In effect, it would work like this: /* Arch-specific, but there's a generic case for sane architectures. */ enum syscall_arch { SYSCALL_NATIVE, SYSCALL_COMPAT, SYSCALL_X32, }; DEFINE_MULTIARCH_SYSCALLn(args, arch) { args are the args here, and arch is the arch. } > 2) have you counted the syscalls that do and do not need that? No. > 3) how many of those realistically *can* be unified with their > compat counterparts? [hint: ioctl(2) cannot] There would be no requirement to unify anything. The idea is that we'd get rid of all the global state flags. For ioctl, we'd have a new file_operation: long ioctl(struct file *, unsigned int, unsigned long, enum syscall_arch); I'm not saying this is easy, but I think it's possible and the result would be more obviously correct than what we have now.