Re: [PATCH v3 2/2] selftests/seccomp: validate uretprobe syscall passes through seccomp

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Feb 2, 2025 at 12:51 PM Jiri Olsa <olsajiri@xxxxxxxxx> wrote:
>
> On Sun, Feb 02, 2025 at 08:29:21AM -0800, Eyal Birger wrote:
>
> SNIP
>
> > +TEST_F(URETPROBE, uretprobe_default_block)
> > +{
> > +     struct sock_filter filter[] = {
> > +             BPF_STMT(BPF_LD|BPF_W|BPF_ABS,
> > +                     offsetof(struct seccomp_data, nr)),
> > +             BPF_JUMP(BPF_JMP|BPF_JEQ|BPF_K, __NR_exit_group, 1, 0),
> > +             BPF_STMT(BPF_RET|BPF_K, SECCOMP_RET_KILL),
> > +             BPF_STMT(BPF_RET|BPF_K, SECCOMP_RET_ALLOW),
> > +     };
> > +     struct sock_fprog prog = {
> > +             .len = (unsigned short)ARRAY_SIZE(filter),
> > +             .filter = filter,
> > +     };
> > +
> > +     ASSERT_EQ(0, run_probed_with_filter(&prog));
> > +}
> > +
> > +TEST_F(URETPROBE, uretprobe_block_uretprobe_syscall)
> > +{
> > +     struct sock_filter filter[] = {
> > +             BPF_STMT(BPF_LD|BPF_W|BPF_ABS,
> > +                     offsetof(struct seccomp_data, nr)),
> > +#ifdef __NR_uretprobe
> > +             BPF_JUMP(BPF_JMP|BPF_JEQ|BPF_K, __NR_uretprobe, 0, 1),
> > +#endif
>
> does it make sense to run these tests on archs without __NR_uretprobe ?

I considered ifdefing them out, but then thought that given it's not
a lot of code it'd be better for the tests to be compiling and
ready in case support is added on a new platform than to have to
worry about that at that point.

Eyal.





[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux