* [PATCH v4 1/3] samples/bpf: Ignore already processed ELF sections
2017-02-08 20:27 [PATCH v4 0/3] Miscellaneous fixes for BPF (perf tree) Mickaël Salaün
@ 2017-02-08 20:27 ` Mickaël Salaün
2017-02-08 20:27 ` [PATCH v4 2/3] samples/bpf: Reset global variables Mickaël Salaün
` (3 subsequent siblings)
4 siblings, 0 replies; 8+ messages in thread
From: Mickaël Salaün @ 2017-02-08 20:27 UTC (permalink / raw)
To: linux-kernel
Cc: Mickaël Salaün, Alexei Starovoitov,
Arnaldo Carvalho de Melo, Daniel Borkmann, David S . Miller,
Joe Stringer, Wang Nan, netdev
Add a missing check for the map fixup loop.
Signed-off-by: Mickaël Salaün <mic@digikod.net>
Cc: Alexei Starovoitov <ast@fb.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Daniel Borkmann <daniel@iogearbox.net>
---
samples/bpf/bpf_load.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/samples/bpf/bpf_load.c b/samples/bpf/bpf_load.c
index 396e204888b3..e04fe09d7c2e 100644
--- a/samples/bpf/bpf_load.c
+++ b/samples/bpf/bpf_load.c
@@ -328,6 +328,8 @@ int load_bpf_file(char *path)
/* load programs that need map fixup (relocations) */
for (i = 1; i < ehdr.e_shnum; i++) {
+ if (processed_sec[i])
+ continue;
if (get_sec(elf, i, &ehdr, &shname, &shdr, &data))
continue;
--
2.11.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH v4 2/3] samples/bpf: Reset global variables
2017-02-08 20:27 [PATCH v4 0/3] Miscellaneous fixes for BPF (perf tree) Mickaël Salaün
2017-02-08 20:27 ` [PATCH v4 1/3] samples/bpf: Ignore already processed ELF sections Mickaël Salaün
@ 2017-02-08 20:27 ` Mickaël Salaün
2017-02-08 20:27 ` [PATCH v4 3/3] samples/bpf: Add missing header Mickaël Salaün
` (2 subsequent siblings)
4 siblings, 0 replies; 8+ messages in thread
From: Mickaël Salaün @ 2017-02-08 20:27 UTC (permalink / raw)
To: linux-kernel
Cc: Mickaël Salaün, Alexei Starovoitov,
Arnaldo Carvalho de Melo, Daniel Borkmann, David S . Miller,
Joe Stringer, Wang Nan, netdev
Before loading a new ELF, clean previous kernel version, license and
processed sections.
Signed-off-by: Mickaël Salaün <mic@digikod.net>
Cc: Alexei Starovoitov <ast@fb.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Cc: David S. Miller <davem@davemloft.net>
---
samples/bpf/bpf_load.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/samples/bpf/bpf_load.c b/samples/bpf/bpf_load.c
index e04fe09d7c2e..b86ee54da2d1 100644
--- a/samples/bpf/bpf_load.c
+++ b/samples/bpf/bpf_load.c
@@ -277,6 +277,11 @@ int load_bpf_file(char *path)
Elf_Data *data, *data_prog, *symbols = NULL;
char *shname, *shname_prog;
+ /* reset global variables */
+ kern_version = 0;
+ memset(license, 0, sizeof(license));
+ memset(processed_sec, 0, sizeof(processed_sec));
+
if (elf_version(EV_CURRENT) == EV_NONE)
return 1;
--
2.11.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH v4 3/3] samples/bpf: Add missing header
2017-02-08 20:27 [PATCH v4 0/3] Miscellaneous fixes for BPF (perf tree) Mickaël Salaün
2017-02-08 20:27 ` [PATCH v4 1/3] samples/bpf: Ignore already processed ELF sections Mickaël Salaün
2017-02-08 20:27 ` [PATCH v4 2/3] samples/bpf: Reset global variables Mickaël Salaün
@ 2017-02-08 20:27 ` Mickaël Salaün
2017-02-10 17:42 ` [PATCH v4 0/3] Miscellaneous fixes for BPF (perf tree) Arnaldo Carvalho de Melo
2017-02-13 1:42 ` Wangnan (F)
4 siblings, 0 replies; 8+ messages in thread
From: Mickaël Salaün @ 2017-02-08 20:27 UTC (permalink / raw)
To: linux-kernel
Cc: Mickaël Salaün, Alexei Starovoitov,
Arnaldo Carvalho de Melo, Daniel Borkmann, David S . Miller,
Joe Stringer, Wang Nan, netdev
Include unistd.h to define __NR_getuid and __NR_getsid.
Signed-off-by: Mickaël Salaün <mic@digikod.net>
Cc: Alexei Starovoitov <ast@fb.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Cc: David S. Miller <davem@davemloft.net>
---
samples/bpf/tracex5_kern.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/samples/bpf/tracex5_kern.c b/samples/bpf/tracex5_kern.c
index fd12d7154d42..7e4cf74553ff 100644
--- a/samples/bpf/tracex5_kern.c
+++ b/samples/bpf/tracex5_kern.c
@@ -8,6 +8,7 @@
#include <linux/version.h>
#include <uapi/linux/bpf.h>
#include <uapi/linux/seccomp.h>
+#include <uapi/linux/unistd.h>
#include "bpf_helpers.h"
#define PROG(F) SEC("kprobe/"__stringify(F)) int bpf_func_##F
--
2.11.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH v4 0/3] Miscellaneous fixes for BPF (perf tree)
2017-02-08 20:27 [PATCH v4 0/3] Miscellaneous fixes for BPF (perf tree) Mickaël Salaün
` (2 preceding siblings ...)
2017-02-08 20:27 ` [PATCH v4 3/3] samples/bpf: Add missing header Mickaël Salaün
@ 2017-02-10 17:42 ` Arnaldo Carvalho de Melo
2017-02-10 21:28 ` Joe Stringer
2017-02-13 1:42 ` Wangnan (F)
4 siblings, 1 reply; 8+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-02-10 17:42 UTC (permalink / raw)
To: Wang Nan
Cc: Mickaël Salaün, linux-kernel, Alexei Starovoitov,
Daniel Borkmann, David S . Miller, Joe Stringer, netdev
Em Wed, Feb 08, 2017 at 09:27:41PM +0100, Mickaël Salaün escreveu:
> This series brings some fixes and small improvements to the BPF samples.
>
> This is intended for the perf tree and apply on 7a5980f9c006 ("tools lib bpf:
> Add missing header to the library").
Wang, are you ok with this series? Joe?
- Arnaldo
> Changes since v3:
> * remove applied patch 1/5
> * remove patch 2/5 on bpf_load_program() as requested by Wang Nan
>
> Changes since v2:
> * add this cover letter
>
> Changes since v1:
> * exclude patches not intended for the perf tree
>
> Regards,
>
> Mickaël Salaün (3):
> samples/bpf: Ignore already processed ELF sections
> samples/bpf: Reset global variables
> samples/bpf: Add missing header
>
> samples/bpf/bpf_load.c | 7 +++++++
> samples/bpf/tracex5_kern.c | 1 +
> 2 files changed, 8 insertions(+)
>
> --
> 2.11.0
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v4 0/3] Miscellaneous fixes for BPF (perf tree)
2017-02-10 17:42 ` [PATCH v4 0/3] Miscellaneous fixes for BPF (perf tree) Arnaldo Carvalho de Melo
@ 2017-02-10 21:28 ` Joe Stringer
0 siblings, 0 replies; 8+ messages in thread
From: Joe Stringer @ 2017-02-10 21:28 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: Wang Nan, Mickaël Salaün, LKML, Alexei Starovoitov,
Daniel Borkmann, David S . Miller, netdev
On 10 February 2017 at 09:42, Arnaldo Carvalho de Melo <acme@redhat.com> wrote:
> Em Wed, Feb 08, 2017 at 09:27:41PM +0100, Mickaël Salaün escreveu:
>> This series brings some fixes and small improvements to the BPF samples.
>>
>> This is intended for the perf tree and apply on 7a5980f9c006 ("tools lib bpf:
>> Add missing header to the library").
>
> Wang, are you ok with this series? Joe?
The changes look good to me. I also tried tracex5 and it seems to work fine.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v4 0/3] Miscellaneous fixes for BPF (perf tree)
2017-02-08 20:27 [PATCH v4 0/3] Miscellaneous fixes for BPF (perf tree) Mickaël Salaün
` (3 preceding siblings ...)
2017-02-10 17:42 ` [PATCH v4 0/3] Miscellaneous fixes for BPF (perf tree) Arnaldo Carvalho de Melo
@ 2017-02-13 1:42 ` Wangnan (F)
2017-02-13 20:27 ` Arnaldo Carvalho de Melo
4 siblings, 1 reply; 8+ messages in thread
From: Wangnan (F) @ 2017-02-13 1:42 UTC (permalink / raw)
To: Mickaël Salaün, linux-kernel
Cc: Alexei Starovoitov, Arnaldo Carvalho de Melo, Daniel Borkmann,
David S . Miller, Joe Stringer, netdev
On 2017/2/9 4:27, Mickaël Salaün wrote:
> This series brings some fixes and small improvements to the BPF samples.
>
> This is intended for the perf tree and apply on 7a5980f9c006 ("tools lib bpf:
> Add missing header to the library").
>
> Changes since v3:
> * remove applied patch 1/5
> * remove patch 2/5 on bpf_load_program() as requested by Wang Nan
>
> Changes since v2:
> * add this cover letter
>
> Changes since v1:
> * exclude patches not intended for the perf tree
>
> Regards,
>
> Mickaël Salaün (3):
> samples/bpf: Ignore already processed ELF sections
> samples/bpf: Reset global variables
> samples/bpf: Add missing header
>
> samples/bpf/bpf_load.c | 7 +++++++
> samples/bpf/tracex5_kern.c | 1 +
> 2 files changed, 8 insertions(+)
>
Looks good to me.
Thank you.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v4 0/3] Miscellaneous fixes for BPF (perf tree)
2017-02-13 1:42 ` Wangnan (F)
@ 2017-02-13 20:27 ` Arnaldo Carvalho de Melo
0 siblings, 0 replies; 8+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-02-13 20:27 UTC (permalink / raw)
To: Wangnan (F)
Cc: Mickaël Salaün, linux-kernel, Alexei Starovoitov,
Daniel Borkmann, David S . Miller, Joe Stringer, netdev
Em Mon, Feb 13, 2017 at 09:42:31AM +0800, Wangnan (F) escreveu:
> On 2017/2/9 4:27, Mickaël Salaün wrote:
> >Mickaël Salaün (3):
> > samples/bpf: Ignore already processed ELF sections
> > samples/bpf: Reset global variables
> > samples/bpf: Add missing header
> >
> > samples/bpf/bpf_load.c | 7 +++++++
> > samples/bpf/tracex5_kern.c | 1 +
> > 2 files changed, 8 insertions(+)
> >
> Looks good to me.
>
> Thank you.
Thanks, applied, added Acked-by tags for you and Joe.
- Arnaldo
^ permalink raw reply [flat|nested] 8+ messages in thread