Bug 216660

Summary: fail-nth: don't fail own copy_to/from_user
Product: Memory Management Reporter: Dmitry Vyukov (dvyukov)
Component: SanitizersAssignee: MM/Sanitizers virtual assignee (mm_sanitizers)
Status: NEW ---    
Severity: normal CC: kasan-dev
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: ALL Subsystem:
Regression: No Bisected commit-id:

Description Dmitry Vyukov 2022-11-04 17:34:08 UTC
Since we added failing of copy_to/from_user KCOV may fail own reads/writes:
https://elixir.bootlin.com/linux/v6.1-rc3/source/fs/proc/base.c#L1400
https://elixir.bootlin.com/linux/v6.1-rc3/source/fs/proc/base.c#L1425

Potentially this can worked around in user-space, but this is very inconvenient and needs to be done for all KCOV users. I think we need to not fail them in the kernel.

I think it can be done relatively easily by setting task->fail_nth to 0 for the duration of read/write.

Reported-by: Jason Gunthorpe <jgg@nvidia.com>
Link: https://lore.kernel.org/all/Y2RbCUdEY2syxRLW@nvidia.com/