Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp2161739pxk; Sat, 19 Sep 2020 15:24:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJypNR/FFpBLWZE7pFH0l8zBId6e7wBw+dMJO7W2XFYoGp1fP0xoIVfXPN1Fax6RgG3rQjMK X-Received: by 2002:a17:906:f2cd:: with SMTP id gz13mr43545693ejb.19.1600554251813; Sat, 19 Sep 2020 15:24:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600554251; cv=none; d=google.com; s=arc-20160816; b=sJ4KIdFqiNn946O3vg6bQW8UOLecFD5YdGnS97RZoZv7vFkh8PEsOdw4csInOo0xKD YfmxGQAxv/uQtQzbtLkyEjvd1k6uEkk8HcCi18Z/5M92oLyY2wvxer98vB2/NXW/n4S6 rgrH5wWma9FhUQ/xqXcEAA0faQfgwBa90ZHmkymbrFfhTovv70sra/OnVdNonNzvSw9d 51iJo/JWHPBWi01Te8FPt63v4jh/JVmZJSFqw/gXuvWrXw9IzKrzt5Gy4B6XTvDV5DwP Pp3EnFvroY1ODRdO4NXjQG2enAJEW33OnsWuVf0cXuLALJV406IZ5iO7V1TgI/9M5vOC Mt9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:in-reply-to:cc:references:message-id:date :subject:mime-version:from:content-transfer-encoding:dkim-signature; bh=25gVfK2bGDr534LWfZ/pQ4shMLoyA8XjkGlFCfd9UIQ=; b=QhaR0eFWVs5jj1f67Tpsj1eHk6CXmhZnTAoCcJ/brvxQelRrNmHCYFNDavb6UoPTUP nQN0TlWLGOGXqmCwEZIK59aXT9OcW3gJwAl2DXlQr2b3AlUu+CU5/j4GjkKizbWb/0Gs 6PXZCw5bqqXA1wbtYTvfYdtx1HNDGZrftlLdsiQXzlVINJtWldox0xy5wCRef0IK3kFA twrcKQM+j63dEtN3l41YNLhVGUc2PXKZSSEhxycayeAYLdBafRA2BXGerIHSHRhJySb7 7FrXRi4+0pjb8HQx9A+1myR15BJpjRyaoIHaKGnUVNSmIxzJuoUGzCIVQfQgYJgvhTuG TOIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amacapital-net.20150623.gappssmtp.com header.s=20150623 header.b=EY9RaFhK; 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 p21si5012158edq.151.2020.09.19.15.23.35; Sat, 19 Sep 2020 15:24:11 -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=EY9RaFhK; 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 S1726617AbgISWWK (ORCPT + 99 others); Sat, 19 Sep 2020 18:22:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40462 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726736AbgISWWJ (ORCPT ); Sat, 19 Sep 2020 18:22:09 -0400 Received: from mail-pl1-x643.google.com (mail-pl1-x643.google.com [IPv6:2607:f8b0:4864:20::643]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D5B74C0613CE for ; Sat, 19 Sep 2020 15:22:08 -0700 (PDT) Received: by mail-pl1-x643.google.com with SMTP id bd2so4882765plb.7 for ; Sat, 19 Sep 2020 15:22:08 -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=25gVfK2bGDr534LWfZ/pQ4shMLoyA8XjkGlFCfd9UIQ=; b=EY9RaFhKJvXZJRe9JFZEmj/lrRJqtPj6jNB3uuL8Asw+3z3hL8ojgYDOBxgCTI3nk9 /mXxtqUMYM7Lwl0JgYFAozO/o74Ybc5I1+WhDC3iRbQpOEwdgChJfXvUy9LaiX/RnQRf p/J0xsjYVG4oqNtf24952lDJD0ziSd0wiVT/i0R8ihNenTSwy/mXNvVIx+wshhqobcUy 5EicG48utPjw3drDSP4fcvdYEf263LYbKCqq5wRH96dLaukxQtxTbM+CqP9ZHn/W3xRY 8AFACdo1jBBh0ZpNH8dhEU0zBCFGmtnY/LeHs/0y17jDB1ByiLtkNkIHMFbVGhXPT7kd OVIg== 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=25gVfK2bGDr534LWfZ/pQ4shMLoyA8XjkGlFCfd9UIQ=; b=MPkvEvDVhquapaQd9m+Kxy2+K019iwhDM/pZFF4mfAf0rspG7ZNk/2XHG60QiTdZ8q 4ED+1BGZM7NCC4drbUCeA2+xzGxQAXJStv66Nu8CPqjzV7Am2DGU2O7SHSlXsZtSD/56 NBinEu1U4PaxgEqGx4k0yVZYgPlVdQUktZ/wPkbg0k9+fs4z+uqQn1baqMdiTmWQOIZ5 e7p3GHPq8tT/PGtXvvs/BRJDwLWRjc2knMo5HABI+YQjwaYdESW5qi5LiAvXg2Ogl7BY K5u0pgf7S9maWKOQ50Lfa1jVt65vQv6bu26UiBrfuD5VT86+ZSAr93BdtOkTJVStSuH1 1Saw== X-Gm-Message-State: AOAM533GLhHOPjENV4e855ZtfoTysYAQQkoa/E+WXY+M241K5kZuHspj 57JI2/NNMnRUc7HEOL38zrNOARhT7/K4sg== X-Received: by 2002:a17:902:ac97:b029:d1:f367:b51a with SMTP id h23-20020a170902ac97b02900d1f367b51amr16629268plr.20.1600554127472; Sat, 19 Sep 2020 15:22:07 -0700 (PDT) Received: from localhost.localdomain ([2601:646:c200:1ef2:e9da:b923:b529:3349]) by smtp.gmail.com with ESMTPSA id p4sm6588471pju.29.2020.09.19.15.22.05 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 19 Sep 2020 15:22:06 -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: [PATCH 1/9] kernel: add a PF_FORCE_COMPAT flag Date: Sat, 19 Sep 2020 15:22:04 -0700 Message-Id: References: Cc: Andy Lutomirski , Christoph Hellwig , Al Viro , Andrew Morton , Jens Axboe , David Howells , linux-arm-kernel , X86 ML , LKML , "open list:MIPS" , Parisc List , linuxppc-dev , linux-s390 , sparclinux , linux-block , Linux SCSI List , Linux FS Devel , linux-aio , io-uring@vger.kernel.org, linux-arch , Linux-MM , Network Development , keyrings@vger.kernel.org, LSM List In-Reply-To: To: Arnd Bergmann X-Mailer: iPhone Mail (18A373) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > On Sep 19, 2020, at 2:16 PM, Arnd Bergmann wrote: >=20 > =EF=BB=BFOn Sat, Sep 19, 2020 at 6:21 PM Andy Lutomirski = wrote: >>> On Fri, Sep 18, 2020 at 8:16 AM Christoph Hellwig wrote: >>> 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 > Ah, so reading /dev/input/event* would suffer from the same issue, > and that one would in fact be broken by your patch in the hypothetical > case that someone tried to use io_uring to read /dev/input/event on x32...= >=20 > For reference, I checked the socket timestamp handling that has a > number of corner cases with time32/time64 formats in compat mode, > but none of those appear to be affected by the problem. >=20 >> Aside from the potentially nasty use of per-task variables, one thing >> I don't like about PF_FORCE_COMPAT is that it's one-way. If we're >> going to have a generic mechanism for this, shouldn't we allow a full >> override of the syscall arch instead of just allowing forcing compat >> so that a compat syscall can do a non-compat operation? >=20 > The only reason it's needed here is that the caller is in a kernel > thread rather than a system call. Are there any possible scenarios > where one would actually need the opposite? >=20 I can certainly imagine needing to force x32 mode from a kernel thread. As for the other direction: what exactly are the desired bitness/arch semant= ics of io_uring? Is the operation bitness chosen by the io_uring creation o= r by the io_uring_enter() bitness?=