lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210520092102.199503505@linuxfoundation.org>
Date:   Thu, 20 May 2021 11:21:05 +0200
From:   Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To:     linux-kernel@...r.kernel.org
Cc:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        stable@...r.kernel.org, Eric Caruso <ejcaruso@...gle.com>,
        Todd Poynor <toddpoynor@...gle.com>,
        Thomas Gleixner <tglx@...utronix.de>,
        Kasper Zwijsen <Kasper.Zwijsen@...nt.be>
Subject: [PATCH 4.4 001/190] timerfd: Reject ALARM timerfds without CAP_WAKE_ALARM

From: Eric Caruso <ejcaruso@...gle.com>

commit 2895a5e5b3ae78d9923a91fce405d4a2f32c4309 upstream.

timerfd gives processes a way to set wake alarms, but unlike timers made using
timer_create, timerfds don't check whether the process has CAP_WAKE_ALARM
before setting alarm-time timers. CAP_WAKE_ALARM is supposed to gate this
behavior and so it makes sense that we should deny permission to create such
timerfds if the process doesn't have this capability.

Signed-off-by: Eric Caruso <ejcaruso@...gle.com>
Cc: Todd Poynor <toddpoynor@...gle.com>
Link: http://lkml.kernel.org/r/1465427339-96209-1-git-send-email-ejcaruso@chromium.org
Signed-off-by: Thomas Gleixner <tglx@...utronix.de>
Cc: Kasper Zwijsen <Kasper.Zwijsen@...nt.be>
Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
---
 fs/timerfd.c |   10 ++++++++++
 1 file changed, 10 insertions(+)

--- a/fs/timerfd.c
+++ b/fs/timerfd.c
@@ -400,6 +400,11 @@ SYSCALL_DEFINE2(timerfd_create, int, clo
 	     clockid != CLOCK_BOOTTIME_ALARM))
 		return -EINVAL;
 
+	if (!capable(CAP_WAKE_ALARM) &&
+	    (clockid == CLOCK_REALTIME_ALARM ||
+	     clockid == CLOCK_BOOTTIME_ALARM))
+		return -EPERM;
+
 	ctx = kzalloc(sizeof(*ctx), GFP_KERNEL);
 	if (!ctx)
 		return -ENOMEM;
@@ -444,6 +449,11 @@ static int do_timerfd_settime(int ufd, i
 		return ret;
 	ctx = f.file->private_data;
 
+	if (!capable(CAP_WAKE_ALARM) && isalarm(ctx)) {
+		fdput(f);
+		return -EPERM;
+	}
+
 	timerfd_setup_cancel(ctx, flags);
 
 	/*


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ