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=-3.8 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 87716C433DB for ; Sat, 19 Sep 2020 22:22:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2A0E7222BB for ; Sat, 19 Sep 2020 22:22:09 +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="EY9RaFhK" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726740AbgISWWJ (ORCPT ); Sat, 19 Sep 2020 18:22:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40456 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726660AbgISWWI (ORCPT ); Sat, 19 Sep 2020 18:22:08 -0400 Received: from mail-pl1-x644.google.com (mail-pl1-x644.google.com [IPv6:2607:f8b0:4864:20::644]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 739AFC0613D4 for ; Sat, 19 Sep 2020 15:22:08 -0700 (PDT) Received: by mail-pl1-x644.google.com with SMTP id u9so4890546plk.4 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=rQ6HAoIApvBro3sLAQ2za2aOEkOb1zD44rrnEb8XGh8uqPWV5FVr6SsrJLQ9XGSu0r 7r3CoHC9pZL28BgzhsgCIv0hp3qsKtzYDgoDdxb5o3JH4FOa6zfJngtUTuw7mLRLf/7z BM2nAuSSXj9UJ/uok/tH9xva3C4a9rtc3cJs8eRK1HDZm+WK0VZYhKPXKydAJ5+2LNSR 35wrqY7I30WzT3Am2zpoxd+b8teVmbBKb/52zXKig1xhOzmhxwBf48g/JNYO68GRvu0f NzoWkdNXIxy0CvLL4j56fyRHduHPfDlzTVFhOznl4RBiV9iOtPMhyucD+FQbJuVWmtIb ue0w== X-Gm-Message-State: AOAM532FpyJ8WzwZtKIDS7Qe+CF9C/hz4raB9M3on1q/9XG8I9+pxm6x +N98i9JjdQPf6N83ZMv+QD6zaw== X-Google-Smtp-Source: ABdhPJziI+9RTM4Q+0EM9+8+2xFKIE2ZrEYxvbFrrOPerUdpGlrHlMuO11hqWffBHcUb5BpNHvdsyg== 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: io-uring@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?=