linux-stable/security/selinux
Ondrej Mosnacek 914026d581 selinux: fix empty write to keycreate file
[ Upstream commit 464c258aa4 ]

When sid == 0 (we are resetting keycreate_sid to the default value), we
should skip the KEY__CREATE check.

Before this patch, doing a zero-sized write to /proc/self/keycreate
would check if the current task can create unlabeled keys (which would
usually fail with -EACCESS and generate an AVC). Now it skips the check
and correctly sets the task's keycreate_sid to 0.

Bug report: https://bugzilla.redhat.com/show_bug.cgi?id=1719067

Tested using the reproducer from the report above.

Fixes: 4eb582cf1f ("[PATCH] keys: add a way to store the appropriate context for newly-created keys")
Reported-by: Kir Kolyshkin <kir@sacred.ru>
Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
Signed-off-by: Paul Moore <paul@paul-moore.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2019-07-26 09:14:07 +02:00
..
include selinux: avoid silent denials in permissive mode under RCU walk 2019-05-08 07:21:54 +02:00
ss selinux: fix GPF on invalid policy 2019-01-22 21:40:35 +01:00
.gitignore
avc.c selinux: avoid silent denials in permissive mode under RCU walk 2019-05-08 07:21:54 +02:00
exports.c
hooks.c selinux: fix empty write to keycreate file 2019-07-26 09:14:07 +02:00
ibpkey.c selinux: wrap global selinux state 2018-03-01 18:48:02 -05:00
Kconfig security: introduce CONFIG_SECURITY_WRITABLE_HOOKS 2017-03-06 11:00:12 +11:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
netif.c selinux: Cleanup printk logging in netif 2018-06-19 13:45:31 -04:00
netlabel.c selinux: avoid uninitialized variable warning 2019-05-31 06:46:31 -07:00
netlink.c selinux: Cleanup printk logging in netlink 2018-06-19 13:33:05 -04:00
netnode.c selinux: Cleanup printk logging in netnode 2018-06-19 13:49:10 -04:00
netport.c selinux: Cleanup printk logging in netport 2018-06-19 13:43:01 -04:00
nlmsgtab.c selinux: add support for RTM_NEWCHAIN, RTM_DELCHAIN, and RTM_GETCHAIN 2018-12-08 12:59:08 +01:00
selinuxfs.c selinux/stable-4.18 PR 20180814 2018-08-15 10:39:06 -07:00
xfrm.c selinux: wrap AVC state 2018-03-20 16:58:17 -04:00