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 0E7ABC43464 for ; Sat, 19 Sep 2020 22:22:11 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 850FF23447 for ; Sat, 19 Sep 2020 22:22:10 +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" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 850FF23447 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=amacapital.net Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id DC2FA6B0055; Sat, 19 Sep 2020 18:22:09 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D71466B005A; Sat, 19 Sep 2020 18:22:09 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B9B766B005D; Sat, 19 Sep 2020 18:22:09 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0133.hostedemail.com [216.40.44.133]) by kanga.kvack.org (Postfix) with ESMTP id 6B75C6B0037 for ; Sat, 19 Sep 2020 18:22:09 -0400 (EDT) Received: from smtpin25.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 25515180AD801 for ; Sat, 19 Sep 2020 22:22:09 +0000 (UTC) X-FDA: 77281235178.25.way42_1a01f2827137 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin25.hostedemail.com (Postfix) with ESMTP id 05A791804E3A0 for ; Sat, 19 Sep 2020 22:22:09 +0000 (UTC) X-HE-Tag: way42_1a01f2827137 X-Filterd-Recvd-Size: 6017 Received: from mail-pj1-f66.google.com (mail-pj1-f66.google.com [209.85.216.66]) by imf27.hostedemail.com (Postfix) with ESMTP for ; Sat, 19 Sep 2020 22:22:08 +0000 (UTC) Received: by mail-pj1-f66.google.com with SMTP id q4so5137038pjh.5 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=jCY6Dn4dizRfxBldrNfeLIS57ncHfVgIhkedSK5L65IBNmvtkKm1lh/Pk6vmCE15IK FFcrjndEWy6xLXmzf2tCOlVJ5BA1xXAj+tvEHpHDhndXAZIj7tDi4+EF1NJDx/xp0899 hhsVQnbQvZ/OFzxBJ1bRBkhpQkSx17SCUjZBCXso9Co4sJt9oCfzdRlbiWQXf3E8uZqD +FTsVgQ85ypP8KQGIzn7av+CzRUI/af6G4RK3v1HxgtYt6j5eWtHmclFYDhTGfmlHFh2 uHo+IaG/+Zq/ZQ0K6rWW5bGs5JFZP7j4ijVPI/DXu5o3lTPgbBWxx7bJCf+dEz0boBfo /2nA== X-Gm-Message-State: AOAM532HrAZT3OCdui8uFuMJ0Gl5kzqV7eeiTJLCVBYYv8s0AiW5eEXl s11nZiORkELYO+m4xsKtLPMviQ== 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) X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: > 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?=