lkdtm: Add tests for NULL pointer dereference
authorChristophe Leroy <christophe.leroy@c-s.fr>
Fri, 14 Dec 2018 15:26:20 +0000 (15:26 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 20 Apr 2019 07:16:04 +0000 (09:16 +0200)
commit2be8987a076fd6d501935e51c23ebc738b233a63
treed2a2ca80d213a00d19dc5dd316d3c9fbbe5cecad
parent55588aebde384375fe301ded672e16c925ce3599
lkdtm: Add tests for NULL pointer dereference

[ Upstream commit 59a12205d3c32aee4c13ca36889fdf7cfed31126 ]

Introduce lkdtm tests for NULL pointer dereference: check access or exec
at NULL address, since these errors tend to be reported differently from
the general fault error text. For example from x86:

    pr_alert("BUG: unable to handle kernel %s at %px\n",
        address < PAGE_SIZE ? "NULL pointer dereference" : "paging request",
        (void *)address);

Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/misc/lkdtm/core.c
drivers/misc/lkdtm/lkdtm.h
drivers/misc/lkdtm/perms.c