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=-4.0 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,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 5D121C433E2 for ; Mon, 20 Jul 2020 16:58:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 380E32176B for ; Mon, 20 Jul 2020 16:58:49 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=amacapital-net.20150623.gappssmtp.com header.i=@amacapital-net.20150623.gappssmtp.com header.b="sc9jlE/K" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389078AbgGTQ6r (ORCPT ); Mon, 20 Jul 2020 12:58:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51164 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389038AbgGTQ6n (ORCPT ); Mon, 20 Jul 2020 12:58:43 -0400 Received: from mail-pg1-x534.google.com (mail-pg1-x534.google.com [IPv6:2607:f8b0:4864:20::534]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 696BBC0619D4 for ; Mon, 20 Jul 2020 09:58:43 -0700 (PDT) Received: by mail-pg1-x534.google.com with SMTP id s189so10537688pgc.13 for ; Mon, 20 Jul 2020 09:58:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amacapital-net.20150623.gappssmtp.com; s=20150623; h=content-transfer-encoding:from:mime-version:subject:date:message-id :references:cc:in-reply-to:to; bh=43I7clNDsReFiDnQ/eG8o/xxDWM5jfx4yXluLFGgUPg=; b=sc9jlE/K1DrDneIJnR6n5x32DQheHojWvPTx4A7npjm875HZtsCBR0i9U4673qY+A8 3WHkGIO7hvQpDhn8xnJXg6rIYv4iccpNk98bO9LmT8plqMZeN1NMCtxnPXHfu4kQM6lh VWdL6N7aXyJ28oOxAHpfRyI2VDi+9eBLPLiFmqckrwIohpK4ofXbR+gAJ5sLhz3Tk46E uBfxUgHScO/Gwq07Mku6yJKFfkGiRiDSfFqRTkku9ZHj3rzhUd+OKtX1daAWLdF7b0YB RgViOZKZuBEi0A8SR46Q3J+6zgQj/bsKZ9U1WaODjM2qrqOUw83UZuc7Y0Fd4b1bGoCz m9DA== 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:from:mime-version :subject:date:message-id:references:cc:in-reply-to:to; bh=43I7clNDsReFiDnQ/eG8o/xxDWM5jfx4yXluLFGgUPg=; b=VgSal/fJK4E2zQP1WLi0Hx3sCgOyrk4W8pZr3VjIDYawr+EeuBkspQY3yZUUMTzwiB BzanisVjxYY28SMcryGpGdko9ZPvBgc+VJiFn4A/Cu8QKxf+cavtLy9b8H+Y8nwhgCF1 NKO+FUOkFG5xqFsuXYuHaAog/tfnqSK3DiySIS29coUiBf0/UX/6cflllR2FOq10nxBN RxWdp2BC9RgbhQ8usIHRChp0dKW+b9tLzj2BpiT4xJC/tNUN0ugc/JFi/QeU5URq6OG3 e7l7+jRNKsHHmmTyvPxbnouGd56pbozTiYVzixIVhHWY4vKnuBIfAm/FZo+n6Lyclpqi ZJyw== X-Gm-Message-State: AOAM531LBAyBbgj9KqZKxmtgCPuoQMXDWUSsFeVPCxtRtVkIzaKJgDDn 1LM1oAGnMvWF4EznZJ7nxDGp6A== X-Google-Smtp-Source: ABdhPJwqbJwpMW1IhTYxfzLesmIFawwVTSzbWgxylzmrSdVa8Tk5mPHoVns2ROD6CM8Hjhjhno57fQ== X-Received: by 2002:a62:1c13:: with SMTP id c19mr19584029pfc.52.1595264322829; Mon, 20 Jul 2020 09:58:42 -0700 (PDT) Received: from ?IPv6:2601:646:c200:1ef2:600f:2f5b:3d86:4df5? ([2601:646:c200:1ef2:600f:2f5b:3d86:4df5]) by smtp.gmail.com with ESMTPSA id mg17sm95384pjb.55.2020.07.20.09.58.41 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 20 Jul 2020 09:58:42 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: Andy Lutomirski Mime-Version: 1.0 (1.0) Subject: Re: io_uring vs in_compat_syscall() Date: Mon, 20 Jul 2020 09:58:37 -0700 Message-Id: References: Cc: Christoph Hellwig , linux-arch@vger.kernel.org, linux-api@vger.kernel.org, linux-kernel@vger.kernel.org, io-uring@vger.kernel.org In-Reply-To: To: Jens Axboe X-Mailer: iPhone Mail (17F80) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > On Jul 20, 2020, at 9:37 AM, Jens Axboe wrote: >=20 > =EF=BB=BFOn 7/20/20 12:10 AM, Christoph Hellwig wrote: >> Hi Jens, >>=20 >> I just found a (so far theoretical) issue with the io_uring submission >> offloading to workqueues or threads. We have lots of places using >> in_compat_syscall() to check if a syscall needs compat treatmenet. >> While the biggest users is iocttl(), we also have a fair amount of >> places using in_compat_task() in read and write methods, and these >> will not do the wrong thing when used with io_uring under certain >> conditions. I'm not sure how to best fix this, except for making sure >> in_compat_syscall() returns true one way or another for these cases. >=20 > We can probably propagate this information in the io_kiocb via a flag, > and have the io-wq worker set TS_COMPAT if that's the case. >=20 Is TS_COMPAT actually a cross-arch concept for which this is safe? Having a= real arch helper for =E2=80=9Cset the current syscall arch for the current k= ernel thread=E2=80=9D seems more sensible to me.=20=