Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F169994146
D57244.id178607.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D57244.id178607.diff
View Options
Index: sys/kern/kern_sig.c
===================================================================
--- sys/kern/kern_sig.c
+++ sys/kern/kern_sig.c
@@ -2038,6 +2038,16 @@
if (pid <= 0)
return (EINVAL);
+ /*
+ * A process in capability mode can send signals only to himself.
+ */
+ if (pid != td->td_proc->p_pid) {
+ if (CAP_TRACING(td))
+ ktrcapfail(CAPFAIL_SIGNAL, &signum);
+ if (IN_CAPABILITY_MODE(td))
+ return (ECAPMODE);
+ }
+
if ((signumf & __SIGQUEUE_TID) == 0) {
if ((p = pfind_any(pid)) == NULL)
return (ESRCH);
Index: tests/sys/capsicum/capmode.cc
===================================================================
--- tests/sys/capsicum/capmode.cc
+++ tests/sys/capsicum/capmode.cc
@@ -703,8 +703,8 @@
close(thread_pipe[1]);
}
-static volatile sig_atomic_t had_signal = 0;
-static void handle_signal(int) { had_signal = 1; }
+static volatile sig_atomic_t signal_cnt = 0;
+static void handle_signal(int) { signal_cnt++; }
FORK_TEST(Capmode, SelfKill) {
pid_t me = getpid();
@@ -722,7 +722,13 @@
// Can only kill(2) to own pid.
EXPECT_CAPMODE(kill(child, SIGUSR1));
EXPECT_OK(kill(me, SIGUSR1));
- EXPECT_EQ(1, had_signal);
+ EXPECT_EQ(1, signal_cnt);
+
+ union sigval sv;
+ sv.sival_int = 0x1234;
+ EXPECT_CAPMODE(sigqueue(child, SIGUSR1, sv);
+ EXPECT_OK(sigqueue(child, SIGUSR1, sv);
+ EXPECT_EQ(2, signal_cnt);
signal(SIGUSR1, original);
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Sep 4, 5:17 AM (14 h, 2 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
38194478
Default Alt Text
D57244.id178607.diff (1 KB)
Attached To
Mode
D57244: sigqueue: In capability mode, only allow signalling self
Attached
Detach File
Event Timeline
Log In to Comment