x86: fix copy_from_user_nmi() return if range is not ok
Subsystems (2)
PATCH 1/1 x86: fix copy_from_user_nmi() return if range is not ok
Commit 0a196848ca36 ("perf: Fix arch_perf_out_copy_user default"), changes copy_from_user_nmi() to return the number of remaining bytes so that it behave like copy_from_user().
Unfortunately, when the range is outside of the process, memory the return value is still the number of byte copied, eg. 0, instead of the remaining bytes.
As all users of copy_from_user_nmi() were modified as part of commit 0a196848ca36, the function should be fixed to return the total number of bytes if range is not correct.
--- arch/x86/lib/usercopy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/lib/usercopy.c +1 -1
@@ -20,7 +20,7 @@ copy_from_user_nmi(void *to, const void __user *from, unsigned long n)unsigned long ret;if (__range_not_ok (from, n,TASK_SIZE )) -return 0 ; +return n;/* * Even though this function is typically called from NMI/IRQ context
Signature · 5 lines
2.4.3 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in Please read the FAQ at http://www.tux.org/lkml/
tip-bot for Yann Droneaud
merge bot[tip:perf/urgent] perf/x86: Fix copy_from_user_nmi() return if range is not ok
perf/x86: Fix copy_from_user_nmi() return if range is not ok
Commit-ID: ebf2d2689de551d90965090bb991fc640a0c0d41 Gitweb: http://git.kernel.org/tip/ebf2d2689de551d90965090bb991fc640a0c0d41 Author: Yann Droneaud <[email protected]> AuthorDate: Mon, 22 Jun 2015 21:38:43 +0200 Committer: Ingo Molnar <[email protected]> CommitDate: Mon, 6 Jul 2015 14:09:27 +0200
perf/x86: Fix copy_from_user_nmi() return if range is not ok
Commit 0a196848ca36 ("perf: Fix arch_perf_out_copy_user default"), changes copy_from_user_nmi() to return the number of remaining bytes so that it behave like copy_from_user().
Unfortunately, when the range is outside of the process memory, the return value is still the number of byte copied, eg. 0, instead of the remaining bytes.
As all users of copy_from_user_nmi() were modified as part of commit 0a196848ca36, the function should be fixed to return the total number of bytes if range is not correct.
--- arch/x86/lib/usercopy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/lib/usercopy.c +1 -1
@@ -20,7 +20,7 @@ copy_from_user_nmi(void *to, const void __user *from, unsigned long n)unsigned long ret;if (__range_not_ok (from, n,TASK_SIZE )) -return 0 ; +return n;/* * Even though this function is typically called from NMI/IRQ context
[-stable] perf/x86: Fix copy_from_user_nmi() return if range is not ok
Hi,
I believe commit ebf2d2689de551d90965090bb991fc640a0c0d41 ("perf/x86: Fix copy_from_user_nmi() return if range is not ok") should be applied to stable kernels starting from v3.13.y up to v4.1.y.
Regards.
Signature · 2 lines
Yann Droneaud OPTEYA
Re: [-stable] perf/x86: Fix copy_from_user_nmi() return if range is not ok
Quoted 6 lines · Yann Droneaud
Hi,
I believe commit
ebf2d2689de551d90965090bb991fc640a0c0d41("perf/x86: Fixcopy_from_user_nmi()return if range is not ok") should be applied to stable kernels starting from v3.13.y up to v4.1.y.
Thank you, I'm queuing it for the 3.16 kernel.
Cheers,
--
Lu�s
Quoted 10 lines
Regards.
Signature · 7 lines
Yann Droneaud OPTEYA -- To unsubscribe from this list: send the line "unsubscribe stable" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html