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 07539C43463 for ; Sun, 20 Sep 2020 00:14:59 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 7678F2100A for ; Sun, 20 Sep 2020 00:14:58 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="puNMNVSI" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7678F2100A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 8597D8E0001; Sat, 19 Sep 2020 20:14:57 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7B8C96B005A; Sat, 19 Sep 2020 20:14:57 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 682B28E0001; Sat, 19 Sep 2020 20:14:57 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0160.hostedemail.com [216.40.44.160]) by kanga.kvack.org (Postfix) with ESMTP id 51C116B0055 for ; Sat, 19 Sep 2020 20:14:57 -0400 (EDT) Received: from smtpin16.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 12426181AEF1E for ; Sun, 20 Sep 2020 00:14:57 +0000 (UTC) X-FDA: 77281519434.16.ray77_591271b27138 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin16.hostedemail.com (Postfix) with ESMTP id D255B100E54B3 for ; Sun, 20 Sep 2020 00:14:56 +0000 (UTC) X-HE-Tag: ray77_591271b27138 X-Filterd-Recvd-Size: 4306 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf36.hostedemail.com (Postfix) with ESMTP for ; Sun, 20 Sep 2020 00:14:56 +0000 (UTC) Received: from mail-ej1-f48.google.com (mail-ej1-f48.google.com [209.85.218.48]) (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 358A12376F for ; Sun, 20 Sep 2020 00:14:55 +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-ej1-f48.google.com with SMTP id i26so12875712ejb.12 for ; Sat, 19 Sep 2020 17:14:55 -0700 (PDT) X-Gm-Message-State: AOAM532DeV89wucKOm361NGRvEia7fH9R26FvGG+ew0GWtsHoP1e4+Ng rjBhp36YGhsbZi4Ylhzg72zZ+/fztRJDiBC25/yUbw== 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 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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.