From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 97F28C433DB for ; Sun, 20 Sep 2020 00:14:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4592F235F8 for ; Sun, 20 Sep 2020 00:14:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600560896; bh=hFlNFuPTeOm0L/kdCL4zZ1r5D8O6dPLmjujTGrKOlYM=; h=References:In-Reply-To:From:Date:Subject:To:Cc:List-ID:From; b=gRCNazNNHSKj/l+qTG/LDyVMYGTfwTXNebmLAvhcU4NjNpqCC1hsBWzNCOOzqj8mY lpowHOV/ej+loDa5/X3vd4Ugb8N7r55oD997KMAeKNgJWdbC/9fkwrq/VAE65LHUhU NTzw174Aw2bq6VoEkCrQMSEwlUf3vfByv3IJ2ZAQ= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726807AbgITAOz (ORCPT ); Sat, 19 Sep 2020 20:14:55 -0400 Received: from mail.kernel.org ([198.145.29.99]:60814 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726788AbgITAOz (ORCPT ); Sat, 19 Sep 2020 20:14:55 -0400 Received: from mail-wr1-f51.google.com (mail-wr1-f51.google.com [209.85.221.51]) (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 E629E23600 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-f51.google.com with SMTP id o5so9149327wrn.13 for ; Sat, 19 Sep 2020 17:14:54 -0700 (PDT) X-Gm-Message-State: AOAM530UWvU6i+V8qcK3SvcVWSVf6r0/oL4lElOC6DQdRSs4YVzq2HEV b7QkuUlRPL+Vxa9e1f0hQlrAEWkPNsdrxAO/K/6OxQ== X-Google-Smtp-Source: ABdhPJwNa+g9tI1uon0gRHcB2mOJvq7bEiosz+i+17dS26MXBg9h+I1xFom2CJCFuIf/wJaqwzsOPjK0guk9bG2/Zms= 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: io-uring@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.