Received: by 2002:ab2:1c04:0:b0:1f7:53ba:1ebe with SMTP id f4csp145744lqg; Fri, 26 Apr 2024 11:03:52 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXvLyLKCa81dU3zx7frZ+vTkvOVsKGHj1jP+u7WcGG5rO6I8TP8eXUj9pz+1pC2jBN1hDrIzegCoZgXBzBNZgeqndlb9CgDrycTSNFa/g== X-Google-Smtp-Source: AGHT+IGFGHD5or73lrrSSiveD62OLITF9SR+bDzAfnLOR6C53EuyevuXvJ/jQp7nxo6FKYBFhqVh X-Received: by 2002:a17:90a:69a1:b0:2a7:a774:ba7f with SMTP id s30-20020a17090a69a100b002a7a774ba7fmr3282957pjj.32.1714154632491; Fri, 26 Apr 2024 11:03:52 -0700 (PDT) Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id q24-20020a17090aa01800b002a31ab55f32si15387177pjp.158.2024.04.26.11.03.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Apr 2024 11:03:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-160532-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20230601 header.b=Y9oEdUcP; arc=fail (body hash mismatch); spf=pass (google.com: domain of linux-kernel+bounces-160532-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-160532-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com 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 7DD34284750 for ; Fri, 26 Apr 2024 18:03:50 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CE7D316D9D9; Fri, 26 Apr 2024 18:03:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Y9oEdUcP" Received: from mail-pl1-f170.google.com (mail-pl1-f170.google.com [209.85.214.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AA88016C45B; Fri, 26 Apr 2024 18:03:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.170 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714154624; cv=none; b=d8JdhTKw00GLGtMCH1+vyvv8Mms6E6lpLftsFwAv8QuPc1b3C87Cs3zL1TYLlg+aN+n+T1YniV9WnDBWMCisVOv5HZRT6mC7nL05ADOULBdCXWziXvX8onw0DY59cy9QY9lG594lwmjhrQsZ96hwoe+lxJb1mp0R30Jdim9ve3A= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714154624; c=relaxed/simple; bh=o9C3Y4wKnnAMYR4R4XZ258dS0vNsA42AOcfW24YCujM=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=A2wmsbI0It+GjnH8SOCR2nY/8Z8eF0PkvHq0cZi/+Hho6xmDDoCOPaU4l7LrglB0Z7P48opNlfd/DOO3kN3DGiiO4dxhUVm46iFTRaTt/zTre5fc7mCH8x5DFoCWOENpeCw3g9KQyfI1/zEljLfFxczUxPByQowIPOnnzV3Gaqw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Y9oEdUcP; arc=none smtp.client-ip=209.85.214.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pl1-f170.google.com with SMTP id d9443c01a7336-1eac92f7c74so16277345ad.3; Fri, 26 Apr 2024 11:03:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714154622; x=1714759422; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=+zLMERCAeeJ8zabPFzTQqoiOgb5JxeqVEQwjKBN9mmA=; b=Y9oEdUcP2FqyBOTiYyHOoQphesh8FntxhDTrby3HX8EhCTo0gxPBSM3Ji+X0PWIBx8 5lRmvcN8eWdt88UYoH2CBYmnaVKFs0FbsI9iueE/BWuAnCYzb6fFiwKQg0eNTbtaa94Q 0Sc1CZ07L2Jx8bGohH2IS03GM9mnvssX9PtUaQvr5dYOUmxChnWWR5FXZISCtBDdln17 DDQLugrTiF+HdmtRmatb7vOnwj1A+q3vk96LBFWWxv9t8+JjosS2hffTBvu9FPLJZOSG XtYqu1ow+Uw0PprwHK7aXhj/8s+f7DxYOB5f613rRb6oz+tRGXN1foAnD5sHMdHkdA6i OfUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714154622; x=1714759422; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+zLMERCAeeJ8zabPFzTQqoiOgb5JxeqVEQwjKBN9mmA=; b=Siy3KH8jNzSdrUdV8jnO2HfoG7gLwWCbkC5cvFIdkHQgzU4rxE8bhHPwzLZzbssknO 727s6fzApFFVzOH025yJb7JoYqltM16HhaZNkXs/jgivrJ6szZH7NaDCQvaCuK5vZzxu JKFqmxAiVvr1SMWHueOAZQRJUvCAfjcuaHEwA93JDGV+IpvFckJVpAEqDnkxgS7nrYMN 1iuqoRn7qH7SlSKhceIV7cuiuGcwXyGeZUQ4kx4Vw2U+XGUfKqw1wgnUEhhrDBtW6fu2 Ed1di3JtxzWCD0b43tSCuT3HL0a6mYoSDVW9DY5JOV9HzcuffmZ1KitL/wz24zzjIyOx xPfg== X-Forwarded-Encrypted: i=1; AJvYcCVUqXco2LhI/nH5BY+iojsVSpM0yjrrCwI0DAAeuRcOjA1zpZsH1qkewjxHrKsv3DqTdvgKr3LZ1uqTgljB4QR4eO/vDTK5RBIfYVUWSeTDl9mH5aLycnWKRet7Zd9tQGRW4/WmSUKtfBKXzZzZk54Ezs+8jA/bLWwfJoH7AbSI4S2G/aDuUKIJwID7KoUZvdK6CL/6ILXOHuMyCwcA/R0M X-Gm-Message-State: AOJu0YzK4pbTd1w4Ffvj5NGI98qTBs9QAyODoDxR4oU34pzHxIPCPXjr 62j9xl4itWRpfWyonTo911Q5J3+OKoj8ZAg1caX1rBdaTr5dHT8Xr05An/orLSrwwfN5g6j9M3t U63965CrYgaH3Jm53RZ8JoZn7AOU= X-Received: by 2002:a17:902:c40f:b0:1e9:cf94:5bea with SMTP id k15-20020a170902c40f00b001e9cf945beamr4306261plk.35.1714154621816; Fri, 26 Apr 2024 11:03:41 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240421194206.1010934-1-jolsa@kernel.org> <20240421194206.1010934-6-jolsa@kernel.org> In-Reply-To: <20240421194206.1010934-6-jolsa@kernel.org> From: Andrii Nakryiko Date: Fri, 26 Apr 2024 11:03:29 -0700 Message-ID: Subject: Re: [PATCHv3 bpf-next 5/7] selftests/bpf: Add uretprobe syscall call from user space test To: Jiri Olsa Cc: Steven Rostedt , Masami Hiramatsu , Oleg Nesterov , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-api@vger.kernel.org, x86@kernel.org, bpf@vger.kernel.org, Song Liu , Yonghong Song , John Fastabend , Peter Zijlstra , Thomas Gleixner , "Borislav Petkov (AMD)" , Ingo Molnar , Andy Lutomirski Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Sun, Apr 21, 2024 at 12:43=E2=80=AFPM Jiri Olsa wrote= : > > Adding test to verify that when called from outside of the > trampoline provided by kernel, the uretprobe syscall will cause > calling process to receive SIGILL signal and the attached bpf > program is no executed. > > Signed-off-by: Jiri Olsa > --- > .../selftests/bpf/prog_tests/uprobe_syscall.c | 92 +++++++++++++++++++ > .../selftests/bpf/progs/uprobe_syscall_call.c | 15 +++ > 2 files changed, 107 insertions(+) > create mode 100644 tools/testing/selftests/bpf/progs/uprobe_syscall_call= c > See nits below, but overall LGTM Acked-by: Andrii Nakryiko [...] > @@ -219,6 +301,11 @@ static void test_uretprobe_regs_change(void) > { > test__skip(); > } > + > +static void test_uretprobe_syscall_call(void) > +{ > + test__skip(); > +} > #endif > > void test_uprobe_syscall(void) > @@ -228,3 +315,8 @@ void test_uprobe_syscall(void) > if (test__start_subtest("uretprobe_regs_change")) > test_uretprobe_regs_change(); > } > + > +void serial_test_uprobe_syscall_call(void) does it need to be serial? non-serial are still run sequentially within a process (there is no multi-threading), it's more about some global effects on system. > +{ > + test_uretprobe_syscall_call(); > +} > diff --git a/tools/testing/selftests/bpf/progs/uprobe_syscall_call.c b/to= ols/testing/selftests/bpf/progs/uprobe_syscall_call.c > new file mode 100644 > index 000000000000..5ea03bb47198 > --- /dev/null > +++ b/tools/testing/selftests/bpf/progs/uprobe_syscall_call.c > @@ -0,0 +1,15 @@ > +// SPDX-License-Identifier: GPL-2.0 > +#include "vmlinux.h" > +#include > +#include > + > +struct pt_regs regs; > + > +char _license[] SEC("license") =3D "GPL"; > + > +SEC("uretprobe//proc/self/exe:uretprobe_syscall_call") > +int uretprobe(struct pt_regs *regs) > +{ > + bpf_printk("uretprobe called"); debugging leftover? we probably don't want to pollute trace_pipe from test > + return 0; > +} > -- > 2.44.0 >