Received: by 2002:a05:6a10:7420:0:0:0:0 with SMTP id hk32csp1183424pxb; Fri, 18 Feb 2022 02:23:10 -0800 (PST) X-Google-Smtp-Source: ABdhPJz+tvipIDodVlr+Xw17Yb2l1er7Odg5p8TYh0yyo/iy9r5OuFGbqYnNYUCOnTgeXYIR3ZxY X-Received: by 2002:a17:903:240a:b0:14e:dad4:5ce4 with SMTP id e10-20020a170903240a00b0014edad45ce4mr6754904plo.125.1645179789776; Fri, 18 Feb 2022 02:23:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645179789; cv=none; d=google.com; s=arc-20160816; b=VO9y8CRBX7ROc4J4DxlB5exWIdSODFpOK9hWswmLPxntj2/eUndmFrMzVjWHa6Cy7B mAYdmIc3uP4ZyQtLnYH5gCAZ5Py0os+SZpzOo0sXBEzZfcMJ65nfhg69xalVnxxOv7yF ITNZWD9YgPses9WWJGq+PPc06pYr9U8Xs2KinqEtP1e1hrZHkNUnhRXNq9Sp2O548hsd fH17T4EeBQBAFmX5OFKTNJGgQ+KnuQFxtW8DMQbw001bFZAtcP8lf29mI1/0bFYxUER5 QAN9xlPVfqTGAk7XaZfbKEyxnOyhXsDFhYa1SFHjHnAbwUIvt0J+67nGJzEsVUl2hX0Y gPFw== 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=ZbcIHIHthrh6mbfVLTCDjtHT9uE1Azlcqan2uNp8omk=; b=YG+uQt1q5kAtzmlsxBBDkO3L/envhVmMHlgIctnNrFCtwrN5n+/nUT4+r7YTuj9b8L Jlt0ncVnEdSK0i94Y3OTvieIBgrv1gYhjHeZZbNUQJy7GvDupleM3XBfxuqkxVXMMQ1s 6NpHB1xLO21U3CUle3t2qitd+8PdVO5RQI9zxQpkL7Sxtg8s3CGEC1H3YzqrA0NaiaVl BSwFm+YmuFdIxHzY5pDhoYPLrLBCz1bml1nr9N0uVAAyl7+wAxTGUAruWXv4rMyDctZH aNCYTxxPgEFPcfOQnWKhqMqu+nLMXPgSucDUoVTvTUFp0vvgY0dsspDcnOJ595YSOjD6 3n2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ZbqIylmo; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e68si10629407pgc.197.2022.02.18.02.22.55; Fri, 18 Feb 2022 02:23:09 -0800 (PST) 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=@kernel.org header.s=k20201202 header.b=ZbqIylmo; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233518AbiBRJZ3 (ORCPT + 99 others); Fri, 18 Feb 2022 04:25:29 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:43222 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232475AbiBRJZ1 (ORCPT ); Fri, 18 Feb 2022 04:25:27 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2214229834; Fri, 18 Feb 2022 01:25:11 -0800 (PST) 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 ams.source.kernel.org (Postfix) with ESMTPS id CF358B825C1; Fri, 18 Feb 2022 09:25:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9CA79C340E9; 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-f44.google.com with SMTP id k41so4834354wms.0; Fri, 18 Feb 2022 01:25:08 -0800 (PST) X-Gm-Message-State: AOAM530YwEfNnFjEX6WbFab6a1DRIvLjalGP3UCG12QG65pIPCrQKPyt CuzXWckKWsR63e2KUWk1j8rHzZ4AdUZL0BOMIp0= 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-Spam-Status: No, score=-7.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 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