Re: [PATCH] x86/csum: Add KASAN/KCSAN instrumentation

From: Jann Horn
Date: Wed Jan 26 2022 - 12:48:16 EST


On Wed, Jan 26, 2022 at 6:38 PM Dmitry Vyukov <dvyukov@xxxxxxxxxx> wrote:
> On Wed, 26 Jan 2022 at 18:13, Jann Horn <jannh@xxxxxxxxxx> wrote:
> >
> > In the optimized X86 version of the copy-with-checksum helpers, use
> > instrument_*() before accessing buffers from assembly code so that KASAN
> > and KCSAN don't have blind spots there.
[...]
> Can these potentially be called with KERNEL_DS as in some compat
> syscalls? If so it's better to use instrument_copy_to/from_user.
> Or probably it's better to use them anyway b/c we also want to know
> about user accesses for uaccess logging and maybe other things.

Christoph Hellwig has basically eradicated KERNEL_DS. :)

In particular, on X86, set_fs(KERNEL_DS) doesn't really do anything
anymore since commit 47058bb54b579 ("x86: remove address space
overrides using set_fs()").