diff mbox series

selftests/bpf: Fix compilation error in get_uprobe_offset()

Message ID 20241218175724.578884-1-jmarchan@redhat.com
State New
Headers show
Series selftests/bpf: Fix compilation error in get_uprobe_offset() | expand

Commit Message

Jerome Marchand Dec. 18, 2024, 5:57 p.m. UTC
In get_uprobe_offset(), the call to procmap_query() use the constant
PROCMAP_QUERY_VMA_EXECUTABLE, even if PROCMAP_QUERY is not defined.

Define PROCMAP_QUERY_VMA_EXECUTABLE when PROCMAP_QUERY isn't.

Fixes: 4e9e07603ecd ("selftests/bpf: make use of PROCMAP_QUERY ioctl if available")
Signed-off-by: Jerome Marchand <jmarchan@redhat.com>
---
 tools/testing/selftests/bpf/trace_helpers.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Yonghong Song Dec. 19, 2024, 1:28 a.m. UTC | #1
On 12/18/24 9:57 AM, Jerome Marchand wrote:
> In get_uprobe_offset(), the call to procmap_query() use the constant
> PROCMAP_QUERY_VMA_EXECUTABLE, even if PROCMAP_QUERY is not defined.
>
> Define PROCMAP_QUERY_VMA_EXECUTABLE when PROCMAP_QUERY isn't.
>
> Fixes: 4e9e07603ecd ("selftests/bpf: make use of PROCMAP_QUERY ioctl if available")
> Signed-off-by: Jerome Marchand <jmarchan@redhat.com>

Acked-by: Yonghong Song <yonghong.song@linux.dev>
Daniel Borkmann Dec. 19, 2024, 12:27 p.m. UTC | #2
On 12/19/24 2:28 AM, Yonghong Song wrote:
> On 12/18/24 9:57 AM, Jerome Marchand wrote:
>> In get_uprobe_offset(), the call to procmap_query() use the constant
>> PROCMAP_QUERY_VMA_EXECUTABLE, even if PROCMAP_QUERY is not defined.
>>
>> Define PROCMAP_QUERY_VMA_EXECUTABLE when PROCMAP_QUERY isn't.
>>
>> Fixes: 4e9e07603ecd ("selftests/bpf: make use of PROCMAP_QUERY ioctl if available")
>> Signed-off-by: Jerome Marchand <jmarchan@redhat.com>
> 
> Acked-by: Yonghong Song <yonghong.song@linux.dev>

lgtm, I've wrapped this in an ifndef while applying.
diff mbox series

Patch

diff --git a/tools/testing/selftests/bpf/trace_helpers.c b/tools/testing/selftests/bpf/trace_helpers.c
index 2d742fdac6b9..51fa29e0e083 100644
--- a/tools/testing/selftests/bpf/trace_helpers.c
+++ b/tools/testing/selftests/bpf/trace_helpers.c
@@ -293,6 +293,9 @@  static int procmap_query(int fd, const void *addr, __u32 query_flags, size_t *st
 	return 0;
 }
 #else
+
+#define PROCMAP_QUERY_VMA_EXECUTABLE 0x04
+
 static int procmap_query(int fd, const void *addr, __u32 query_flags, size_t *start, size_t *offset, int *flags)
 {
 	return -EOPNOTSUPP;