Received: by 2002:a89:48b:0:b0:1f5:f2ab:c469 with SMTP id a11csp308286lqd; Wed, 24 Apr 2024 03:03:16 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX6pzuI5iOCm7rX9YPyyXYAul8qitCE13DcDa7O4rrQosnNdfrIG40oaUiu1SbGSplcIWYCIGkNi2Ba2XmKbQh7GG/q40X5W/UOAUGIhw== X-Google-Smtp-Source: AGHT+IEjCzToOlER758p3ywoYx6Jdtrt/TJAEMqD+CP6FOqwCzeDjCBn9vbNJGshjqVnW4tFabKq X-Received: by 2002:a50:d646:0:b0:571:bb79:51aa with SMTP id c6-20020a50d646000000b00571bb7951aamr1764852edj.39.1713952996385; Wed, 24 Apr 2024 03:03:16 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713952996; cv=pass; d=google.com; s=arc-20160816; b=GBCdtVrXVBpbOtJJ/ZdGmGLflQwgEUqu3rbvGqVXVOtZ9yqdAlnuOmr/WlSc8D0LNx 0/JlgpWHHYs08NraNICQJmF+m2Zt0nLqgvZVCXsAh4CrM2OYROGeRf05+il31TyXF5to hxmmC4BajauqLdYeZhZdp/t292QuJJ5gYOvhltifP8jln27c5AGH7Dx5OaHlPdKkSIKu xj4Imydh0cRPFBfIk60n25e41uSXUG7/fAs0BpDIK9ZIhTYbfJWnrXT5VtHorZ95wBi4 aVUM0iNC5qh2pKhlcSD7W9KMiRM7uYfv6rinvTQ/affaLo0iNv53UDKcNjgK1A7qcVd4 snDw== 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:dkim-signature; bh=UVxk5ul29s6zgND/X78C6FlnxyWP0GVGUU7j8eET5QA=; fh=nF/q1ndRMKLJXIYlMXxjZY/kxRe4fy/o5a6Aq8LLL2c=; b=d0iCxRvXqjKUywfoTYe1uql+p72R1+po4fIsR+J6mGFt4Ps/JgC8RXfLBbixtp+7+7 SMfbe1s9AvVBPV12htMUHVMxtdasbOngDFg+EBq6uTkSXS14MWwMl3R2x37e6L0ZcBp7 GzG08ntk/s3dho17xyqsXMVVb3afZEJX+EnWhuNmE7Ut280fjE4iAD4Eqbf2TGmoyVau EyJDpopDQMk1PrbmGkd3G9PV6IozcqR1Q30IBnhy5RB0enorqaitQD76ZlGlQr88QD0R IMYkRRHYTT3Wy+D6apfhg6JKDfOyiw5YNCUm4LFTHzn78J1AkNXxGSfAbw+jFL5ZAGc7 7iHg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Jz2UGCxE; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-156688-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-156688-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id v12-20020a50d58c000000b00572308460ffsi655221edi.238.2024.04.24.03.03.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 03:03:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-156688-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Jz2UGCxE; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-156688-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-156688-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=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 am.mirrors.kernel.org (Postfix) with ESMTPS id 1FF421F249A6 for ; Wed, 24 Apr 2024 10:03:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BD366159906; Wed, 24 Apr 2024 10:02:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Jz2UGCxE" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 E1AA2158DA8; Wed, 24 Apr 2024 10:02:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713952952; cv=none; b=H1HSJKThs+miAVK4U/Ntie58EKCaRoUa8+X02EI/7paIMuwXfiD55X8fuMBswn7YIgfeWBbKPRz1rBQCCwXuCO7rdbvqLLXS0pIM9OePyKfZNqBLyGgdNuMbPKpPDs8ibt/eU/FrZQZi+Q9WovLR8nFnAroh2hJWU3D/ltPnyu0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713952952; c=relaxed/simple; bh=oL7euqQOMkAdTbRR41q3h6SKHz/4uPigwGY12t28/8o=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=vAW3kxAuCuiYi6QisdW0hZ6fvSB1aKOgCtnmim/JDeRO4TH8nnfrsd/7dFaRQoP5eisWBtjsRHM2fMW1pB80JqCQXl3qR9wm5lryn8iDMY4fa8QHdqJU/gEy5FRa6YuW9LMEn7Aahx/AuDV8go6oto9/zc7YS08ju9w71feplEQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Jz2UGCxE; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3488FC32782; Wed, 24 Apr 2024 10:02:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1713952951; bh=oL7euqQOMkAdTbRR41q3h6SKHz/4uPigwGY12t28/8o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Jz2UGCxEeVvwFjD9sH7F4nZA25IdIdfJozpMrCOdMQyyyaAKtscTzZzap/P3ZAaGn oDhz3xoLjjWXzct00MNfAolNmGXQivHydCUJ16dbZYzRLDJqsJ50uPAHEpS5/l/gtX Cc5/MGuYiJTYMtTt+XatRG2oNE2lPLN9AGeF4WiCOrfjF2zQ2pZbBUqvh/KbW6KuXj 7NAsleNwcWdOeFYP6atsb/dzXWjrTFxeSDmWn3f5D5UwtnyCD7oLZET0DKQjFeha7H 8gJzKhJY9pT4vao9Kg6cgdfsv0XKC8APGCkzkZOrwOE9FYU9aqpYSQmM/SKiSoGhxn elebZmWAkjy3g== From: Puranjay Mohan To: Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Eduard Zingerman , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , bpf@vger.kernel.org, linux-kernel@vger.kernel.org, Ilya Leoshkevich Cc: puranjay12@gmail.com Subject: [PATCH bpf v6 3/3] selftests/bpf: Test PROBE_MEM of VSYSCALL_ADDR on x86-64 Date: Wed, 24 Apr 2024 10:02:10 +0000 Message-Id: <20240424100210.11982-4-puranjay@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240424100210.11982-1-puranjay@kernel.org> References: <20240424100210.11982-1-puranjay@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit The vsyscall is a legacy API for fast execution of system calls. It maps a page at address VSYSCALL_ADDR into the userspace program. This address is in the top 10MB of the address space: ffffffffff600000 - ffffffffff600fff | 4 kB | legacy vsyscall ABI The last commit fixes the x86-64 BPF JIT to skip accessing addresses in this memory region. Add this address to bpf_testmod_return_ptr() so we can make sure that it is fixed. After this change and without the previous commit, subprogs_extable selftest will crash the kernel. Signed-off-by: Puranjay Mohan --- tools/testing/selftests/bpf/bpf_testmod/bpf_testmod.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/testing/selftests/bpf/bpf_testmod/bpf_testmod.c b/tools/testing/selftests/bpf/bpf_testmod/bpf_testmod.c index 39ad96a18123..edcd26106557 100644 --- a/tools/testing/selftests/bpf/bpf_testmod/bpf_testmod.c +++ b/tools/testing/selftests/bpf/bpf_testmod/bpf_testmod.c @@ -205,6 +205,9 @@ __weak noinline struct file *bpf_testmod_return_ptr(int arg) case 5: return (void *)~(1ull << 30); /* trigger extable */ case 6: return &f; /* valid addr */ case 7: return (void *)((long)&f | 1); /* kernel tricks */ +#ifdef CONFIG_X86_64 + case 8: return (void *)VSYSCALL_ADDR; /* vsyscall page address */ +#endif default: return NULL; } } -- 2.40.1