Re: [PATCH v13 bpf-next 5/6] selftests/bpf: Add tests for filesystem kfuncs

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

 



On Thu, Nov 23, 2023 at 3:40 PM Song Liu <song@xxxxxxxxxx> wrote:
>
> +static const char expected_value[] = "hello";
> +char value[32];
> +
> +SEC("lsm.s/file_open")
> +int BPF_PROG(test_file_open, struct file *f)
> +{
> +       struct bpf_dynptr value_ptr;
> +       __u32 pid;
> +       int ret;
> +
> +       pid = bpf_get_current_pid_tgid() >> 32;
> +       if (pid != monitored_pid)
> +               return 0;
> +
> +       bpf_dynptr_from_mem(value, sizeof(value), 0, &value_ptr);
> +
> +       ret = bpf_get_file_xattr(f, "user.kfuncs", &value_ptr);
> +       if (ret != sizeof(expected_value))
> +               return 0;
> +       if (bpf_strncmp(value, ret, expected_value))

Hmm. It doesn't work like:
if (bpf_strncmp(value, ret, "hello"))

?





[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux