Skip to content

Commit 02553b9

Browse files
anakryikoborkmann
authored andcommitted
bpf: bpf_probe_read_kernel_str() has to return amount of data read on success
During recent refactorings, bpf_probe_read_kernel_str() started returning 0 on success, instead of amount of data successfully read. This majorly breaks applications relying on bpf_probe_read_kernel_str() and bpf_probe_read_str() and their results. Fix this by returning actual number of bytes read. Fixes: 8d92db5 ("bpf: rework the compat kernel probe handling") Signed-off-by: Andrii Nakryiko <andriin@fb.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Reviewed-by: Christoph Hellwig <hch@lst.de> Acked-by: John Fastabend <john.fastabend@gmail.com> Link: https://lore.kernel.org/bpf/20200616050432.1902042-1-andriin@fb.com
1 parent 6903cda commit 02553b9

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎kernel/trace/bpf_trace.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ bpf_probe_read_kernel_str_common(void *dst, u32 size, const void *unsafe_ptr)
241241
if (unlikely(ret < 0))
242242
goto fail;
243243

244-
return 0;
244+
return ret;
245245
fail:
246246
memset(dst, 0, size);
247247
return ret;

0 commit comments

Comments
 (0)