On Fri, 5 Jul 2019 14:10:31 +0200, Jiri Olsa wrote: > Michael reported crash with by bpf program in json mode on powerpc: > > # bpftool prog -p dump jited id 14 > [{ > "name": "0xd00000000a9aa760", > "insns": [{ > "pc": "0x0", > "operation": "nop", > "operands": [null > ] > },{ > "pc": "0x4", > "operation": "nop", > "operands": [null > ] > },{ > "pc": "0x8", > "operation": "mflr", > Segmentation fault (core dumped) > > The code is assuming char pointers in format, which is not always > true at least for powerpc. Fixing this by dumping the whole string > into buffer based on its format. > > Please note that libopcodes code does not check return values from > fprintf callback, but as per Jakub suggestion returning -1 on allocation > failure so we do the best effort to propagate the error. > > Reported-by: Michael Petlan <mpetlan@xxxxxxxxxx> > Signed-off-by: Jiri Olsa <jolsa@xxxxxxxxxx> Thanks, let me repost all the tags (Quentin, please shout if you're not ok with this :)): Fixes: 107f041212c1 ("tools: bpftool: add JSON output for `bpftool prog dump jited *` command") Reviewed-by: Quentin Monnet <quentin.monnet@xxxxxxxxxxxxx> Reviewed-by: Jakub Kicinski <jakub.kicinski@xxxxxxxxxxxxx>