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 lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2708CC433EF for ; Tue, 15 Feb 2022 10:03:21 +0000 (UTC) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4Jyc9M12VYz3cX9 for ; Tue, 15 Feb 2022 21:03:19 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=uvEmspgq; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=kernel.org (client-ip=2604:1380:4641:c500::1; helo=dfw.source.kernel.org; envelope-from=arnd@kernel.org; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=uvEmspgq; dkim-atps=neutral Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4Jyc8c50Dcz2ybK for ; Tue, 15 Feb 2022 21:02:40 +1100 (AEDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4F2B16124B for ; Tue, 15 Feb 2022 10:02:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 233DBC340EB for ; Tue, 15 Feb 2022 10:02:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1644919359; bh=6OaJO5k8UStns9fCBustiYnW4Ue2uRRTBF363T6I8Z8=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=uvEmspgqpxTxsLVTla+f0SMmX15oCQNrms2B9i0V9ia6kENfVsiE5Bzh7iEU5KPnw q9gpvWdnz7Ekg1lzBDLgsrNBP3KQiT85+nX2ztDJVrZIG/Ujb9BpDyYeBvTJqYuFFy UXxanyBNOo8MHsY34ccoxfMGLS2ZnrQfcuAKTi+R29nIBU60+3+8nE+aoXmDCfLSlj gLzEYCibUm4llc2wyWYPuInOJmc4XldnCXU+p9O2WXaNiWoHF4eSAsm49banFdwhfI qZ3iYDoP+YlMRMdIdv1rAxGAF/9VZx8l+SDbw/WEUswwJYP90PuoNP8rnqj493/bDf pKaaRvX+q+uBA== Received: by mail-wm1-f43.google.com with SMTP id l12-20020a7bc34c000000b003467c58cbdfso1079989wmj.2 for ; Tue, 15 Feb 2022 02:02:39 -0800 (PST) X-Gm-Message-State: AOAM531LpXNj2VI6WTq5FlGhwCA4tIM6asoaZ0+nTOMVF5gsRZu64tIs jdJlZYVzi3i+ser+D6b4Rz+n0VpBHmU6m0BVQxU= X-Google-Smtp-Source: ABdhPJxXhF5oN8HK5+/UBfeNSuYxeBNAH3pN7Z2cMEK019oVoVAxn2dH7YUg+eieAXhNWJaJdsC0aGcEXS3C4UXMT34= X-Received: by 2002:a05:600c:2108:b0:34e:870:966e with SMTP id u8-20020a05600c210800b0034e0870966emr2332972wml.173.1644919346591; Tue, 15 Feb 2022 02:02:26 -0800 (PST) MIME-Version: 1.0 References: <20220214163452.1568807-1-arnd@kernel.org> <20220214163452.1568807-10-arnd@kernel.org> <20220215062942.GA12551@lst.de> In-Reply-To: From: Arnd Bergmann Date: Tue, 15 Feb 2022 11:02:10 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 09/14] m68k: drop custom __access_ok() To: Al Viro Content-Type: text/plain; charset="UTF-8" X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , Rich Felker , linux-ia64@vger.kernel.org, Linux-sh list , Peter Zijlstra , "open list:BROADCOM NVRAM DRIVER" , Linux-MM , Guo Ren , sparclinux , "open list:QUALCOMM HEXAGON..." , linux-riscv , Will Deacon , Christoph Hellwig , linux-arch , linux-s390 , Brian Cain , Helge Deller , the arch/x86 maintainers , Russell King - ARM Linux , linux-csky@vger.kernel.org, Ard Biesheuvel , Ingo Molnar , Geert Uytterhoeven , "open list:SYNOPSYS ARC ARCHITECTURE" , "open list:TENSILICA XTENSA PORT \(xtensa\)" , Arnd Bergmann , Heiko Carstens , alpha , linux-um , linuxppc-dev , linux-m68k , Openrisc , Greentime Hu , Stafford Horne , Linux ARM , Michal Simek , Thomas Bogendoerfer , Parisc List , Nick Hu , Max Filippov , Linux API , Linux Kernel Mailing List , Dinh Nguyen , "Eric W . Biederman" , Richard Weinberger , Andrew Morton , Linus Torvalds , David Miller Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" On Tue, Feb 15, 2022 at 8:13 AM Al Viro wrote: > On Tue, Feb 15, 2022 at 07:29:42AM +0100, Christoph Hellwig wrote: > > On Tue, Feb 15, 2022 at 12:37:41AM +0000, Al Viro wrote: > > > Perhaps simply wrap that sucker into #ifdef CONFIG_CPU_HAS_ADDRESS_SPACES > > > (and trim the comment down to "coldfire and 68000 will pick generic > > > variant")? > > > > I wonder if we should invert CONFIG_ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE, > > select the separate address space config for s390, sparc64, non-coldfire > > m68k and mips with EVA and then just have one single access_ok for > > overlapping address space (as added by Arnd) and non-overlapping ones > > (always return true). > > parisc is also such... How about > > select ALTERNATE_SPACE_USERLAND > > for that bunch? Either of those works for me. My current version has this keyed off TASK_SIZE_MAX==ULONG_MAX, but a CONFIG_ symbol does look more descriptive. > While we are at it, how many unusual access_ok() instances are > left after this series? arm64, itanic, um, anything else? x86 adds a WARN_ON_IN_IRQ() check in there. This could be made generic, but it's not obvious what exactly the exceptions are that other architectures need. The arm64 tagged pointers could probably also get integrated into the generic version. > FWIW, sparc32 has a slightly unusual instance (see uaccess_32.h there); it's > obviously cheaper than generic and I wonder if the trick is legitimate (and > applicable elsewhere, perhaps)... Right, a few others have the same, but I wasn't convinced that this is actually safe for call possible cases: it's trivial to construct a caller that works on other architectures but not this one, if you pass a large enough size value and don't access the contents in sequence. Also, like the ((addr | (addr + size)) & MASK) check on some other architectures, it is less portable because it makes assumptions about the actual layout beyond a fixed address limit. Arnd