[PATCH v3 1/2] security: add fault injection capability

Aleksandr Nogikh nogikh at google.com
Tue Nov 10 18:35:02 UTC 2020


On Tue, Nov 10, 2020 at 7:43 AM Tetsuo Handa
<penguin-kernel at i-love.sakura.ne.jp> wrote:
>
[...]
>
> By the way, fail_lsm_hooks.retval is "signed int" but debugfs_create_u32() handles "unsigned int".
> Do we want to allow lsm_hooks_inject_fail() to inject arbitrary !IS_ERR_VALUE() values?

Thanks for pointing it out. Technically, now it's possible to set a
negative value - internally, the kernel
will process negative integers anyway, and after casting the unsigned
value to a signed one, retval
will contain exactly what the user provided. However, if the user
retrieves the attribute value, they won't
get the exact value that was set (if it was negative).

I'll change debugfs_create_u32 to something else in v4, so that it'll
be more explicit and so that it'll be
possible to read negative values normally.



More information about the Linux-security-module-archive mailing list