* [PATCH bpf-next] libbpf: fix ptr to u64 conversion warning on 32-bit platforms
@ 2019-07-09 4:00 Andrii Nakryiko
2019-07-09 4:30 ` Yonghong Song
0 siblings, 1 reply; 4+ messages in thread
From: Andrii Nakryiko @ 2019-07-09 4:00 UTC (permalink / raw)
To: andrii.nakryiko, ast, daniel, bpf, netdev, kernel-team; +Cc: Andrii Nakryiko
On 32-bit platforms compiler complains about conversion:
libbpf.c: In function ‘perf_event_open_probe’:
libbpf.c:4112:17: error: cast from pointer to integer of different
size [-Werror=pointer-to-int-cast]
attr.config1 = (uint64_t)(void *)name; /* kprobe_func or uprobe_path */
^
Reported-by: Matt Hart <matthew.hart@linaro.org>
Fixes: b26500274767 ("libbpf: add kprobe/uprobe attach API")
Tested-by: Matt Hart <matthew.hart@linaro.org>
Signed-off-by: Andrii Nakryiko <andriin@fb.com>
---
tools/lib/bpf/libbpf.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
index ed07789b3e62..794dd5064ae8 100644
--- a/tools/lib/bpf/libbpf.c
+++ b/tools/lib/bpf/libbpf.c
@@ -4126,8 +4126,8 @@ static int perf_event_open_probe(bool uprobe, bool retprobe, const char *name,
}
attr.size = sizeof(attr);
attr.type = type;
- attr.config1 = (uint64_t)(void *)name; /* kprobe_func or uprobe_path */
- attr.config2 = offset; /* kprobe_addr or probe_offset */
+ attr.config1 = ptr_to_u64(name); /* kprobe_func or uprobe_path */
+ attr.config2 = offset; /* kprobe_addr or probe_offset */
/* pid filter is meaningful only for uprobes */
pfd = syscall(__NR_perf_event_open, &attr,
--
2.17.1
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH bpf-next] libbpf: fix ptr to u64 conversion warning on 32-bit platforms
2019-07-09 4:00 [PATCH bpf-next] libbpf: fix ptr to u64 conversion warning on 32-bit platforms Andrii Nakryiko
@ 2019-07-09 4:30 ` Yonghong Song
2019-07-12 12:56 ` Matt Hart
0 siblings, 1 reply; 4+ messages in thread
From: Yonghong Song @ 2019-07-09 4:30 UTC (permalink / raw)
To: Andrii Nakryiko, andrii.nakryiko@gmail.com, Alexei Starovoitov,
daniel@iogearbox.net, bpf@vger.kernel.org, netdev@vger.kernel.org,
Kernel Team
On 7/8/19 9:00 PM, Andrii Nakryiko wrote:
> On 32-bit platforms compiler complains about conversion:
>
> libbpf.c: In function ‘perf_event_open_probe’:
> libbpf.c:4112:17: error: cast from pointer to integer of different
> size [-Werror=pointer-to-int-cast]
> attr.config1 = (uint64_t)(void *)name; /* kprobe_func or uprobe_path */
> ^
>
> Reported-by: Matt Hart <matthew.hart@linaro.org>
> Fixes: b26500274767 ("libbpf: add kprobe/uprobe attach API")
> Tested-by: Matt Hart <matthew.hart@linaro.org>
> Signed-off-by: Andrii Nakryiko <andriin@fb.com>
Acked-by: Yonghong Song <yhs@fb.com>
> ---
> tools/lib/bpf/libbpf.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
> index ed07789b3e62..794dd5064ae8 100644
> --- a/tools/lib/bpf/libbpf.c
> +++ b/tools/lib/bpf/libbpf.c
> @@ -4126,8 +4126,8 @@ static int perf_event_open_probe(bool uprobe, bool retprobe, const char *name,
> }
> attr.size = sizeof(attr);
> attr.type = type;
> - attr.config1 = (uint64_t)(void *)name; /* kprobe_func or uprobe_path */
> - attr.config2 = offset; /* kprobe_addr or probe_offset */
> + attr.config1 = ptr_to_u64(name); /* kprobe_func or uprobe_path */
> + attr.config2 = offset; /* kprobe_addr or probe_offset */
>
> /* pid filter is meaningful only for uprobes */
> pfd = syscall(__NR_perf_event_open, &attr,
>
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH bpf-next] libbpf: fix ptr to u64 conversion warning on 32-bit platforms
2019-07-09 4:30 ` Yonghong Song
@ 2019-07-12 12:56 ` Matt Hart
2019-07-12 13:06 ` Daniel Borkmann
0 siblings, 1 reply; 4+ messages in thread
From: Matt Hart @ 2019-07-12 12:56 UTC (permalink / raw)
To: Yonghong Song
Cc: Andrii Nakryiko, andrii.nakryiko@gmail.com, Alexei Starovoitov,
daniel@iogearbox.net, bpf@vger.kernel.org, netdev@vger.kernel.org,
Kernel Team
On Tue, 9 Jul 2019 at 05:30, Yonghong Song <yhs@fb.com> wrote:
>
>
>
> On 7/8/19 9:00 PM, Andrii Nakryiko wrote:
> > On 32-bit platforms compiler complains about conversion:
> >
> > libbpf.c: In function ‘perf_event_open_probe’:
> > libbpf.c:4112:17: error: cast from pointer to integer of different
> > size [-Werror=pointer-to-int-cast]
> > attr.config1 = (uint64_t)(void *)name; /* kprobe_func or uprobe_path */
> > ^
> >
> > Reported-by: Matt Hart <matthew.hart@linaro.org>
> > Fixes: b26500274767 ("libbpf: add kprobe/uprobe attach API")
> > Tested-by: Matt Hart <matthew.hart@linaro.org>
> > Signed-off-by: Andrii Nakryiko <andriin@fb.com>
>
> Acked-by: Yonghong Song <yhs@fb.com>
>
How do we get this merged? I see the build failure has now propagated
up to mainline :(
> > ---
> > tools/lib/bpf/libbpf.c | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
> > index ed07789b3e62..794dd5064ae8 100644
> > --- a/tools/lib/bpf/libbpf.c
> > +++ b/tools/lib/bpf/libbpf.c
> > @@ -4126,8 +4126,8 @@ static int perf_event_open_probe(bool uprobe, bool retprobe, const char *name,
> > }
> > attr.size = sizeof(attr);
> > attr.type = type;
> > - attr.config1 = (uint64_t)(void *)name; /* kprobe_func or uprobe_path */
> > - attr.config2 = offset; /* kprobe_addr or probe_offset */
> > + attr.config1 = ptr_to_u64(name); /* kprobe_func or uprobe_path */
> > + attr.config2 = offset; /* kprobe_addr or probe_offset */
> >
> > /* pid filter is meaningful only for uprobes */
> > pfd = syscall(__NR_perf_event_open, &attr,
> >
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH bpf-next] libbpf: fix ptr to u64 conversion warning on 32-bit platforms
2019-07-12 12:56 ` Matt Hart
@ 2019-07-12 13:06 ` Daniel Borkmann
0 siblings, 0 replies; 4+ messages in thread
From: Daniel Borkmann @ 2019-07-12 13:06 UTC (permalink / raw)
To: Matt Hart, Yonghong Song
Cc: Andrii Nakryiko, andrii.nakryiko@gmail.com, Alexei Starovoitov,
bpf@vger.kernel.org, netdev@vger.kernel.org, Kernel Team
On 07/12/2019 02:56 PM, Matt Hart wrote:
> On Tue, 9 Jul 2019 at 05:30, Yonghong Song <yhs@fb.com> wrote:
>> On 7/8/19 9:00 PM, Andrii Nakryiko wrote:
>>> On 32-bit platforms compiler complains about conversion:
>>>
>>> libbpf.c: In function ‘perf_event_open_probe’:
>>> libbpf.c:4112:17: error: cast from pointer to integer of different
>>> size [-Werror=pointer-to-int-cast]
>>> attr.config1 = (uint64_t)(void *)name; /* kprobe_func or uprobe_path */
>>> ^
>>>
>>> Reported-by: Matt Hart <matthew.hart@linaro.org>
>>> Fixes: b26500274767 ("libbpf: add kprobe/uprobe attach API")
>>> Tested-by: Matt Hart <matthew.hart@linaro.org>
>>> Signed-off-by: Andrii Nakryiko <andriin@fb.com>
>>
>> Acked-by: Yonghong Song <yhs@fb.com>
>
> How do we get this merged? I see the build failure has now propagated
> up to mainline :(
I just applied the fix to bpf tree, will go its usual route to mainline.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-07-12 13:06 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-07-09 4:00 [PATCH bpf-next] libbpf: fix ptr to u64 conversion warning on 32-bit platforms Andrii Nakryiko
2019-07-09 4:30 ` Yonghong Song
2019-07-12 12:56 ` Matt Hart
2019-07-12 13:06 ` Daniel Borkmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox