mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-04 11:24:04 +08:00
tools: bpf_jit_disasm: fix segfault on disabled debugging log output
With recent debugging, I noticed that bpf_jit_disasm segfaults when there's no debugging output from the JIT compiler to the kernel log. Reason is that when regexec(3) doesn't match on anything, start/end offsets are not being filled out and contain some uninitialized garbage from stack. Thus, we need zero out offsets first. Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
b48732e4a4
commit
082739aa45
@ -123,6 +123,8 @@ static int get_last_jit_image(char *haystack, size_t hlen,
|
|||||||
assert(ret == 0);
|
assert(ret == 0);
|
||||||
|
|
||||||
ptr = haystack;
|
ptr = haystack;
|
||||||
|
memset(pmatch, 0, sizeof(pmatch));
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
ret = regexec(®ex, ptr, 1, pmatch, 0);
|
ret = regexec(®ex, ptr, 1, pmatch, 0);
|
||||||
if (ret == 0) {
|
if (ret == 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user