Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp7351658rwr; Tue, 2 May 2023 13:21:24 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5gCD9C8RCluvUVUWZR+fkprLet2TFa4BAMY2B7Hgcm54DK3ZEs8UR8rxBZAR8bDo2t6LMA X-Received: by 2002:a05:6a20:1610:b0:f5:ff1c:f6a8 with SMTP id l16-20020a056a20161000b000f5ff1cf6a8mr23304103pzj.20.1683058883587; Tue, 02 May 2023 13:21:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683058883; cv=none; d=google.com; s=arc-20160816; b=TuNufdSuulmGRNCefCHr/MQgNV8g++QsSR5RiOhzPOIPSF5MZ67mEfPouCQhTKn35Y 9O1m+aouGqbZISN/UEDtVsBig2x5WWN1k9Be1B+Y01TLvCEIByuT9oHXiJ6llj23BKHW 5WG/prVOnv3tPzB6n6d8KAYVU0vW8zkaRqdsOl9Yuxe2YtMcRdWuD85dfGwHLmF2X2JS mdYPF922PDlOMcLdaNmni/gbwp+lIzUB77fMAQAgtPzaCWJMqkkq8LXpVXLOUNDJ3VsE inmLM8+ekyQDcGX1aNCNK5rvY03WCHJVtT/bxzUwpXXHMorxzijDGJrjQVQ5hFpGhn6N 4lCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=DUwpf5dCSAsRqOsNYrifOv842ZnhqrfcdkR7socPbWA=; b=wo4EWxxLhVfHB0H7/ZcYsbP4KWXQAR98seJ7UsPDbuBCg6fs5K8WzBZsqyIUXLKJXO +KVY5V3clzrtXX09yoL2+etdnZKpozGFckI2DZSebzbR7Ct69sOxve75elYNzyAho9yH jw0bS+qDI/wRDhIJghIbwFxd9shJcHPqrYO54b+kr7xfEWFmczZ5b0WWkQnjffCnO+Pz fjLRllu1ci9mD6UE+EBltnbzJkf7FDUE9i2SKnOhMtsdkeWg3TqaJd1HiLMKAMxpreCo 1IJUbfS/5MKwAKO+ItA3deGjcUOLRsBX+B1Ndt3IojPUQyvOK1DLwq04kB41gyXL08T0 mIIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=Hhe0NwqM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t191-20020a6381c8000000b005192d51325dsi16069260pgd.42.2023.05.02.13.21.09; Tue, 02 May 2023 13:21:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=Hhe0NwqM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229498AbjEBUO4 (ORCPT + 99 others); Tue, 2 May 2023 16:14:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47436 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229951AbjEBUOy (ORCPT ); Tue, 2 May 2023 16:14:54 -0400 Received: from mail-ej1-x635.google.com (mail-ej1-x635.google.com [IPv6:2a00:1450:4864:20::635]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1E2BF1997 for ; Tue, 2 May 2023 13:14:53 -0700 (PDT) Received: by mail-ej1-x635.google.com with SMTP id a640c23a62f3a-94eee951c70so701281566b.3 for ; Tue, 02 May 2023 13:14:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; t=1683058491; x=1685650491; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=DUwpf5dCSAsRqOsNYrifOv842ZnhqrfcdkR7socPbWA=; b=Hhe0NwqMlh+m2MPo5JrIJLXpRSdllSZiwYe+dvWmjqghMVmfGrhIA2WS0dqfKslG7L VaMwydsZZFeqtc/RDU/rB+t8bI1UFiMXPVgjlZtFbXbjeb9FZRwPhUEFtmx3ba4Qayhw yt+hvMLrZ+b4NC6Yrd6JQ5GFHdvcQFkmjQ1JY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683058491; x=1685650491; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=DUwpf5dCSAsRqOsNYrifOv842ZnhqrfcdkR7socPbWA=; b=R0s1MTvyGEJJamPSNf/ooNSoxb9xNJG4uuv/kBJa8LIlatrjH0Zf6tTiIRpWHHWPGe ams1GSaDqtKTP2eyxXnbMEVUAPly2djRCuCyr3Dqb9iQe7GQRYuWikCCN0rBPTWJR84/ wn7+j5Nsv4atjQg7QLwCmOfaeOdUnPCsvg/so5vSfcDiQQ0AxgFmDyqnoo6gAZmS3JtN y0JsNPm57YHthPiIK0Nk1uvaG6qSxwqD8eOvbDiuTQKcV07UlZBsinyFw6tzccHc77pf fpJwcrkpb1nNVg39ujzJy3DtBAqCQ1us8U3L/rhbUtRpK96Rk4Y3i/V8PkzcRBwcvu0A jtRg== X-Gm-Message-State: AC+VfDxuT/OWk5OU0V4vhXC5J1X5J68DXa8te0NiVx0Ubv5bhSX46Gec rxFGK3/k5nUuQx0TWloGR0MX++S1DZ5q0f+aLwO9oQ== X-Received: by 2002:a17:907:268c:b0:953:82d7:1c5a with SMTP id bn12-20020a170907268c00b0095382d71c5amr1033300ejc.11.1683058490945; Tue, 02 May 2023 13:14:50 -0700 (PDT) Received: from mail-ej1-f45.google.com (mail-ej1-f45.google.com. [209.85.218.45]) by smtp.gmail.com with ESMTPSA id u13-20020a170906c40d00b0094aa087578csm16711074ejz.171.2023.05.02.13.14.50 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 02 May 2023 13:14:50 -0700 (PDT) Received: by mail-ej1-f45.google.com with SMTP id a640c23a62f3a-95369921f8eso703161966b.0 for ; Tue, 02 May 2023 13:14:50 -0700 (PDT) X-Received: by 2002:a17:907:1c09:b0:94a:9ae2:1642 with SMTP id nc9-20020a1709071c0900b0094a9ae21642mr1083857ejc.46.1683058489892; Tue, 02 May 2023 13:14:49 -0700 (PDT) MIME-Version: 1.0 References: <20230427225647.1101172-1-dave.hansen@linux.intel.com> <20230429003822.n3mglslg666j3npp@box.shutemov.name> <641a9348-a052-6bb5-e6c7-64acb6405328@intel.com> In-Reply-To: From: Linus Torvalds Date: Tue, 2 May 2023 13:14:33 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [GIT PULL] x86/mm for 6.4 To: Dave Hansen Cc: "Kirill A. Shutemov" , Dave Hansen , x86@kernel.org, linux-kernel@vger.kernel.org, kirill.shutemov@linux.intel.com, Peter Zijlstra Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 2, 2023 at 9:00=E2=80=AFAM Linus Torvalds wrote: > > > I guess it also wouldn't matter as much either if we hid it in a helper > > like the attached patch and I didn't have to read it twice. ;) > > Yeah, I think that's a good solution. Hmm. And as I was rebasing the patch to fix up my patch, I realized that the current -git top-of-tree state is actually broken. That #define access_ok(addr, size) \ ({ \ WARN_ON_IN_IRQ(); \ likely(__access_ok(untagged_addr(addr), size)); \ }) is actually *wrong* in two ways. Now, in my original patch, I added a comment about how that "WARN_ON_IN_IRQ()" is bogus and this shouldn't be x86-specific at all. I ended up going back in time to see why it was added, and I think it was added because we used to access 'current' in access_ok(), due to it using that user_addr_max() thing: likely(!__range_not_ok(addr, size, user_addr_max())); but that was all removed by the set_fs() removal by Christoph Hellwig. So there is actually nothing task-related in "access_ok()" any more, and any warning about using it in the wrong context is just bogus. That warning simply shouldn't exist any more (or maybe it should be in a different place, like the actual user copy functions) But that's actually not the problem with the above. No, the problem is that probably *because* "access_ok()" has that warning, not all users use "access_ok()" at all. We have places that use "__access_ok()" instead. Like copy_from_nmi(). So now copy_from_nmi() doesn't do the untagging, so if you were to use tagged pointers for the stack, you'd not get stack traces. End result: I think that (a) that WARN_ON_IN_IRQ() is actively detrimental and causes problems (b) the current "use untagged_addr() in access_ok()" model is also broken and my patch - which was meant to just improve code generation - actually fixes this. Linus