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 25C09C433FE for ; Fri, 18 Feb 2022 07:16:04 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9F0236B0075; Fri, 18 Feb 2022 02:16:03 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 9A0136B0078; Fri, 18 Feb 2022 02:16:03 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 840736B007B; Fri, 18 Feb 2022 02:16:03 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0237.hostedemail.com [216.40.44.237]) by kanga.kvack.org (Postfix) with ESMTP id 7696E6B0075 for ; Fri, 18 Feb 2022 02:16:03 -0500 (EST) Received: from smtpin08.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 6E76F180AC343 for ; Fri, 18 Feb 2022 07:16:02 +0000 (UTC) X-FDA: 79155041364.08.5EE2165 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf31.hostedemail.com (Postfix) with ESMTP id F3C4D20003 for ; Fri, 18 Feb 2022 07:16:01 +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 3063161EFA for ; Fri, 18 Feb 2022 07:16:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 142ECC340F6 for ; 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-f53.google.com with SMTP id x5so8096617wrg.13 for ; Thu, 17 Feb 2022 23:15:59 -0800 (PST) X-Gm-Message-State: AOAM533cqJ9IvKQ4LO0Zl6r2tnJrR2Md+5ixnMTrbLBtb9Wyx3OgFR67 ANwRPfVdWP+NnxCcHEpPdT8xbtp09o4BoRmRFf4= X-Google-Smtp-Source: ABdhPJyN/H83BSKKeXJGtgECPVgYv1w4NoilhoSCj+92CRqaoOjPXRtnkFYRBhAzB91QtgFwdj4YRtpnThbImHSlPPw= 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-Rspam-User: X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: F3C4D20003 X-Stat-Signature: wh48muqxdk6imrxnq5ixpby6i6akk1cu Authentication-Results: imf31.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=Dip1NFff; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf31.hostedemail.com: domain of arnd@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=arnd@kernel.org X-HE-Tag: 1645168561-71321 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 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