Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp742494rdb; Fri, 2 Feb 2024 02:39:13 -0800 (PST) X-Google-Smtp-Source: AGHT+IG2i6ygXx5cVDFa0VoS8Oa8qenloP4vZV8gHthPuPcDFcwwu7HmLHFfj+P3F1OoXM19JbCH X-Received: by 2002:a17:902:ec82:b0:1d8:a782:6cc9 with SMTP id x2-20020a170902ec8200b001d8a7826cc9mr9406626plg.16.1706870353190; Fri, 02 Feb 2024 02:39:13 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706870353; cv=pass; d=google.com; s=arc-20160816; b=Mf2quAaODk40tCD9trcKixPsSLzXF1W/OlaK0y+m5yHqEeYWt8wwewVWYowfYHDjmn UgbJbWK3oy40p9lVwMV8zwJbDYG1Z71WWjKxv6reF27M90drMLDAfQ6VAEmSsEvnByon y4yfiHKtx8Ja7GK9AwODsHOsjPS4sxP6rbnFtcj+Sddlh6GSHUN07faer9+An6APuNDg cuuWXk5EQxxuvmrXNufD5TTCfnYLdho85iPYJlZO69KYFOvClfN7XoynD6slvmcEt3JJ JXnKHm52phZjp7k8uty+dmHBbZv3lGOUzKoBHrwoAOCALi1jIsndRRomqSM9LCZYLl48 ar2Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=8g+Inh+k+y3S5+oImGrlVQ/LdrnQuJkeaGlEInSzAd0=; fh=5coymoSKrHBY75C/Pt42BLqe1a3kV0NDZkUAENQ4fjA=; b=ZYmK0ROneJfRAqZKgF6tQBZToYJBOC2pQc0+pGFolkQdKEdb4JSxcIhJdh3BiNJc18 93q86cmsmymtaMEIESV8/A7aXuYGR4bE+57kSFmjwD5edJbYX3uAgzVT6grMgHsF9c36 Lp0Rd1BXFiBDc/arOE1lj4L/50VcZzwRa/qMa6BB/WO0/DJFabkB3kUYRJTbCl6D0Sew dEUIC9XxczXvPHkjEAeEd1ypsPrkiYqpGVA8Ie6gktjXNaqC69zDyFmUQc3DPJqocH8n pGIESHgCIAA3ISxbWTONzq3Gx0pdGoPRmJMiNr0Yyjti4YoTm6Rpowl3pbUUI96kbfol 0rgg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=huaweicloud.com); spf=pass (google.com: domain of linux-kernel+bounces-49683-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-49683-linux.lists.archive=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=1; AJvYcCV/GpSgNa69PBYG0s8TfmCrlynDqPL520xg2gH6VbE8M/Cpfbordcs5DDJq2JKzp5XzVuEXpoZeHBR4HRUAneY5qRR7tFeBYbgKdatCVw== Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id p2-20020a170902e34200b001d8a6c3aa7bsi1432277plc.316.2024.02.02.02.39.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Feb 2024 02:39:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-49683-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=huaweicloud.com); spf=pass (google.com: domain of linux-kernel+bounces-49683-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-49683-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id D2B6629086A for ; Fri, 2 Feb 2024 10:39:12 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4C6BB13D51D; Fri, 2 Feb 2024 10:38:51 +0000 (UTC) Received: from dggsgout11.his.huawei.com (dggsgout11.his.huawei.com [45.249.212.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8825183CDF; Fri, 2 Feb 2024 10:38:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.51 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706870330; cv=none; b=o5iiXTtApUl1hPIVN9+D41WT24BqcpWNpYSoE/mvHFxXoeXbaf14KY5K4oAaNGMQBsYv8GLhKzmdMdT/FbSR29gZKHIwnW8dzG9IUaJ8G2t3p02Zl6tcKTv/hJ0EWGuAxtTVmdAQoQCxqPHT8/9PJ35+03bqCStXhT+0VTAhAX8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706870330; c=relaxed/simple; bh=20m1Y/wCslG96LNpA7pTV6a7oWvp2QJOcY87YCTge+Y=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=IRzPtzBrDeq+dR/OhQQTmjoiRrYEJ6EIUtIW5lTC2GoXfJxU4OUoa/7c2Wz8TCRd1jb9SSrIf7hq+zh6O4r52AESKBbHGiIV9gycBG0HUiKzELFS7xV3i31WAu4nqzmTnjS4/qmglozq2oLNYDXHaXMywAHI5SVx0RhaTbxZQH8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com; spf=pass smtp.mailfrom=huaweicloud.com; arc=none smtp.client-ip=45.249.212.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huaweicloud.com Received: from mail.maildlp.com (unknown [172.19.163.216]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4TRC1F5895z4f3jqK; Fri, 2 Feb 2024 18:38:41 +0800 (CST) Received: from mail02.huawei.com (unknown [10.116.40.112]) by mail.maildlp.com (Postfix) with ESMTP id 58D0F1A017A; Fri, 2 Feb 2024 18:38:44 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.124.27]) by APP1 (Coremail) with SMTP id cCh0CgAn+REwxrxl46r1Cg--.15879S5; Fri, 02 Feb 2024 18:38:44 +0800 (CST) From: Hou Tao To: x86@kernel.org, bpf@vger.kernel.org Cc: Dave Hansen , Andy Lutomirski , Peter Zijlstra , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H . Peter Anvin" , linux-kernel@vger.kernel.org, xingwei lee , Jann Horn , Sohil Mehta , Yonghong Song , houtao1@huawei.com Subject: [PATCH bpf v3 1/3] x86/mm: Move is_vsyscall_vaddr() into asm/vsyscall.h Date: Fri, 2 Feb 2024 18:39:33 +0800 Message-Id: <20240202103935.3154011-2-houtao@huaweicloud.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20240202103935.3154011-1-houtao@huaweicloud.com> References: <20240202103935.3154011-1-houtao@huaweicloud.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID:cCh0CgAn+REwxrxl46r1Cg--.15879S5 X-Coremail-Antispam: 1UD129KBjvJXoW7CF13Xr47Wr15uw1xuw47CFg_yoW8Zr1fpF 9xA3Z7WFWFg34aka9rXryUZ34fA3Z7Gr40qrW2grWYvF17Z34Ygr1I93WkGry7Ja97KFWr XF4Svry8Jr1qy3DanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUBjb4IE77IF4wAFF20E14v26rWj6s0DM7CY07I20VC2zVCF04k2 6cxKx2IYs7xG6rWj6s0DM7CIcVAFz4kK6r1j6r18M28IrcIa0xkI8VA2jI8067AKxVWUGw A2048vs2IY020Ec7CjxVAFwI0_Gr0_Xr1l8cAvFVAK0II2c7xJM28CjxkF64kEwVA0rcxS w2x7M28EF7xvwVC0I7IYx2IY67AKxVW7JVWDJwA2z4x0Y4vE2Ix0cI8IcVCY1x0267AKxV WxJVW8Jr1l84ACjcxK6I8E87Iv67AKxVW0oVCq3wA2z4x0Y4vEx4A2jsIEc7CjxVAFwI0_ GcCE3s1le2I262IYc4CY6c8Ij28IcVAaY2xG8wAqx4xG64xvF2IEw4CE5I8CrVC2j2WlYx 0E2Ix0cI8IcVAFwI0_Jr0_Jr4lYx0Ex4A2jsIE14v26r1j6r4UMcvjeVCFs4IE7xkEbVWU JVW8JwACjcxG0xvY0x0EwIxGrwACI402YVCY1x02628vn2kIc2xKxwCF04k20xvY0x0EwI xGrwCFx2IqxVCFs4IE7xkEbVWUJVW8JwC20s026c02F40E14v26r1j6r18MI8I3I0E7480 Y4vE14v26r106r1rMI8E67AF67kF1VAFwI0_Jw0_GFylIxkGc2Ij64vIr41lIxAIcVC0I7 IYx2IY67AKxVWUJVWUCwCI42IY6xIIjxv20xvEc7CjxVAFwI0_Gr0_Cr1lIxAIcVCF04k2 6cxKx2IYs7xG6r1j6r1xMIIF0xvEx4A2jsIE14v26r1j6r4UMIIF0xvEx4A2jsIEc7CjxV AFwI0_Gr0_Gr1UYxBIdaVFxhVjvjDU0xZFpf9x07jn9N3UUUUU= X-CM-SenderInfo: xkrx3t3r6k3tpzhluzxrxghudrp/ From: Hou Tao Move is_vsyscall_vaddr() into asm/vsyscall.h to make it available for copy_from_kernel_nofault_allowed() in arch/x86/mm/maccess.c. Reviewed-by: Sohil Mehta Signed-off-by: Hou Tao --- arch/x86/include/asm/vsyscall.h | 10 ++++++++++ arch/x86/mm/fault.c | 9 --------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/arch/x86/include/asm/vsyscall.h b/arch/x86/include/asm/vsyscall.h index ab60a71a8dcb9..472f0263dbc61 100644 --- a/arch/x86/include/asm/vsyscall.h +++ b/arch/x86/include/asm/vsyscall.h @@ -4,6 +4,7 @@ #include #include +#include #ifdef CONFIG_X86_VSYSCALL_EMULATION extern void map_vsyscall(void); @@ -24,4 +25,13 @@ static inline bool emulate_vsyscall(unsigned long error_code, } #endif +/* + * The (legacy) vsyscall page is the long page in the kernel portion + * of the address space that has user-accessible permissions. + */ +static inline bool is_vsyscall_vaddr(unsigned long vaddr) +{ + return unlikely((vaddr & PAGE_MASK) == VSYSCALL_ADDR); +} + #endif /* _ASM_X86_VSYSCALL_H */ diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c index 679b09cfe241c..d6375b3c633bc 100644 --- a/arch/x86/mm/fault.c +++ b/arch/x86/mm/fault.c @@ -798,15 +798,6 @@ show_signal_msg(struct pt_regs *regs, unsigned long error_code, show_opcodes(regs, loglvl); } -/* - * The (legacy) vsyscall page is the long page in the kernel portion - * of the address space that has user-accessible permissions. - */ -static bool is_vsyscall_vaddr(unsigned long vaddr) -{ - return unlikely((vaddr & PAGE_MASK) == VSYSCALL_ADDR); -} - static void __bad_area_nosemaphore(struct pt_regs *regs, unsigned long error_code, unsigned long address, u32 pkey, int si_code) -- 2.29.2