samples/bpf, selftests/bpf: Use bpf_probe_read_kernel
A handful of samples and selftests fail to build on s390, because
after commit 0ebeea8ca8
("bpf: Restrict bpf_probe_read{, str}()
only to archs where they work") bpf_probe_read is not available
anymore.
Fix by using bpf_probe_read_kernel.
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20200720114806.88823-1-iii@linux.ibm.com
This commit is contained in:

committad av
Alexei Starovoitov

förälder
6bd557275a
incheckning
e4d9c23207
@@ -36,10 +36,10 @@ int dump_netlink(struct bpf_iter__netlink *ctx)
|
||||
if (!nlk->groups) {
|
||||
group = 0;
|
||||
} else {
|
||||
/* FIXME: temporary use bpf_probe_read here, needs
|
||||
/* FIXME: temporary use bpf_probe_read_kernel here, needs
|
||||
* verifier support to do direct access.
|
||||
*/
|
||||
bpf_probe_read(&group, sizeof(group), &nlk->groups[0]);
|
||||
bpf_probe_read_kernel(&group, sizeof(group), &nlk->groups[0]);
|
||||
}
|
||||
BPF_SEQ_PRINTF(seq, "%-10u %08x %-8d %-8d %-5d %-8d ",
|
||||
nlk->portid, (u32)group,
|
||||
@@ -56,7 +56,7 @@ int dump_netlink(struct bpf_iter__netlink *ctx)
|
||||
* with current verifier.
|
||||
*/
|
||||
inode = SOCK_INODE(sk);
|
||||
bpf_probe_read(&ino, sizeof(ino), &inode->i_ino);
|
||||
bpf_probe_read_kernel(&ino, sizeof(ino), &inode->i_ino);
|
||||
}
|
||||
BPF_SEQ_PRINTF(seq, "%-8u %-8lu\n", s->sk_drops.counter, ino);
|
||||
|
||||
|
@@ -57,7 +57,7 @@ static long sock_i_ino(const struct sock *sk)
|
||||
return 0;
|
||||
|
||||
inode = &container_of(sk_socket, struct socket_alloc, socket)->vfs_inode;
|
||||
bpf_probe_read(&ino, sizeof(ino), &inode->i_ino);
|
||||
bpf_probe_read_kernel(&ino, sizeof(ino), &inode->i_ino);
|
||||
return ino;
|
||||
}
|
||||
|
||||
|
@@ -57,7 +57,7 @@ static long sock_i_ino(const struct sock *sk)
|
||||
return 0;
|
||||
|
||||
inode = &container_of(sk_socket, struct socket_alloc, socket)->vfs_inode;
|
||||
bpf_probe_read(&ino, sizeof(ino), &inode->i_ino);
|
||||
bpf_probe_read_kernel(&ino, sizeof(ino), &inode->i_ino);
|
||||
return ino;
|
||||
}
|
||||
|
||||
|
@@ -18,7 +18,7 @@ static long sock_i_ino(const struct sock *sk)
|
||||
return 0;
|
||||
|
||||
inode = &container_of(sk_socket, struct socket_alloc, socket)->vfs_inode;
|
||||
bpf_probe_read(&ino, sizeof(ino), &inode->i_ino);
|
||||
bpf_probe_read_kernel(&ino, sizeof(ino), &inode->i_ino);
|
||||
return ino;
|
||||
}
|
||||
|
||||
|
@@ -25,7 +25,7 @@ static long sock_i_ino(const struct sock *sk)
|
||||
return 0;
|
||||
|
||||
inode = &container_of(sk_socket, struct socket_alloc, socket)->vfs_inode;
|
||||
bpf_probe_read(&ino, sizeof(ino), &inode->i_ino);
|
||||
bpf_probe_read_kernel(&ino, sizeof(ino), &inode->i_ino);
|
||||
return ino;
|
||||
}
|
||||
|
||||
|
Referens i nytt ärende
Block a user