Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp1069335pxm; Wed, 23 Feb 2022 17:18:33 -0800 (PST) X-Google-Smtp-Source: ABdhPJxiDu/1VcRJDJKTmR/gvE1vBI2HVBtq71K5ZxuqggOTEQxraLS1AQZD0E3grN9WjlLgG/D+ X-Received: by 2002:a17:903:24f:b0:14f:73fa:2b30 with SMTP id j15-20020a170903024f00b0014f73fa2b30mr201556plh.174.1645665512746; Wed, 23 Feb 2022 17:18:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645665512; cv=none; d=google.com; s=arc-20160816; b=KtoFGkdtHAep1ZK7NQcfvLBKzoLwY9o+9l+TQH5MEsczzJLRYUVMST/3opi01mgXLk 6MqbrowK3twbH3Y+VOqV3yy06XsYE3lXJaZLr8O/aaTD0cTbWDOz/ViBplpoQUAjQBKz FSw6/GIoElQM3DrpNzQBk89sIMSvEQbCHoAzoZ4yy+CAxq29wOnbjuZlwslj8QIWm3Ul S7gejcVvSlwz8sHlssvCD2hROAZ7oO6aR6ML5JGJJLyL74KJyslvmexn0v55hXw+dEsw OW91yVso45ovnXVJw4ze38Bq+pmI3+hHN0AhrWrf6zyZgSCnaDYA5byYsoQTDPpUxrOX pdnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=+S6BFzj6o5ckty5iXSThNrfkPsdFE94/fVb8NP4+aFs=; b=w91UkylJAFhLzBqP9ZvLSxA4J1p3J6D0R8QK0r2jHC3i9HJdkkEYjJNfnT7NacB5hg Zl0GiYLFkGx/2oTLwzVb70f4PHxgZgR4ycW81qYLWL2X/0ZAMsxpkFlmesechRyknzOZ XRD0hDda2vS1I5JXOlS0rEjgMkHGbXxV5rFTy9j+xUdGtZ4qTutYHKHog4u5oPNRNwDZ 1PBk0tGnmK/iThCH5GWhck26A9YYwpudS40xOcuWqUYBCd8vZwrpE1YkPw2M9BolFvXZ 8d25IuEsgI5GYa7IoI6Cg3n+9NqaYAUbTfyLRbT8s1zXzXtRfo8pMvJrhIqggylVkcuz U0Ew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b="F/2f/aEU"; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id k3si1368649plk.283.2022.02.23.17.18.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Feb 2022 17:18:32 -0800 (PST) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b="F/2f/aEU"; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 363B3170D56; Wed, 23 Feb 2022 17:02:57 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235080AbiBWUGC (ORCPT + 99 others); Wed, 23 Feb 2022 15:06:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37912 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231267AbiBWUF7 (ORCPT ); Wed, 23 Feb 2022 15:05:59 -0500 Received: from mail-lj1-x22a.google.com (mail-lj1-x22a.google.com [IPv6:2a00:1450:4864:20::22a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1A7DC4C40A for ; Wed, 23 Feb 2022 12:05:27 -0800 (PST) Received: by mail-lj1-x22a.google.com with SMTP id t14so26299333ljh.8 for ; Wed, 23 Feb 2022 12:05:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=+S6BFzj6o5ckty5iXSThNrfkPsdFE94/fVb8NP4+aFs=; b=F/2f/aEUKxSuzDdCknAbug+t8clrlE0v7gj9NkhphhHftuFg6XGIjvpJXVx+ZHKhn9 jOIdz4l7lK+/F1JhXkxR/PARyehOhzu1/S93ijWQKe7fGKOKTiRs9R81aIq3OYNVOgnf G4UcKLBEtMgH8cssPIzV42vV3R64/Z0YRVhdY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=+S6BFzj6o5ckty5iXSThNrfkPsdFE94/fVb8NP4+aFs=; b=NiMr5psxsJB3IZ2auamJab5cLGvWYKJZGhL1hQOA92DgzjMP4OTp95cgDYH6OQkENL abHN95mMUroOM6HWpaFZaEpTPJhJ7iCG9VNPzv7/774rKMvMMukDyqmMEv2oEVlAsIJ8 TWPwZ5hlH1hdU+fYqDGzfh+E/W7TEvu45YFiR4DI9yiCs6BTqhtF3MCBMzHoLsv0wuzr L2yz5AP/if4s1p5s2r8ez+Zs13zp+CmwEARNgWH1PLX8h08x5wURQlNhEK63348m+3Pa gVuOoAFQqBOMAwv/YSnkzAsVcKmPgL/7I9J/5hxSC5PO8JPG1kaZ603g0uyIagxs9naw wPEg== X-Gm-Message-State: AOAM533I5fqwWUnq90PXZu0+1KIUNb6aPmMj5ikeNZUJThimjnQmSPvI WIERHD1YJWQ75yhHn+BqGK9TeWNYcQ7VdHks1+w= X-Received: by 2002:a2e:9ad5:0:b0:244:c85f:d546 with SMTP id p21-20020a2e9ad5000000b00244c85fd546mr705558ljj.303.1645646724756; Wed, 23 Feb 2022 12:05:24 -0800 (PST) Received: from mail-lf1-f45.google.com (mail-lf1-f45.google.com. [209.85.167.45]) by smtp.gmail.com with ESMTPSA id a17sm41472lfs.35.2022.02.23.12.05.20 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 23 Feb 2022 12:05:21 -0800 (PST) Received: by mail-lf1-f45.google.com with SMTP id i11so216787lfu.3 for ; Wed, 23 Feb 2022 12:05:20 -0800 (PST) X-Received: by 2002:a05:6512:130b:b0:443:c2eb:399d with SMTP id x11-20020a056512130b00b00443c2eb399dmr822016lfu.27.1645646720244; Wed, 23 Feb 2022 12:05:20 -0800 (PST) MIME-Version: 1.0 References: <20220216131332.1489939-1-arnd@kernel.org> <20220216131332.1489939-10-arnd@kernel.org> <20220221132456.GA7139@alpha.franken.de> In-Reply-To: <20220221132456.GA7139@alpha.franken.de> From: Linus Torvalds Date: Wed, 23 Feb 2022 12:05:04 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2 09/18] mips: use simpler access_ok() To: Thomas Bogendoerfer Cc: Arnd Bergmann , Christoph Hellwig , linux-arch , Linux-MM , Linux API , Arnd Bergmann , Linux Kernel Mailing List , Al Viro , Russell King - ARM Linux , Will Deacon , Guo Ren , Brian Cain , Geert Uytterhoeven , Michal Simek , Nick Hu , Greentime Hu , Dinh Nguyen , Stafford Horne , Helge Deller , Michael Ellerman , Peter Zijlstra , Ingo Molnar , Mark Rutland , Heiko Carstens , Rich Felker , David Miller , Richard Weinberger , "the arch/x86 maintainers" , Max Filippov , "Eric W. Biederman" , Andrew Morton , Ard Biesheuvel , alpha , "open list:SYNOPSYS ARC ARCHITECTURE" , linux-csky@vger.kernel.org, linux-hexagon , linux-ia64@vger.kernel.org, linux-m68k , "open list:BROADCOM NVRAM DRIVER" , Openrisc , linux-parisc , linuxppc-dev , linux-riscv , linux-s390 , Linux-sh list , linux-sparc , linux-um , "open list:TENSILICA XTENSA PORT (xtensa)" Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,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 Mon, Feb 21, 2022 at 5:25 AM Thomas Bogendoerfer wrote: > > With this patch [ .. snip snip ..] > I at least get my simple test cases fixed, but I'm not sure this is > correct. I think you really want to do that anyway, just to get things like wild kernel pointers right (ie think get_kernel_nofault() and friends for ftrace etc). They shouldn't happen in any normal situation, but those kinds of unverified pointers is why we _have_ get_kernel_nofault() in the first place. On x86-64, the roughly equivalent situation is that addresses that aren't in canonical format do not take a #PF (page fault), they take a #GP (general protection) fault. So I think you want to do that fixup_exception() for any possible addresses. > Is there a reason to not also #define TASK_SIZE_MAX __UA_LIMIT like > for the 32bit case ? I would suggest against using a non-constant TASK_SIZE_MAX. Being constant is literally one reason why it exists, when TASK_SIZE itself has often been about other things (ie "32-bit process"). Having to load variables for things like get_user() is annoying, if you could do it with a simple constant instead (where that "simple" part is to avoid having to load big values from a constant pool - often constants like "high bit set" can be loaded and compared against more efficiently). Linus