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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0D5EBC433EF for ; Fri, 18 Feb 2022 09:25:13 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9136C6B0074; Fri, 18 Feb 2022 04:25:12 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 8C32C6B0075; Fri, 18 Feb 2022 04:25:12 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 78AF76B0078; Fri, 18 Feb 2022 04:25:12 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0048.hostedemail.com [216.40.44.48]) by kanga.kvack.org (Postfix) with ESMTP id 67B1D6B0074 for ; Fri, 18 Feb 2022 04:25:12 -0500 (EST) Received: from smtpin10.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 253F9181AC9C6 for ; Fri, 18 Feb 2022 09:25:12 +0000 (UTC) X-FDA: 79155366822.10.78695EA Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf23.hostedemail.com (Postfix) with ESMTP id 75530140007 for ; Fri, 18 Feb 2022 09:25:11 +0000 (UTC) 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 8FED361C67 for ; Fri, 18 Feb 2022 09:25:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BB280C340F7 for ; Fri, 18 Feb 2022 09:25:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1645176308; bh=mMLLIykgh57Awf38lSwA8MWwDlZ8x8pcozF3MLrCnRg=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=ZbqIylmo6uIMQW9t/Ad/7tK2u11mWG8WjB4qa2lfLenjhGPPxOrSXmBbl29vFdLsz RLSm/eXkXWAyaPeir93OV55usyXVm2w4yQlbEJGSBjhJPbxxP/WpH5jZFZohcdGJuc 6Zfpxe/6xPCRfwA2642xwgzl3OAOgkS6RUG2lx02px9lCShpTvSBFlhAXh9Xt0WesF y9upM5KMvL2LkL8Lg6Wt2QOBAR4Z85feGVCvbHOzS9xm+0Yr+UJLxIFlCq0FBHO81q m9xWZTMnBTKzYFvFyVALCx1xdi73gd+l2HgxVcagVdTW3ua0wYvd/SpcRFCaI9A6Sk sF8vt4Yo6OTWg== Received: by mail-wm1-f42.google.com with SMTP id o34so4818965wms.1 for ; Fri, 18 Feb 2022 01:25:08 -0800 (PST) X-Gm-Message-State: AOAM532thf0U5LXVruorlU9eta8tEWLejLqjOxaEMeYGpAeMRfKvahoL 2j1BkX5cdm81rsWbm5ps5FLoAn7+eqEL/MYODWs= X-Google-Smtp-Source: ABdhPJwrWpJqc0egLA12RwkumDKsH10yWoelsJ0RehwMogjvxHhR3UEotiD7Fxqib+HetrYJWhy8e0u55+IMdrLJwD4= X-Received: by 2002:a05:600c:1d27:b0:37c:74bb:2b4d with SMTP id l39-20020a05600c1d2700b0037c74bb2b4dmr9729968wms.82.1645176306970; Fri, 18 Feb 2022 01:25:06 -0800 (PST) MIME-Version: 1.0 References: <20220216131332.1489939-1-arnd@kernel.org> <20220216131332.1489939-11-arnd@kernel.org> In-Reply-To: From: Arnd Bergmann Date: Fri, 18 Feb 2022 10:24:50 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2 10/18] m68k: fix access_ok for coldfire To: Geert Uytterhoeven Cc: Linus Torvalds , Christoph Hellwig , Linux-Arch , Linux MM , Linux API , Arnd Bergmann , Linux Kernel Mailing List , Al Viro , Russell King , Will Deacon , Guo Ren , Brian Cain , Michal Simek , Thomas Bogendoerfer , Nick Hu , Greentime Hu , Dinh Nguyen , Stafford Horne , Helge Deller , Michael Ellerman , Peter Zijlstra , Ingo Molnar , Mark Rutland , Heiko Carstens , Rich Felker , "David S. Miller" , Richard Weinberger , "the arch/x86 maintainers" , Max Filippov , "Eric W. Biederman" , Andrew Morton , Ard Biesheuvel , alpha , arcml , linux-csky@vger.kernel.org, "open list:QUALCOMM HEXAGON..." , "linux-ia64@vger.kernel.org" , linux-m68k , "open list:BROADCOM NVRAM DRIVER" , Openrisc , Parisc List , linuxppc-dev , linux-riscv , linux-s390 , Linux-sh list , sparclinux , linux-um , "open list:TENSILICA XTENSA PORT (xtensa)" Content-Type: text/plain; charset="UTF-8" X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 75530140007 X-Stat-Signature: a7dim7zgdzyzi7ioir1bzqympt8aycso Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=ZbqIylmo; spf=pass (imf23.hostedemail.com: domain of arnd@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=arnd@kernel.org; dmarc=pass (policy=none) header.from=kernel.org X-Rspam-User: X-HE-Tag: 1645176311-200873 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 Fri, Feb 18, 2022 at 10:00 AM Geert Uytterhoeven wrote: > > /* We let the MMU do all checking */ > > -static inline int access_ok(const void __user *addr, > > +static inline int access_ok(const void __user *ptr, > > unsigned long size) > > { > > + unsigned long limit = TASK_SIZE; > > + unsigned long addr = (unsigned long)ptr; > > + > > /* > > * XXX: for !CONFIG_CPU_HAS_ADDRESS_SPACES this really needs to check > > * for TASK_SIZE! > > + * Removing this helper is probably sufficient. > > */ > > Shouldn't the above comment block be removed completely, > as this is now implemented below? Yes, obviously. Fixed now. > > - return 1; > > + if (IS_ENABLED(CONFIG_CPU_HAS_ADDRESS_SPACES)) > > + return 1; I just noticed this should have the same change that I made for the generic version, changed it now to + if (IS_ENABLED(CONFIG_CPU_HAS_ADDRESS_SPACES) || + !IS_ENABLED(CONFIG_MMU)) This is gone again after the cleanup patch, when the generic version is used instead. > > + return (size <= limit) && (addr <= (limit - size)); > > } > > Any pesky compilers that warn (or worse with -Werror) about > "condition always true" for TASK_SIZE = 0xFFFFFFFFUL? No, using a local variable avoids this warning. Arnd