* [PATCH] fs/proc/kcore.c: Clear ret value in read_kcore_iter after successful iov_iter_zero
@ 2024-11-21 23:11 Jiri Olsa
2024-11-22 8:40 ` Alexander Gordeev
2024-11-22 11:09 ` Christian Brauner
0 siblings, 2 replies; 3+ messages in thread
From: Jiri Olsa @ 2024-11-21 23:11 UTC (permalink / raw)
To: Andrew Morton, Christian Brauner
Cc: stable, Alexander Gordeev, linux-kernel, Heiko Carstens,
linux-fsdevel
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@vger.kernel.org
Cc: Alexander Gordeev <agordeev@linux.ibm.com>
Fixes: 3d5854d75e31 ("fs/proc/kcore.c: allow translation of physical memory addresses")
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
fs/proc/kcore.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/fs/proc/kcore.c b/fs/proc/kcore.c
index 51446c59388f..c82c408e573e 100644
--- a/fs/proc/kcore.c
+++ b/fs/proc/kcore.c
@@ -600,6 +600,7 @@ static ssize_t read_kcore_iter(struct kiocb *iocb, struct iov_iter *iter)
ret = -EFAULT;
goto out;
}
+ ret = 0;
/*
* We know the bounce buffer is safe to copy from, so
* use _copy_to_iter() directly.
--
2.47.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] fs/proc/kcore.c: Clear ret value in read_kcore_iter after successful iov_iter_zero
2024-11-21 23:11 [PATCH] fs/proc/kcore.c: Clear ret value in read_kcore_iter after successful iov_iter_zero Jiri Olsa
@ 2024-11-22 8:40 ` Alexander Gordeev
2024-11-22 11:09 ` Christian Brauner
1 sibling, 0 replies; 3+ messages in thread
From: Alexander Gordeev @ 2024-11-22 8:40 UTC (permalink / raw)
To: Jiri Olsa
Cc: Andrew Morton, Christian Brauner, stable, linux-kernel,
Heiko Carstens, linux-fsdevel
On Fri, Nov 22, 2024 at 12:11:18AM +0100, Jiri Olsa wrote:
> 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@vger.kernel.org
> Cc: Alexander Gordeev <agordeev@linux.ibm.com>
> Fixes: 3d5854d75e31 ("fs/proc/kcore.c: allow translation of physical memory addresses")
> Signed-off-by: Jiri Olsa <jolsa@kernel.org>
> ---
> fs/proc/kcore.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/fs/proc/kcore.c b/fs/proc/kcore.c
> index 51446c59388f..c82c408e573e 100644
> --- a/fs/proc/kcore.c
> +++ b/fs/proc/kcore.c
> @@ -600,6 +600,7 @@ static ssize_t read_kcore_iter(struct kiocb *iocb, struct iov_iter *iter)
> ret = -EFAULT;
> goto out;
> }
> + ret = 0;
> /*
> * We know the bounce buffer is safe to copy from, so
> * use _copy_to_iter() directly.
Acked-by: Alexander Gordeev <agordeev@linux.ibm.com>
Thank you, Jiri!
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] fs/proc/kcore.c: Clear ret value in read_kcore_iter after successful iov_iter_zero
2024-11-21 23:11 [PATCH] fs/proc/kcore.c: Clear ret value in read_kcore_iter after successful iov_iter_zero Jiri Olsa
2024-11-22 8:40 ` Alexander Gordeev
@ 2024-11-22 11:09 ` Christian Brauner
1 sibling, 0 replies; 3+ messages in thread
From: Christian Brauner @ 2024-11-22 11:09 UTC (permalink / raw)
To: Jiri Olsa
Cc: Christian Brauner, stable, Alexander Gordeev, linux-kernel,
Heiko Carstens, linux-fsdevel, Andrew Morton
On Fri, 22 Nov 2024 00:11:18 +0100, Jiri Olsa wrote:
> 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.
>
>
> [...]
Applied to the vfs.fixes branch of the vfs/vfs.git tree.
Patches in the vfs.fixes branch should appear in linux-next soon.
Please report any outstanding bugs that were missed during review in a
new review to the original patch series allowing us to drop it.
It's encouraged to provide Acked-bys and Reviewed-bys even though the
patch has now been applied. If possible patch trailers will be updated.
Note that commit hashes shown below are subject to change due to rebase,
trailer updates or similar. If in doubt, please check the listed branch.
tree: https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git
branch: vfs.fixes
[1/1] fs/proc/kcore.c: Clear ret value in read_kcore_iter after successful iov_iter_zero
https://git.kernel.org/vfs/vfs/c/088f294609d8
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-11-22 11:09 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-21 23:11 [PATCH] fs/proc/kcore.c: Clear ret value in read_kcore_iter after successful iov_iter_zero Jiri Olsa
2024-11-22 8:40 ` Alexander Gordeev
2024-11-22 11:09 ` Christian Brauner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox