Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp2172626pxk; Sat, 19 Sep 2020 15:56:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyjuAzCZC99Zz42KGXIOw7hHjkeSVUMQkJAVX6j2JyKOAGxeERIk0s6ws66kVCvgvoNdLTn X-Received: by 2002:a17:906:1f08:: with SMTP id w8mr42012633ejj.181.1600556168255; Sat, 19 Sep 2020 15:56:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600556168; cv=none; d=google.com; s=arc-20160816; b=BMkaGdAblvi/lZx0cqbW7GWSuoIOkicNRDSBSe5dlaqG6nBa13rg0pu18KQI8XGFT1 375eCS1K/eL3Tj75DMtPD7VXQRiQlWf+N/1lNTx4gebjlZls3cTCrXYKL52j7dighco7 J3PXQ01x3yhR+obVLgwKkLNUxH/0aJr63gj1p/LIiEXSCdPCpQoR8p1goRmb0X4pVFjd qJk5t1qE+MIDYcUKjNmwXV9ozx/Xbk/PSim4J/JwZn9g/p0zZwkusjgGEXaent6FR+iP yZlS54dH3UxMv3r5d9QtwiF9GVF95Ot/C6n6IEn5CLsbqSxxEPUAzw7G27Elb373rPhz FrIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:references:message-id:date:cc:in-reply-to :from:mime-version:subject:content-transfer-encoding:dkim-signature; bh=OiG9AhNV/aYytBLvfrNKs+OEikcE/xFc3qwTD8LXQak=; b=ELZwlIFVM7Yc4/9CYVXBBqeri4FVDX2iH9GnTt40AiMLh+Hmx20su7e74IXRnyIpPQ m5Q0BMmeu/zMedD3RohByzghcP5JjOAz6/XO4QZCn5dfdcAdTyxprdFMyLOq3saU6ziZ 7qZe+cxT7ikPehXLkDohPgSRIquRyiypcqPaeKM0k/EXC2b17tfzlCRvS6B9CuQWJ6Tf guf6Yfu72vLuqUO6OR50/ftogkn0o+ZYHZ2zVr2mei5iNsjGsEX/bZvMWe/Q2D0qPFyI LXhTQvdshsOJpXsfq7CGubRPmvagsoyJfJ3P1y7AOWyRCD8odheXaHmLIDe1J32RBQmK LWpg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amacapital-net.20150623.gappssmtp.com header.s=20150623 header.b=JqRJRr8p; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r25si5102204edo.12.2020.09.19.15.55.34; Sat, 19 Sep 2020 15:56:08 -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=@amacapital-net.20150623.gappssmtp.com header.s=20150623 header.b=JqRJRr8p; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726792AbgISWxt (ORCPT + 99 others); Sat, 19 Sep 2020 18:53:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45284 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726642AbgISWxo (ORCPT ); Sat, 19 Sep 2020 18:53:44 -0400 Received: from mail-pj1-x1043.google.com (mail-pj1-x1043.google.com [IPv6:2607:f8b0:4864:20::1043]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6BC9AC0613CF for ; Sat, 19 Sep 2020 15:53:44 -0700 (PDT) Received: by mail-pj1-x1043.google.com with SMTP id mm21so5158429pjb.4 for ; Sat, 19 Sep 2020 15:53:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amacapital-net.20150623.gappssmtp.com; s=20150623; h=content-transfer-encoding:subject:mime-version:from:in-reply-to:cc :date:message-id:references:to; bh=OiG9AhNV/aYytBLvfrNKs+OEikcE/xFc3qwTD8LXQak=; b=JqRJRr8pAqbUpB6Z8cyMrJ9xHdq76J9quA0nLvKh3ZCmreRApMtVEKJrUh1+iYF6JM j7I4CbitDi/hbJxI3A0yUx65zzxj+9OuhhpvKck/wUnRBF7EuGclsOL0nDYDl8Jf5W94 LKjbYdiN8NQkyPDzWNzRWKhhUpI5BiYKfIYVYjgQr06v6tspjh4Kfljk2gKaOIdeu1AS kmjSb7FfVExI6FATCE4tuWlmlbDYHr+Rf4lm9eioaoVVJRTCo1VHPqqwu78Yo7heUEN2 jwKtRhH+4KJ2y45vqwGsl3R+5jHCVoZnWHE5+MXw1OCY8mxZ6/yyA8kWQtdSX7UdFXP9 eHrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:content-transfer-encoding:subject:mime-version :from:in-reply-to:cc:date:message-id:references:to; bh=OiG9AhNV/aYytBLvfrNKs+OEikcE/xFc3qwTD8LXQak=; b=jiqujQ2ZNWjPNIt8ZxnmLzv7+1T98FKY/nt+VpAmG+lQhHkxSqGUi8Jub4wlT/TVrN tVgJh8N18CR6pKetyUokOYKDcwrxqrURTF8uOkOnCmb1rZfkuNyja9JQ3Q6cRRUIoL02 hRvMS6GViYrFA/KbmC5vemLzGbY79EJhqgkCnCIAL85lyvgMArhU9H/8QwLW6HXQcits wAqQ3b2HC6Cy27Sc1y5yQRWc2Zpz8ITFL3Pu6Mjvy7On60QovoFRl4G0hcIBk2ewTMS/ XBhJAjUgghZ/DCY3to2hVP5miudk+YfimFoJ5Enaa+ez0a9SX8VKe3+31OhflWMFG5Wo Rw5w== X-Gm-Message-State: AOAM533ZgaqLcxSmJJmKmLHjuygcdFliVN3stHxOxyGjUGbomqVnywTt JNKsw80UqGECiZvUeJ9wxFtKEg== X-Received: by 2002:a17:90b:4ac2:: with SMTP id mh2mr17372330pjb.210.1600556023735; Sat, 19 Sep 2020 15:53:43 -0700 (PDT) Received: from localhost.localdomain ([2600:1010:b017:20a:100a:bebe:fad7:f7f9]) by smtp.gmail.com with ESMTPSA id n9sm7688488pfu.163.2020.09.19.15.53.42 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 19 Sep 2020 15:53:43 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PATCH 1/9] kernel: add a PF_FORCE_COMPAT flag Mime-Version: 1.0 (1.0) X-Apple-Notify-Thread: NO X-Universally-Unique-Identifier: E3EC9A91-0DBF-46AE-A57B-AC669BA7C6D0 From: Andy Lutomirski In-Reply-To: <20200919224122.GJ3421308@ZenIV.linux.org.uk> Cc: Christoph Hellwig , Andrew Morton , Jens Axboe , Arnd Bergmann , David Howells , linux-arm-kernel@lists.infradead.org, x86@kernel.org, linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, sparclinux@vger.kernel.org, linux-block@vger.kernel.org, linux-scsi@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-aio@kvack.org, io-uring@vger.kernel.org, linux-arch@vger.kernel.org, linux-mm@kvack.org, netdev@vger.kernel.org, keyrings@vger.kernel.org, linux-security-module@vger.kernel.org Date: Sat, 19 Sep 2020 15:53:40 -0700 X-Apple-Message-Smime-Encrypt: NO Message-Id: <36CF3DE7-7B4B-41FD-9818-FDF8A5B440FB@amacapital.net> References: <20200919224122.GJ3421308@ZenIV.linux.org.uk> To: Al Viro X-Mailer: iPhone Mail (18A373) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > On Sep 19, 2020, at 3:41 PM, Al Viro wrote: >=20 > =EF=BB=BFOn Sat, Sep 19, 2020 at 03:23:54PM -0700, Andy Lutomirski wrote: >>=20 >>>> On Sep 19, 2020, at 3:09 PM, Al Viro wrote: >>>=20 >>> =EF=BB=BFOn Fri, Sep 18, 2020 at 05:16:15PM +0200, Christoph Hellwig wro= te: >>>>> On Fri, Sep 18, 2020 at 02:58:22PM +0100, Al Viro wrote: >>>>> Said that, why not provide a variant that would take an explicit >>>>> "is it compat" argument and use it there? And have the normal >>>>> one pass in_compat_syscall() to that... >>>>=20 >>>> That would help to not introduce a regression with this series yes. >>>> But it wouldn't fix existing bugs when io_uring is used to access >>>> read or write methods that use in_compat_syscall(). One example that >>>> I recently ran into is drivers/scsi/sg.c. >>>=20 >>> So screw such read/write methods - don't use them with io_uring. >>> That, BTW, is one of the reasons I'm sceptical about burying the >>> decisions deep into the callchain - we don't _want_ different >>> data layouts on read/write depending upon the 32bit vs. 64bit >>> caller, let alone the pointer-chasing garbage that is /dev/sg. >>=20 >> Well, we could remove in_compat_syscall(), etc and instead have an implic= it parameter in DEFINE_SYSCALL. Then everything would have to be explicit. = This would probably be a win, although it could be quite a bit of work. >=20 > 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 don=E2= =80=99t care. Or it could be explicit: DEFINE_MULTIARCH_SYSCALL(...)=