Received: by 2002:a05:7412:3290:b0:fa:6e18:a558 with SMTP id ev16csp564690rdb; Fri, 26 Jan 2024 04:23:08 -0800 (PST) X-Google-Smtp-Source: AGHT+IFZ7p+L8dQYHTOOoZNT6F4/M1/njyTWKMak1vdY0+VLak5acpdTJVKLwPxQc9WdjJ4Pl8px X-Received: by 2002:a17:902:ec90:b0:1d6:fdf4:a97d with SMTP id x16-20020a170902ec9000b001d6fdf4a97dmr1252812plg.50.1706271788255; Fri, 26 Jan 2024 04:23:08 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706271788; cv=pass; d=google.com; s=arc-20160816; b=PZGEW6L/wFpQhX0JfN4plYbTCyprtB46XwjNf/ZdaIs6UMOL8ywRdW5w5hKMfCZjBR RxQJwZFexQYbfyCcckHH09TWI2rLfKiubnwFiozE+VYNlazSSJQwSD8ZuJSezI15tJia nHV8/JxgsOIi9d37TmdZ91bi+VWzPl87eW8BB+zWszjFzJe3VxgE3QieFhJVZDJR/YZ2 ZFa+kv7iSzFgqZyY9A10A18V2Krbopmkvl66I01Y5YPX+3QBux+XJJqur+nLXHQr9l8B 0imKnSYvKuj4kpeV0pE8Oiqx922E8dnL79U99jr5EtvELfblIXNHn2Qn1mUu/pLYDnp4 7f+w== 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=/Og5N2B+KoSvX5uq+a9MWON5nQM5WNfqbyRFYaEfGq8=; fh=G+80uKrcZQu3HF50WBlLamYOf34JlQTSQytwkjSpE8g=; b=AGEKSZGXvPBbrXDNrpUBpKlKHntbK+Y3K56eOLTF0XxnNW7NXsDziA11Flp4bImpnb aH+L5L0ht8xh+9kaKE3c2SYV43FQswNU6OhL/5qPnqsOEMr1Hs5lmf83/BG7mle6fAF1 ixCvMoHaMKNenId+J4wtc0u0cy92snYkd0ZsS3HRJTbBhZC13uenKoadkKsJRXJPEQG8 PJLfAXWppHFnahv+rO0oYSl+onrd9yzmyH3cGAP+GLd0QJe8TWzk5CHj1lA+Gak0OBgm ksinrUuFc+BvnlhigIORjL3wPRnmYb41Xgup4L8Rkjy1O7VmCPdByI93PJwrMe/m/aO3 tVzg== 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-40069-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-40069-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id in2-20020a17090b438200b00290b806397dsi1103316pjb.14.2024.01.26.04.23.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Jan 2024 04:23:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-40069-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=huaweicloud.com); spf=pass (google.com: domain of linux-kernel+bounces-40069-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-40069-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 185DEB2B9AB for ; Fri, 26 Jan 2024 11:54:15 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1889F18040; Fri, 26 Jan 2024 11:54:01 +0000 (UTC) Received: from dggsgout12.his.huawei.com (dggsgout12.his.huawei.com [45.249.212.56]) (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 3969F1B940; Fri, 26 Jan 2024 11:53:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.56 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706270040; cv=none; b=drGrvN/Sj0tCSe9Nt6z5yLDpj7RLBCzNxVzzlcGaeOtLHS0SUIgOmrz//R18a4Ylmi8I65i2fx35YmOuWhd8K6ugWOL892+JEAGHFHuno01/u5mZ0i/l/p5vrjm7wIAkjJrsaszhUYtM4mpdIjc75GXp6yNqwNpiEDw/tUWbR0w= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706270040; c=relaxed/simple; bh=jxL3rAc8dBaPvkTXUpTUhqACsiOaERHAxMiXwKzxfLk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=BNUH6SK+89blyloXH+zroPbrVRCYYTE4+rFtXGHxBX4G5J1VIMnVpz+yDC2q7t3y2t3gkWPNtkdHu7EzHmf8Ojt1mjHsot6tdQW5AsfRl9e+PbN8RvwoSnjonFE+vx3wXgsd3AbEkLNhiFuCSVCdzzq7j99U0Ii00h4+q2TDnKA= 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.56 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 dggsgout12.his.huawei.com (SkyGuard) with ESMTP id 4TLx1C2lQ6z4f3l7b; Fri, 26 Jan 2024 19:53:51 +0800 (CST) Received: from mail02.huawei.com (unknown [10.116.40.112]) by mail.maildlp.com (Postfix) with ESMTP id 5D3FD1A0199; Fri, 26 Jan 2024 19:53:55 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.124.27]) by APP1 (Coremail) with SMTP id cCh0CgBHZQ42nbNllmgoCA--.1892S5; Fri, 26 Jan 2024 19:53:55 +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 v2 1/3] x86/mm: Move is_vsyscall_vaddr() into asm/vsyscall.h Date: Fri, 26 Jan 2024 19:54:21 +0800 Message-Id: <20240126115423.3943360-2-houtao@huaweicloud.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20240126115423.3943360-1-houtao@huaweicloud.com> References: <20240126115423.3943360-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:cCh0CgBHZQ42nbNllmgoCA--.1892S5 X-Coremail-Antispam: 1UD129KBjvJXoW7CF1DWF1xAF4rWry3Jry8Grg_yoW8CFy7pF 9xAas7WFZYg34aka9rXryUZ34rA3Z7Gr40qrW2grWYvF17Z3WYgr1I9a4kWry7Ja97KF4r XF4SvFy8Jr1qy3DanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUB0b4IE77IF4wAFF20E14v26rWj6s0DM7CY07I20VC2zVCF04k2 6cxKx2IYs7xG6rWj6s0DM7CIcVAFz4kK6r1j6r18M28IrcIa0xkI8VA2jI8067AKxVWUGw A2048vs2IY020Ec7CjxVAFwI0_Gr0_Xr1l8cAvFVAK0II2c7xJM28CjxkF64kEwVA0rcxS w2x7M28EF7xvwVC0I7IYx2IY67AKxVW5JVW7JwA2z4x0Y4vE2Ix0cI8IcVCY1x0267AKxV W8Jr0_Cr1UM28EF7xvwVC2z280aVAFwI0_GcCE3s1l84ACjcxK6I8E87Iv6xkF7I0E14v2 6rxl6s0DM2AIxVAIcxkEcVAq07x20xvEncxIr21l5I8CrVACY4xI64kE6c02F40Ex7xfMc Ij6xIIjxv20xvE14v26r1j6r18McIj6I8E87Iv67AKxVWUJVW8JwAm72CE4IkC6x0Yz7v_ Jr0_Gr1lF7xvr2IYc2Ij64vIr41lFIxGxcIEc7CjxVA2Y2ka0xkIwI1l42xK82IYc2Ij64 vIr41l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1lx2IqxVAqx4xG67AKxVWUJVWUGwC20s026x8G jcxK67AKxVWUGVWUWwC2zVAF1VAY17CE14v26r1q6r43MIIYrxkI7VAKI48JMIIF0xvE2I x0cI8IcVAFwI0_Jr0_JF4lIxAIcVC0I7IYx2IY6xkF7I0E14v26r4j6F4UMIIF0xvE42xK 8VAvwI8IcIk0rVWUJVWUCwCI42IY6I8E87Iv67AKxVWUJVW8JwCI42IY6I8E87Iv6xkF7I 0E14v26r4j6r4UJbIYCTnIWIevJa73UjIFyTuYvjxU2mL9UUUUU X-CM-SenderInfo: xkrx3t3r6k3tpzhluzxrxghudrp/ From: Hou Tao Moving is_vsyscall_vaddr() into asm/vsyscall.h to make it available for copy_from_kernel_nofault_allowed() in arch/x86/mm/maccess.c. 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