From: Dmitry Vyukov <dvyukov@google.com>
To: Paul Moore <paul@paul-moore.com>,
stephen.smalley.work@gmail.com,
Eric Paris <eparis@parisplace.org>,
selinux@vger.kernel.org
Cc: LKML <linux-kernel@vger.kernel.org>,
syzkaller <syzkaller@googlegroups.com>,
Willem de Bruijn <willemb@google.com>
Subject: selinux_netlink_send changes program behavior
Date: Fri, 24 Apr 2020 10:27:25 +0200 [thread overview]
Message-ID: <CACT4Y+YTi4JCFRqOB9rgA22S+6xxTo87X41hj6Tdfro8K3ef7g@mail.gmail.com> (raw)
Hi SELinux maintainers,
We've hit a case where a developer wasn't able to reproduce a kernel
bug, it turned out to be a difference in behavior between SELinux and
non-SELinux kernels.
Condensed version: a program does sendmmsg on netlink socket with 2
mmsghdr's, first is completely empty/zeros, second contains some
actual payload. Without SELinux the first mmsghdr is treated as no-op
and the kernel processes the second one (triggers bug). However the
SELinux hook does:
static int selinux_netlink_send(struct sock *sk, struct sk_buff *skb)
{
if (skb->len < NLMSG_HDRLEN) {
err = -EINVAL;
goto out;
}
and fails processing on the first empty mmsghdr (does not happen
without SELinux).
Is this difference in behavior intentional/acceptable/should be fixed?
Thanks
FTR, the C program is:
https://gist.githubusercontent.com/dvyukov/dda1c547ca9121817159d29afa72aea2/raw/41b021d722947df4d8c48e2fc783591b44671ceb/gistfile1.txt
kernel config:
https://gist.githubusercontent.com/dvyukov/08bf2c2fd873a84a2c4c771740716183/raw/78fb3b1063b7ae37625468f32868869edbd1bd19/gistfile1.txt
on upstream commit 50cc09c1 it triggers a KASAN bug without SELinux,
but does not with SELinux.
next reply other threads:[~2020-04-24 8:27 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-24 8:27 Dmitry Vyukov [this message]
2020-04-24 21:51 ` selinux_netlink_send changes program behavior Paul Moore
2020-04-25 5:14 ` Dmitry Vyukov
2020-04-25 11:42 ` Paul Moore
2020-04-25 12:00 ` Dmitry Vyukov
2020-04-28 1:53 ` Paul Moore
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CACT4Y+YTi4JCFRqOB9rgA22S+6xxTo87X41hj6Tdfro8K3ef7g@mail.gmail.com \
--to=dvyukov@google.com \
--cc=eparis@parisplace.org \
--cc=linux-kernel@vger.kernel.org \
--cc=paul@paul-moore.com \
--cc=selinux@vger.kernel.org \
--cc=stephen.smalley.work@gmail.com \
--cc=syzkaller@googlegroups.com \
--cc=willemb@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).