From: Eric Wong <normalperson@yhbt.net>
To: Nicolas Iooss <nicolas.iooss_linux@m4x.org>
Cc: "Alexander Viro" <viro@zeniv.linux.org.uk>,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
"Arve Hjønnevåg" <arve@android.com>, NeilBrown <neilb@suse.de>,
"Jason Baron" <jbaron@akamai.com>,
"Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
"Amit Pundir" <amit.pundir@linaro.org>,
stable@vger.kernel.org
Subject: Re: [PATCH] eventpoll: fix uninitialized variable in epoll_ctl
Date: Wed, 20 Aug 2014 19:29:20 +0000 [thread overview]
Message-ID: <20140820192920.GA25619@dcvr.yhbt.net> (raw)
In-Reply-To: <1408469053-9262-1-git-send-email-nicolas.iooss_linux@m4x.org>
Nicolas Iooss <nicolas.iooss_linux@m4x.org> wrote:
> When calling epoll_ctl with operation EPOLL_CTL_DEL, structure epds is
> not initialized but ep_take_care_of_epollwakeup reads its event field.
> When this unintialized field has EPOLLWAKEUP bit set, a capability check
> is done for CAP_BLOCK_SUSPEND in ep_take_care_of_epollwakeup. This
> produces unexpected messages in the audit log, such as (on a system
> running SELinux):
>
> type=AVC msg=audit(1408212798.866:410): avc: denied
> { block_suspend } for pid=7754 comm="dbus-daemon" capability=36
> scontext=unconfined_u:unconfined_r:unconfined_t
> tcontext=unconfined_u:unconfined_r:unconfined_t
> tclass=capability2 permissive=1
>
> type=SYSCALL msg=audit(1408212798.866:410): arch=c000003e syscall=233
> success=yes exit=0 a0=3 a1=2 a2=9 a3=7fffd4d66ec0 items=0 ppid=1
> pid=7754 auid=1000 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0
> fsgid=0 tty=(none) ses=3 comm="dbus-daemon"
> exe="/usr/bin/dbus-daemon"
> subj=unconfined_u:unconfined_r:unconfined_t key=(null)
>
> ("arch=c000003e syscall=233 a1=2" means "epoll_ctl(op=EPOLL_CTL_DEL)")
>
> Remove use of epds in epoll_ctl when op == EPOLL_CTL_DEL.
>
> Fixes: 4d7e30d98939 ("epoll: Add a flag, EPOLLWAKEUP, to prevent suspend
> while epoll events are ready")
> Signed-off-by: Nicolas Iooss <nicolas.iooss_linux@m4x.org>
Looks good to me. Tested without regressions on several of my
(non-EPOLLWAKEUP) projects. Adding a few more folks to the Cc: list.
Acked-by: Eric Wong <normalperson@yhbt.net>
> ---
> fs/eventpoll.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/fs/eventpoll.c b/fs/eventpoll.c
> index b10b48c..7bcfff9 100644
> --- a/fs/eventpoll.c
> +++ b/fs/eventpoll.c
> @@ -1852,7 +1852,8 @@ SYSCALL_DEFINE4(epoll_ctl, int, epfd, int, op, int, fd,
> goto error_tgt_fput;
>
> /* Check if EPOLLWAKEUP is allowed */
> - ep_take_care_of_epollwakeup(&epds);
> + if (ep_op_has_event(op))
> + ep_take_care_of_epollwakeup(&epds);
>
> /*
> * We have to check that the file structure underneath the file descriptor
> --
> 1.7.10.4
prev parent reply other threads:[~2014-08-20 19:29 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-19 17:24 Nicolas Iooss
2014-08-20 19:29 ` Eric Wong [this message]
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=20140820192920.GA25619@dcvr.yhbt.net \
--to=normalperson@yhbt.net \
--cc=amit.pundir@linaro.org \
--cc=arve@android.com \
--cc=jbaron@akamai.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=neilb@suse.de \
--cc=nicolas.iooss_linux@m4x.org \
--cc=rafael.j.wysocki@intel.com \
--cc=stable@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
/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
all inboxes | Powered by JetHome®