diff options
author | Jiri Olsa <[email protected]> | 2019-07-05 14:10:31 +0200 |
---|---|---|
committer | Daniel Borkmann <[email protected]> | 2019-07-05 23:50:38 +0200 |
commit | aa52bcbe0e72fac36b1862db08b9c09c4caefae3 (patch) | |
tree | 294e313612adbc94ce8a4ce936b74ac30a7d22fb /drivers/fpga/fpga-bridge.c | |
parent | ba95c7452439756d4f6dceb5a188b7c31dbbe5b6 (diff) |
tools: bpftool: Fix json dump crash on powerpc
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.
Fixes: 107f041212c1 ("tools: bpftool: add JSON output for `bpftool prog dump jited *` command")
Reported-by: Michael Petlan <[email protected]>
Signed-off-by: Jiri Olsa <[email protected]>
Reviewed-by: Quentin Monnet <[email protected]>
Reviewed-by: Jakub Kicinski <[email protected]>
Signed-off-by: Daniel Borkmann <[email protected]>
Diffstat (limited to 'drivers/fpga/fpga-bridge.c')
0 files changed, 0 insertions, 0 deletions