Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp768694ybh; Tue, 21 Jul 2020 07:31:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxNyu1xAf3Stz64xOlEBrJthWsaIA3iKRr8YfFOgbzhev5QIAAaEQgUfVeHyRKMEXWPkJuJ X-Received: by 2002:a17:906:743:: with SMTP id z3mr25273228ejb.216.1595341919308; Tue, 21 Jul 2020 07:31:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595341919; cv=none; d=google.com; s=arc-20160816; b=LVpdS0RMP1mbWScORZz/9t3F9TpxXnMDOqJKt7Y3yYFfmOLdbYnyw+Sa5DEYTcjc1w d44EdZEs/NK066HbhlAtrQcsGE+m6+YPYzpbR45g6qPKGzHrs1ROjP8Tx3/rDOPOWbqe Ssv/uojSP2Js8+XBFOAOF8w1/t0di5rcFv8uZzftwGDuLk9YbPDj5JYV5b5xTCh3BU7r M+ZIs0Fyfcx3cQUXtiNGBm1IwrghR3SG5xh8SkbZsdnwdsowrLb4E54U/RBNUC/R0Cwr BJ2Dx109Ydd+wcbC3IPoPBAUerfdBGALd3KMrpit9Xx2O3Shsl4OEgDa5LTejCe7RsEG gRXg== 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:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=N3mF2H28TbWGsfd14cdQ/ZYtAvemQtUM+6T/u9Ej3Co=; b=WBFBi2TbdpsvliaG9wK/kGAESsMBmlT+/ljC8MX/n8pFhXihju4mtUVDHDSYjNmrQf jcPWBvxnpDwh4blWsb48GOD+A0wvoLal5QBCTW61LPFgdV0UqqHQJJKU1bepQcKVUeZ4 lLd0SXGgZX0lqJG7yD0CygNfJZ86CHut1FRzlvvLUvAfeVgZFGQQUvMNA+hLwrMnPTh1 PqkDLKnnO1H8Y1f5KDEULkdM8sWE5CbTyxT3wjDbrzps5Pdyvh/VVklHGZvV3TpSyZL8 ScwATE2/7fF71uANK9IdO6HBuBCFLCHSNSUGnpkoGaP0TFRe3QlsLQwNMSWOfXratwlo bsaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=FIXVpqVF; 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 m27si12144551eja.699.2020.07.21.07.31.35; Tue, 21 Jul 2020 07:31:59 -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=FIXVpqVF; 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 S1729092AbgGUObR (ORCPT + 99 others); Tue, 21 Jul 2020 10:31:17 -0400 Received: from mail.kernel.org ([198.145.29.99]:59784 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728792AbgGUObQ (ORCPT ); Tue, 21 Jul 2020 10:31:16 -0400 Received: from mail-wr1-f44.google.com (mail-wr1-f44.google.com [209.85.221.44]) (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 93B4820771 for ; Tue, 21 Jul 2020 14:31:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1595341875; bh=ZE6hi4D69jtIEwF4BK+ARV2G4sOs0NzxotlkHEFjWG4=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=FIXVpqVFnHQzBx1VxkA+w+YDqLVl/RYm7UoTNMrv6VIfV3Gx70W/8SZNe7ugJDPwE Q7kMMy3pIo+MOFCVP3IQEsZUPEdSFAapyQ0sVcFBEmuxuc/FyVc+GeXQgT7dAQZF88 rieidcedEQn8J3xa6mzwXSYOCfwJdTFgwOpCzaEU= Received: by mail-wr1-f44.google.com with SMTP id z15so21401844wrl.8 for ; Tue, 21 Jul 2020 07:31:15 -0700 (PDT) X-Gm-Message-State: AOAM531KTF7hlUOXSYp99htxAc2vXjJOl/fXSkDGm1OCnU7RUsjMmD5i S6PsltUMP6+yyQDVKYIv1c4McuCO7XgqvsrlMIwr4g== X-Received: by 2002:a5d:5273:: with SMTP id l19mr17580739wrc.257.1595341874203; Tue, 21 Jul 2020 07:31:14 -0700 (PDT) MIME-Version: 1.0 References: <8987E376-6B13-4798-BDBA-616A457447CF@amacapital.net> <20200721070709.GB11432@lst.de> In-Reply-To: <20200721070709.GB11432@lst.de> From: Andy Lutomirski Date: Tue, 21 Jul 2020 07:31:02 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: io_uring vs in_compat_syscall() To: Christoph Hellwig Cc: Jens Axboe , linux-arch , Linux API , LKML , io-uring@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jul 21, 2020 at 12:07 AM Christoph Hellwig wrote: > > On Mon, Jul 20, 2020 at 10:28:55AM -0700, Andy Lutomirski wrote: > > > Sure, I'd consider that implementation detail for the actual patch(es= ) > > > for this issue. > > > > There=E2=80=99s a corner case, though: doesn=E2=80=99t io_uring submiss= ion frequently do the work synchronously in the context of the calling thre= ad? > > Yes. > > > If so, can a thread do a 64-bit submit with 32-bit work or vice versa? > > In theory you could share an fd created in a 32-bit thread to a 64-bit > thread or vice versa, but I think at that point you absolutely are in > "you get to keep the pieces" land. That seems potentially okay as long as these are pieces of userspace and not pieces of the kernel. If the kernel freaks out, we have a problem. > > > Sometimes I think that in_compat_syscall() should have a mode in which = calling it warns (e.g. not actually in a syscall when doing things in io_ur= ing). And the relevant operations should be properly wired up to avoid glo= bal state like this. > > What do you mean with "properly wired up". Do you really want to spread > ->compat_foo methods everywhere, including read and write? I found > in_compat_syscall() a lot small and easier to maintain than all the > separate compat cruft. I was imagining using a flag. Some of the net code uses MSG_CMSG_COMPAT for this purpose. --Andy