* [PATCH] selftests/bpf: Add bpf_probe_read_str to bpf_helpers.h
@ 2018-02-28 0:33 Tushar Dave
2018-02-28 16:57 ` Daniel Borkmann
0 siblings, 1 reply; 4+ messages in thread
From: Tushar Dave @ 2018-02-28 0:33 UTC (permalink / raw)
To: ast, daniel, shuah, netdev, linux-selftest, linux-kernel
Using bpf_probe_read_str() from samples/bpf causes compiler warning.
e.g.
warning: implicit declaration of function 'bpf_probe_read_str' is invalid in C99
[-Wimplicit-function-declaration]
num = bpf_probe_read_str(buf, sizeof(buf), ctx->di);
^
1 warning generated.
Add bpf_probe_read_str() to bpf_helpers.h so it can be used by
samples/bpf programs.
Signed-off-by: Tushar Dave <tushar.n.dave@oracle.com>
---
tools/testing/selftests/bpf/bpf_helpers.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/tools/testing/selftests/bpf/bpf_helpers.h b/tools/testing/selftests/bpf/bpf_helpers.h
index dde2c11..65a266d 100644
--- a/tools/testing/selftests/bpf/bpf_helpers.h
+++ b/tools/testing/selftests/bpf/bpf_helpers.h
@@ -65,6 +65,8 @@ static int (*bpf_xdp_adjust_head)(void *ctx, int offset) =
(void *) BPF_FUNC_xdp_adjust_head;
static int (*bpf_xdp_adjust_meta)(void *ctx, int offset) =
(void *) BPF_FUNC_xdp_adjust_meta;
+static int (*bpf_probe_read_str)(void *dst, int size, void *unsafe_ptr) =
+ (void *) BPF_FUNC_probe_read_str;
static int (*bpf_setsockopt)(void *ctx, int level, int optname, void *optval,
int optlen) =
(void *) BPF_FUNC_setsockopt;
--
1.9.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] selftests/bpf: Add bpf_probe_read_str to bpf_helpers.h
2018-02-28 0:33 [PATCH] selftests/bpf: Add bpf_probe_read_str to bpf_helpers.h Tushar Dave
@ 2018-02-28 16:57 ` Daniel Borkmann
2018-02-28 21:28 ` Tushar Dave
0 siblings, 1 reply; 4+ messages in thread
From: Daniel Borkmann @ 2018-02-28 16:57 UTC (permalink / raw)
To: Tushar Dave, ast, shuah, netdev, linux-selftest, linux-kernel
Hi Tushar,
On 02/28/2018 01:33 AM, Tushar Dave wrote:
> Using bpf_probe_read_str() from samples/bpf causes compiler warning.
> e.g.
> warning: implicit declaration of function 'bpf_probe_read_str' is invalid in C99
> [-Wimplicit-function-declaration]
> num = bpf_probe_read_str(buf, sizeof(buf), ctx->di);
> ^
> 1 warning generated.
>
> Add bpf_probe_read_str() to bpf_helpers.h so it can be used by
> samples/bpf programs.
>
> Signed-off-by: Tushar Dave <tushar.n.dave@oracle.com>
In general no objections to it, but it would need an in-tree
user first:
$ git grep -n bpf_probe_read_str tools/
tools/include/uapi/linux/bpf.h:596: * int bpf_probe_read_str(void *dst, int size, const void *unsafe_ptr)
$
Why not adding this along with a sample?
Thanks,
Daniel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] selftests/bpf: Add bpf_probe_read_str to bpf_helpers.h
2018-02-28 16:57 ` Daniel Borkmann
@ 2018-02-28 21:28 ` Tushar Dave
2018-02-28 21:31 ` Daniel Borkmann
0 siblings, 1 reply; 4+ messages in thread
From: Tushar Dave @ 2018-02-28 21:28 UTC (permalink / raw)
To: Daniel Borkmann, ast, shuah, netdev, linux-kselftest, linux-kernel
On 02/28/2018 08:57 AM, Daniel Borkmann wrote:
> Hi Tushar,
>
> On 02/28/2018 01:33 AM, Tushar Dave wrote:
>> Using bpf_probe_read_str() from samples/bpf causes compiler warning.
>> e.g.
>> warning: implicit declaration of function 'bpf_probe_read_str' is invalid in C99
>> [-Wimplicit-function-declaration]
>> num = bpf_probe_read_str(buf, sizeof(buf), ctx->di);
>> ^
>> 1 warning generated.
>>
>> Add bpf_probe_read_str() to bpf_helpers.h so it can be used by
>> samples/bpf programs.
>>
>> Signed-off-by: Tushar Dave <tushar.n.dave@oracle.com>
>
> In general no objections to it, but it would need an in-tree
> user first:
>
> $ git grep -n bpf_probe_read_str tools/
> tools/include/uapi/linux/bpf.h:596: * int bpf_probe_read_str(void *dst, int size, const void *unsafe_ptr)
> $
>
> Why not adding this along with a sample?
Okay, I will send new patch along with new sample or add usage of
bpf_probe_read_str() in one of our exiting sample :)
Thanks.
-Tushar
PS: adding correct mail-list this time linux-kselftest@vger.kernel.org
>
> Thanks,
> Daniel
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] selftests/bpf: Add bpf_probe_read_str to bpf_helpers.h
2018-02-28 21:28 ` Tushar Dave
@ 2018-02-28 21:31 ` Daniel Borkmann
0 siblings, 0 replies; 4+ messages in thread
From: Daniel Borkmann @ 2018-02-28 21:31 UTC (permalink / raw)
To: Tushar Dave, ast, shuah, netdev, linux-kselftest, linux-kernel
On 02/28/2018 10:28 PM, Tushar Dave wrote:
> On 02/28/2018 08:57 AM, Daniel Borkmann wrote:
>> Hi Tushar,
>>
>> On 02/28/2018 01:33 AM, Tushar Dave wrote:
>>> Using bpf_probe_read_str() from samples/bpf causes compiler warning.
>>> e.g.
>>> warning: implicit declaration of function 'bpf_probe_read_str' is invalid in C99
>>> [-Wimplicit-function-declaration]
>>> num = bpf_probe_read_str(buf, sizeof(buf), ctx->di);
>>> ^
>>> 1 warning generated.
>>>
>>> Add bpf_probe_read_str() to bpf_helpers.h so it can be used by
>>> samples/bpf programs.
>>>
>>> Signed-off-by: Tushar Dave <tushar.n.dave@oracle.com>
>>
>> In general no objections to it, but it would need an in-tree
>> user first:
>>
>> $ git grep -n bpf_probe_read_str tools/
>> tools/include/uapi/linux/bpf.h:596: * int bpf_probe_read_str(void *dst, int size, const void *unsafe_ptr)
>> $
>>
>> Why not adding this along with a sample?
> Okay, I will send new patch along with new sample or add usage of
> bpf_probe_read_str() in one of our exiting sample :)
Sounds great, the latter is totally fine as well. :-)
Thanks,
Daniel
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-02-28 21:31 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-28 0:33 [PATCH] selftests/bpf: Add bpf_probe_read_str to bpf_helpers.h Tushar Dave
2018-02-28 16:57 ` Daniel Borkmann
2018-02-28 21:28 ` Tushar Dave
2018-02-28 21:31 ` Daniel Borkmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).