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=-5.5 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 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 4D0A9C433EA for ; Wed, 22 Jul 2020 06:30:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2894620658 for ; Wed, 22 Jul 2020 06:30:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728696AbgGVGay (ORCPT ); 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: io-uring-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: io-uring@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.