2020-08-31 20:30:19

by albert.linde

[permalink] [raw]
Subject: [PATCH v3 0/3] add fault injection to user memory access

From: Albert van der Linde <[email protected]>

The goal of this series is to improve testing of fault-tolerance in
usages of user memory access functions, by adding support for fault
injection.

The first patch adds failure injection capability for usercopy
functions. The second changes usercopy functions to use this new failure
capability (copy_from_user, ...). The third patch adds
get/put/clear_user failures to x86.

Changes in v2:
- simplified overall failure capability by either failing or not, without
having functions fail partially by copying/clearing only some bytes

Changes in v3:
- adressed comments from Peter Zijlstra: fixed inconsistent ordering
with might_fault()

Albert van der Linde (3):
lib, include/linux: add usercopy failure capability
lib, uaccess: add failure injection to usercopy functions
x86: add failure injection to get/put/clear_user

.../admin-guide/kernel-parameters.txt | 1 +
.../fault-injection/fault-injection.rst | 7 +-
arch/x86/include/asm/uaccess.h | 68 +++++++++++--------
arch/x86/lib/usercopy_64.c | 3 +
include/linux/fault-inject-usercopy.h | 22 ++++++
include/linux/uaccess.h | 11 ++-
lib/Kconfig.debug | 7 ++
lib/Makefile | 1 +
lib/fault-inject-usercopy.c | 39 +++++++++++
lib/iov_iter.c | 5 ++
lib/strncpy_from_user.c | 3 +
lib/usercopy.c | 5 +-
12 files changed, 140 insertions(+), 32 deletions(-)
create mode 100644 include/linux/fault-inject-usercopy.h
create mode 100644 lib/fault-inject-usercopy.c

--
2.28.0.402.g5ffc5be6b7-goog


2020-08-31 22:33:37

by Andrew Morton

[permalink] [raw]
Subject: Re: [PATCH v3 0/3] add fault injection to user memory access

On Mon, 31 Aug 2020 17:17:30 +0000 [email protected] wrote:

> The goal of this series is to improve testing of fault-tolerance in
> usages of user memory access functions, by adding support for fault
> injection.

Does anyone actually plan to use this feature, on an ongoing basis?
It's the sort of thing which the various test robots could exploit, but
I'm not sure that they are using fault injection?

2020-08-31 22:38:13

by Andrey Konovalov

[permalink] [raw]
Subject: Re: [PATCH v3 0/3] add fault injection to user memory access

On Mon, Aug 31, 2020 at 8:32 PM Andrew Morton <[email protected]> wrote:
>
> On Mon, 31 Aug 2020 17:17:30 +0000 [email protected] wrote:
>
> > The goal of this series is to improve testing of fault-tolerance in
> > usages of user memory access functions, by adding support for fault
> > injection.
>
> Does anyone actually plan to use this feature, on an ongoing basis?
> It's the sort of thing which the various test robots could exploit, but
> I'm not sure that they are using fault injection?

Hi Andrew,

syzkaller/syzbot is using the existing fault injection modes and will
use this particular feature too.

Thanks!