From: Jiri Olsa <jolsa@xxxxxxxxxx> commit 088f294609d8f8816dc316681aef2eb61982e0da upstream. If iov_iter_zero succeeds after failed copy_from_kernel_nofault, we need to reset the ret value to zero otherwise it will be returned as final return value of read_kcore_iter. This fixes objdump -d dump over /proc/kcore for me. Cc: stable@xxxxxxxxxxxxxxx Cc: Alexander Gordeev <agordeev@xxxxxxxxxxxxx> Fixes: 3d5854d75e31 ("fs/proc/kcore.c: allow translation of physical memory addresses") Signed-off-by: Jiri Olsa <jolsa@xxxxxxxxxx> Link: https://lore.kernel.org/r/20241121231118.3212000-1-jolsa@xxxxxxxxxx Acked-by: Alexander Gordeev <agordeev@xxxxxxxxxxxxx> Signed-off-by: Christian Brauner <brauner@xxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- fs/proc/kcore.c | 1 + 1 file changed, 1 insertion(+) --- a/fs/proc/kcore.c +++ b/fs/proc/kcore.c @@ -599,6 +599,7 @@ static ssize_t read_kcore_iter(struct ki ret = -EFAULT; goto out; } + ret = 0; /* * We know the bounce buffer is safe to copy from, so * use _copy_to_iter() directly. Patches currently in stable-queue which might be from jolsa@xxxxxxxxxx are queue-6.6/fs-proc-kcore.c-clear-ret-value-in-read_kcore_iter-after-successful-iov_iter_zero.patch queue-6.6/perf-list-fix-topic-and-pmu_name-argument-order.patch queue-6.6/perf-trace-fix-tracing-itself-creating-feedback-loop.patch queue-6.6/bpf-force-uprobe-bpf-program-to-always-return-0.patch queue-6.6/perf-trace-do-not-lose-last-events-in-a-race.patch queue-6.6/libbpf-fix-expected_attach_type-set-handling-in-prog.patch queue-6.6/perf-trace-avoid-garbage-when-not-printing-a-syscall.patch