Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp269468ybh; Tue, 21 Jul 2020 23:31:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyNdd7nDSHephSoFmlVjbpkMuxGqe7N6hrsble1Re6Dj0CTW8cNrdJoChd2Fq2DybBLuYwR X-Received: by 2002:a17:906:c453:: with SMTP id ck19mr28037263ejb.185.1595399489585; Tue, 21 Jul 2020 23:31:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595399489; cv=none; d=google.com; s=arc-20160816; b=Yf84YWqviPFXF3RuGOjnSCWXvlMXrGWIEF6WkOQAQ4Lih50blVvvhybjZwgCzS8SAy 3n3xBIx8i1r3cqFlItS4FlOA2zjlkVd4CGQd2xDafB/s0mMgh4WiED+R9qPtk7w3Avnd ARSnMDr7fVz5AlOW6l0ct5alXS9nHibMbSe/MbfX13mN9TWF9jQZGNH8W+PJrIb0v74u AIozRiDcDD3lMwRVput2hz/qKX1N4BHhiRmreVp+7ucVtLPFyOyl4Fus8nc0l0mMfIWD FKn0jKf1Doh8AY9aD7402fO49I2YIUhqcLGsJpE2rxm0YcVT8Rhf7/oFXsQDPhkMVRB8 ypiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=Dxr3gLmHKCyKeWWqM5SIpiUloXjjVisGwIfwlV3fvz4=; b=q/gl9zbJSPyO4MGsOeUUo7fXQQe7jvuoIjLcJHt9VXTGTRjNqYsWJiO3MfRoU6OH1r 3NG8fmCFHq9q1eQbbwV+QuqPFHYoPBlZ58hUTRHV4nNPEgRtGWaooQUXDHcBsa7JgFN2 K7Ll8BkFzfSmcJpbrtqz4yrXNputWI8KBvONDTkNwqyLBhKdiwXbclTD0oCEPQmmiAvX wd+34HlT2YCLPBvNGjy5qxiZ/6HMucmomlXDUsbYhzWeIbU82Op4CzzpDn0oADGOyRW7 b0u4XD3AYciJ9/sv9PbfldlAb2mtKeRmGSrLJkVZx8RlntS2/4HqicAnvwAZMBbt1viS 66Ig== ARC-Authentication-Results: i=1; mx.google.com; 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 g13si13702514edy.128.2020.07.21.23.31.07; Tue, 21 Jul 2020 23:31:29 -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; 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 S1729248AbgGVGay (ORCPT + 99 others); Wed, 22 Jul 2020 02:30:54 -0400 Received: from verein.lst.de ([213.95.11.211]:54974 "EHLO verein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728649AbgGVGay (ORCPT ); Wed, 22 Jul 2020 02:30:54 -0400 Received: by verein.lst.de (Postfix, from userid 2407) id 4624868AFE; Wed, 22 Jul 2020 08:30:51 +0200 (CEST) Date: Wed, 22 Jul 2020 08:30:50 +0200 From: Christoph Hellwig To: Andy Lutomirski Cc: Christoph Hellwig , Jens Axboe , linux-arch , Linux API , LKML , io-uring@vger.kernel.org Subject: Re: io_uring vs in_compat_syscall() Message-ID: <20200722063050.GA24968@lst.de> References: <8987E376-6B13-4798-BDBA-616A457447CF@amacapital.net> <20200721070709.GB11432@lst.de> <20200721143412.GA8099@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.17 (2007-11-01) 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 10:25:24AM -0700, Andy Lutomirski wrote: > On Tue, Jul 21, 2020 at 7:34 AM Christoph Hellwig wrote: > > > > On Tue, Jul 21, 2020 at 07:31:02AM -0700, Andy Lutomirski wrote: > > > > 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. > > > > Killing that nightmarish monster is what actually got me into looking > > io_uring and starting this thread. > > I agree that MSG_CMSG_COMPAT is nasty, but I think the concept is > sound -- rather than tracking whether we're compat by using a > different function or a per-thread variable, actually explicitly > tracking the mode seems sensible. I very strongly disagree. Two recent projects I did was to remove the compat_exec mess, and the compat get/setsockopt mess, and each time it removed hundreds of lines of code duplicating native functionality, often in slightly broken ways. We need a generic out of band way to transfer the information down and just check in in a few strategic places, and in_compat_syscall() does the right thing for that. > If we're going to play in_compat_syscall() games, let's please make > io_uring_enter() return -EINVAL if in_compat_syscall() != ctx->compat. That sounds like a plan, but still doesn't help with submissions from the offload WQ or the sqpoll thread.