Miscellaneous fixes for BPF (perf tree)
Subsystems (3)
v4 cover Miscellaneous fixes for BPF (perf tree)
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(+)
Signature · 1 line
2.11.0
PATCH v4 1/3 samples/bpf: Ignore already processed ELF sections
Add a missing check for the map fixup loop.
--- samples/bpf/bpf_load.c | 2 ++ 1 file changed, 2 insertions(+)
samples/bpf/bpf_load.c +2 -0
@@ -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 ;
Signature · 1 line
2.11.0
PATCH v4 2/3 samples/bpf: Reset global variables
In reply to Mickaël SalaünBefore loading a new ELF, clean previous kernel version, license and processed sections.
--- samples/bpf/bpf_load.c | 5 +++++ 1 file changed, 5 insertions(+)
samples/bpf/bpf_load.c +5 -0
@@ -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 ;
Signature · 1 line
2.11.0
PATCH v4 3/3 samples/bpf: Add missing header
In reply to Mickaël SalaünInclude unistd.h to define __NR_getuid and __NR_getsid.
--- samples/bpf/tracex5_kern.c | 1 + 1 file changed, 1 insertion(+)
samples/bpf/tracex5_kern.c +1 -0
@@ -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
Signature · 1 line
2.11.0
Em Wed, Feb 08, 2017 at 09:27:41PM +0100, Mickaël Salaün escreveu:
Quoted 4 lines
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
Quoted 23 lines
Changes since v3:
* remove applied patch 1/5
* remove patch 2/5 onbpf_load_program()as requested by Wang NanChanges since v2:
* add this cover letterChanges since v1:
* exclude patches not intended for the perf treeRegards,
Mickaël Salaün (3):
samples/bpf: Ignore already processed ELF sectionssamples/bpf: Reset global variablessamples/bpf: Add missing headersamples/bpf/bpf_load.c | 7 +++++++ samples/bpf/tracex5_kern.c | 1 + 2 files changed, 8 insertions(+)Signature · 1 line
2.11.0
Quoted 7 lines · Arnaldo Carvalho de Melo
Em Wed, Feb 08, 2017 at 09:27:41PM +0100, Mickaël Salaün escreveu:
Quoted 4 lines
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.
Quoted 17 lines · Mickaël Salaün
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 onbpf_load_program()as requested by Wang NanChanges since v2:
* add this cover letterChanges since v1:
* exclude patches not intended for the perf treeRegards,
Quoted 9 lines
Mickaël Salaün (3):
samples/bpf: Ignore already processed ELF sectionssamples/bpf: Reset global variablessamples/bpf: Add missing headersamples/bpf/bpf_load.c | 7 +++++++ samples/bpf/tracex5_kern.c | 1 + 2 files changed, 8 insertions(+)
Looks good to me.
Thank you.
Arnaldo Carvalho de Melo
AppliedEm Mon, Feb 13, 2017 at 09:42:31AM +0800, Wangnan (F) escreveu:
Quoted 6 lines · Mickaël Salaün
Quoted 5 lines
Mickaël Salaün (3):
samples/bpf: Ignore already processed ELF sectionssamples/bpf: Reset global variablessamples/bpf: Add missing header
Quoted 7 lines
Quoted 4 lines
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