X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=lib%2Fusercopy.c;h=d29fe29c6849417e6606cd06a9533aecacd8354a;hb=cc2f2507f3f05612c61c4b8f11bb91efbb9ad495;hp=1505a52f23a01945ef30bb675d647a524e01680d;hpb=9761070d14db0ac0706684eb2fa37dca3087efa1;p=platform%2Fkernel%2Flinux-starfive.git diff --git a/lib/usercopy.c b/lib/usercopy.c index 1505a52..d29fe29 100644 --- a/lib/usercopy.c +++ b/lib/usercopy.c @@ -3,6 +3,7 @@ #include #include #include +#include /* out-of-line parts */ @@ -12,6 +13,12 @@ unsigned long _copy_from_user(void *to, const void __user *from, unsigned long n unsigned long res = n; might_fault(); if (!should_fail_usercopy() && likely(access_ok(from, n))) { + /* + * Ensure that bad access_ok() speculation will not + * lead to nasty side effects *after* the copy is + * finished: + */ + barrier_nospec(); instrument_copy_from_user_before(to, from, n); res = raw_copy_from_user(to, from, n); instrument_copy_from_user_after(to, from, n, res);