Re: [PATCH v7 18/43] instrumented.h: add KMSAN support

From: Marco Elver
Date: Wed Oct 19 2022 - 16:00:22 EST


On Thu, Oct 20, 2022 at 03:29AM +0800, youling 257 wrote:
[...]
> > What arch?
> > If x86, can you try to revert only the change to
> > instrument_get_user()? (I wonder if the u64 conversion is causing
> > issues.)
> >
> arch x86, this's my revert,
> https://github.com/youling257/android-mainline/commit/401cbfa61cbfc20c87a5be8e2dda68ac5702389f
> i tried different revert, have to remove kmsan_copy_to_user.

There you reverted only instrument_put_user() - does it fix the issue?

If not, can you try only something like this (only revert
instrument_get_user()):

diff --git a/include/linux/instrumented.h b/include/linux/instrumented.h
index 501fa8486749..dbe3ec38d0e6 100644
--- a/include/linux/instrumented.h
+++ b/include/linux/instrumented.h
@@ -167,9 +167,6 @@ instrument_copy_from_user_after(const void *to, const void __user *from,
*/
#define instrument_get_user(to) \
({ \
- u64 __tmp = (u64)(to); \
- kmsan_unpoison_memory(&__tmp, sizeof(__tmp)); \
- to = __tmp; \
})


Once we know which one of these is the issue, we can figure out a proper
fix.

Thanks,

-- Marco