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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2D264C433EF for ; Wed, 23 Feb 2022 20:13:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234144AbiBWUOP (ORCPT ); Wed, 23 Feb 2022 15:14:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43984 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239928AbiBWUOO (ORCPT ); Wed, 23 Feb 2022 15:14:14 -0500 Received: from mail-lf1-x136.google.com (mail-lf1-x136.google.com [IPv6:2a00:1450:4864:20::136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6BF9D4CD58 for ; Wed, 23 Feb 2022 12:13:46 -0800 (PST) Received: by mail-lf1-x136.google.com with SMTP id b11so176225lfb.12 for ; Wed, 23 Feb 2022 12:13:46 -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=24qY2vDQyFKVY/lExj65ZO0ce9wHXVYV3t7w9uTeB+Cy5HXSUAHOW99oqS7U8ExV/h W6cvXPkwKMjeEoW9ij/emgky68Cx7bzYq1BLMv6eIqzFZ9+EwTiYsfgQ291cO9cj+jFc tG/zt9aWqgBKoYOaoPi2Ao7RvSa/xkMKaJNOeHKj8Izg1smvUGGzEvPSGsW0JiYB8DYO Y53wpOTFYQdwDm+LNGTzmAKLusIKZ5dAUPNEiqbKJDEgWnOE6ttcoc5HRtLQf+LrRBtp Yg+fssUJ8Wa6GtliSSo7C9y2LUk5ElseQwye/0T8SBiBY4++i9JZ3rL6kuMWp4vMMZDK pOqw== X-Gm-Message-State: AOAM530bNA6CMrWX/45pJxM2Nt5jcvmvtpJFE2pfQ3wRfwZ7DDgMmry6 DJ7UHcJE/S5JJSvrIVEvIyCvlr9Renub27BBRQc= X-Google-Smtp-Source: ABdhPJxtY9KSRpE6oS6CEKz76op0+ZfTKU4/CG8T0Ir8M5k+DThKGl+N/4H+3TSHHyP/PxJOtmumKg== X-Received: by 2002:a19:e049:0:b0:42f:b0e2:10c4 with SMTP id g9-20020a19e049000000b0042fb0e210c4mr834772lfj.170.1645647224187; Wed, 23 Feb 2022 12:13:44 -0800 (PST) Received: from mail-lf1-f42.google.com (mail-lf1-f42.google.com. [209.85.167.42]) by smtp.gmail.com with ESMTPSA id c8sm42172lfr.119.2022.02.23.12.13.43 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 23 Feb 2022 12:13:43 -0800 (PST) Received: by mail-lf1-f42.google.com with SMTP id d23so168693lfv.13 for ; Wed, 23 Feb 2022 12:13:43 -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" Precedence: bulk List-ID: X-Mailing-List: linux-mips@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