Received: by 2002:a05:6a10:7420:0:0:0:0 with SMTP id hk32csp1110619pxb; Fri, 18 Feb 2022 00:33:14 -0800 (PST) X-Google-Smtp-Source: ABdhPJxuA4NJaBq72ATSq5dVD3a8OAR5vAljpf4lq7NpDs0w/jKVFCSAmQCTPyxKq/nbnxILm1es X-Received: by 2002:a17:902:f787:b0:14f:43ba:55fc with SMTP id q7-20020a170902f78700b0014f43ba55fcmr6515633pln.3.1645173194231; Fri, 18 Feb 2022 00:33:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645173194; cv=none; d=google.com; s=arc-20160816; b=xhPdev6QxdIkuDSneZbCxxErOR0XKKEIgTnRKh2P9lD3D3QzWJnvBgM56UpXzVYkcv hOOcmTNHaqOFiy6uX0eqcP5YUiLLb7iGFg/lp87LG/QSvMhxBVgKojfQw6IAmoXKMeRt tv9uMbo0cjZehU++naah4RrMb81vDVXWref4Y1fDtETVXCXBtGvkXQw7O7uDzsmSKY1b 0pQy1AUL/RTGd4Qrjzy7gjr8jr0DzRLOpCSCUmKiwILg3NBCbExUIjbfx6UmnSt3hfMy fe8JS5K/kuhBkxTphiYBHkc/8lLQzhvZeaAc29CskemXlD6KlvpxqblSxIuCys6808UW pb8A== 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=Z9MYgcednSnTxiv2KI83KgQx1hBJ6qj0040KrNGPTTs=; b=iFzLCZGDwn38FDOLCd2gtX7Cm1za+qIL54kGLNPbgyJf+LeYdHTi0Foen04sOD2FNJ 4ArJ/2mFKoi0PGSSWEnZMaYAPWZbRCnANsCljgFzpol8A1ngK6TEInmBx+xWmbrxkzFo QljPVVWe42Fs4Zhpn9Ykh87VsXJEQHLjFX4CSOKml0FV03XhI8iK98tldFPJdTLWq4Xp a+tL8tyDB8VfhB2x9WG0YeITp/JIfpJaD3kFTnNTKWc4p1sj10gH7SLS70Btxg52DV/g kVzJbKIN4x7dzCjJF4z7S/hX7HGCf6YwSjJrQwsyUwQT2ECcjO6e2xiV7C87IiDrRPUx tssg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Dip1NFff; 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 c16si10115510pgw.564.2022.02.18.00.32.59; Fri, 18 Feb 2022 00:33:14 -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=Dip1NFff; 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 S231893AbiBRHQT (ORCPT + 99 others); Fri, 18 Feb 2022 02:16:19 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:39006 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230301AbiBRHQR (ORCPT ); Fri, 18 Feb 2022 02:16:17 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 13EAE30F77; Thu, 17 Feb 2022 23:16:01 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 9F80661EF9; Fri, 18 Feb 2022 07:16:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 09C26C340EF; Fri, 18 Feb 2022 07:16:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1645168560; bh=vgWt8lxnjYZUPlvwCFWcIBvafVy+fWmkyAOoKRaWgHQ=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=Dip1NFffCT7YD3qzSAr1Fin/GwmOB5NYBJTOzrs7U7/Bvm4XqaiPYE0m5TfZQusca MRbcrmTm5/SvvBBwJ6d+gM/F4x3xTDVRaN3NXTeg29thtPCJZj5ucrkgu2KYOhOcca YYG79UlIdYrQmh318MnQPoMOhj/pzpg3ySf0sXzNhV4tmppW8ULCqS+V4JeMQrhHjy P04kRQs0VFG/iaOGrdUQTVs7nOgPxJrBYQnBTVPJQ7UmXqpZWxnZi6pNAeXqxk5wFh MnH6liRJL8MC6e3VLCid/+t09EHzhk77W8JdtjJAyk2DbefTP4jt0D08fEK2pcAo0U 1wdZA3S0EkbnQ== Received: by mail-wr1-f42.google.com with SMTP id i14so12917264wrc.10; Thu, 17 Feb 2022 23:15:59 -0800 (PST) X-Gm-Message-State: AOAM531nY9Ox06r5eRWMCbN4lrTxjl/ZMTy6NvJjCKWGuUsVtvf2QNTi a3VNJRV0/il9NJ27IVbdcWWaKHPixUEPP7gfRyU= X-Received: by 2002:adf:90c1:0:b0:1e4:ad27:22b9 with SMTP id i59-20020adf90c1000000b001e4ad2722b9mr4972052wri.219.1645168558306; Thu, 17 Feb 2022 23:15:58 -0800 (PST) MIME-Version: 1.0 References: <20220216131332.1489939-1-arnd@kernel.org> <20220216131332.1489939-15-arnd@kernel.org> <20220218063549.GJ22576@lst.de> In-Reply-To: <20220218063549.GJ22576@lst.de> From: Arnd Bergmann Date: Fri, 18 Feb 2022 08:15:42 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2 14/18] lib/test_lockup: fix kernel pointer check for separate address spaces To: Christoph Hellwig Cc: Linus Torvalds , 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 , 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 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, "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 7:35 AM Christoph Hellwig wrote: > > On Wed, Feb 16, 2022 at 02:13:28PM +0100, Arnd Bergmann wrote: > > From: Arnd Bergmann > > > > test_kernel_ptr() uses access_ok() to figure out if a given address > > points to user space instead of kernel space. However on architectures > > that set CONFIG_ALTERNATE_USER_ADDRESS_SPACE, a pointer can be valid > > for both, and the check always fails because access_ok() returns true. > > > > Make the check for user space pointers conditional on the type of > > address space layout. > > What is this code even trying to do? It looks extremly broken. As I understand it, this is only meant for debugging, and the module contains intentionally broken lock usage to test whether the watchdog and lockup detection in the kernel is able to find them. I did not try that hard to understand how it works though. Arnd