blob: 736bebf9359186c528e2310df395ba766e2739df [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001// SPDX-License-Identifier: GPL-2.0
Davide Libenzifba2afa2007-05-10 22:23:13 -07002/*
3 * fs/signalfd.c
4 *
5 * Copyright (C) 2003 Linus Torvalds
6 *
7 * Mon Mar 5, 2007: Davide Libenzi <davidel@xmailserver.org>
8 * Changed ->read() to return a siginfo strcture instead of signal number.
9 * Fixed locking in ->poll().
10 * Added sighand-detach notification.
11 * Added fd re-use in sys_signalfd() syscall.
12 * Now using anonymous inode source.
13 * Thanks to Oleg Nesterov for useful code review and suggestions.
14 * More comments and suggestions from Arnd Bergmann.
Davide Libenzib8fceee2007-09-20 12:40:16 -070015 * Sat May 19, 2007: Davi E. M. Arnaut <davi@haxent.com.br>
Davi Arnautb3762bf2007-05-23 13:58:04 -070016 * Retrieve multiple signals with one read() call
Davide Libenzib8fceee2007-09-20 12:40:16 -070017 * Sun Jul 15, 2007: Davide Libenzi <davidel@xmailserver.org>
18 * Attach to the sighand only during read() and poll().
Davide Libenzifba2afa2007-05-10 22:23:13 -070019 */
20
21#include <linux/file.h>
22#include <linux/poll.h>
23#include <linux/init.h>
24#include <linux/fs.h>
25#include <linux/sched.h>
Tejun Heo5a0e3ad2010-03-24 17:04:11 +090026#include <linux/slab.h>
Davide Libenzifba2afa2007-05-10 22:23:13 -070027#include <linux/kernel.h>
28#include <linux/signal.h>
29#include <linux/list.h>
30#include <linux/anon_inodes.h>
31#include <linux/signalfd.h>
Adrian Bunk7ec37df2008-02-06 01:36:48 -080032#include <linux/syscalls.h>
Cyrill Gorcunov138d22b2012-12-17 16:05:02 -080033#include <linux/proc_fs.h>
Al Viro7d197ed2013-02-24 01:41:39 -050034#include <linux/compat.h>
Davide Libenzifba2afa2007-05-10 22:23:13 -070035
Oleg Nesterovd80e7312012-02-24 20:07:11 +010036void signalfd_cleanup(struct sighand_struct *sighand)
37{
Eric Biggers9537bae2021-12-08 17:04:53 -080038 wake_up_pollfree(&sighand->signalfd_wqh);
Oleg Nesterovd80e7312012-02-24 20:07:11 +010039}
40
Davide Libenzifba2afa2007-05-10 22:23:13 -070041struct signalfd_ctx {
Davide Libenzifba2afa2007-05-10 22:23:13 -070042 sigset_t sigmask;
Davide Libenzifba2afa2007-05-10 22:23:13 -070043};
44
Davide Libenzifba2afa2007-05-10 22:23:13 -070045static int signalfd_release(struct inode *inode, struct file *file)
46{
Davide Libenzib8fceee2007-09-20 12:40:16 -070047 kfree(file->private_data);
Davide Libenzifba2afa2007-05-10 22:23:13 -070048 return 0;
49}
50
Al Viro076ccb72017-07-03 01:02:18 -040051static __poll_t signalfd_poll(struct file *file, poll_table *wait)
Davide Libenzifba2afa2007-05-10 22:23:13 -070052{
53 struct signalfd_ctx *ctx = file->private_data;
Al Viro076ccb72017-07-03 01:02:18 -040054 __poll_t events = 0;
Davide Libenzifba2afa2007-05-10 22:23:13 -070055
Davide Libenzib8fceee2007-09-20 12:40:16 -070056 poll_wait(file, &current->sighand->signalfd_wqh, wait);
Davide Libenzifba2afa2007-05-10 22:23:13 -070057
Davide Libenzib8fceee2007-09-20 12:40:16 -070058 spin_lock_irq(&current->sighand->siglock);
59 if (next_signal(&current->pending, &ctx->sigmask) ||
60 next_signal(&current->signal->shared_pending,
61 &ctx->sigmask))
Linus Torvaldsa9a08842018-02-11 14:34:03 -080062 events |= EPOLLIN;
Davide Libenzib8fceee2007-09-20 12:40:16 -070063 spin_unlock_irq(&current->sighand->siglock);
Davide Libenzifba2afa2007-05-10 22:23:13 -070064
65 return events;
66}
67
68/*
69 * Copied from copy_siginfo_to_user() in kernel/signal.c
70 */
Jens Axboefbe38122024-04-02 12:12:18 -060071static int signalfd_copyinfo(struct iov_iter *to, kernel_siginfo_t const *kinfo)
Davide Libenzifba2afa2007-05-10 22:23:13 -070072{
Eric W. Biederman5611f55e2018-04-24 20:39:16 -050073 struct signalfd_siginfo new;
Davide Libenzifba2afa2007-05-10 22:23:13 -070074
75 BUILD_BUG_ON(sizeof(struct signalfd_siginfo) != 128);
76
77 /*
Robert P. J. Day14e4a0f2008-02-03 15:12:15 +020078 * Unused members should be zero ...
Davide Libenzifba2afa2007-05-10 22:23:13 -070079 */
Eric W. Biederman5611f55e2018-04-24 20:39:16 -050080 memset(&new, 0, sizeof(new));
Davide Libenzifba2afa2007-05-10 22:23:13 -070081
82 /*
83 * If you change siginfo_t structure, please be sure
84 * this code is fixed accordingly.
85 */
Eric W. Biederman5611f55e2018-04-24 20:39:16 -050086 new.ssi_signo = kinfo->si_signo;
87 new.ssi_errno = kinfo->si_errno;
88 new.ssi_code = kinfo->si_code;
Eric W. Biedermancc731522017-07-16 22:36:59 -050089 switch (siginfo_layout(kinfo->si_signo, kinfo->si_code)) {
90 case SIL_KILL:
Eric W. Biederman5611f55e2018-04-24 20:39:16 -050091 new.ssi_pid = kinfo->si_pid;
92 new.ssi_uid = kinfo->si_uid;
Davide Libenzifba2afa2007-05-10 22:23:13 -070093 break;
Eric W. Biedermancc731522017-07-16 22:36:59 -050094 case SIL_TIMER:
Eric W. Biederman5611f55e2018-04-24 20:39:16 -050095 new.ssi_tid = kinfo->si_tid;
96 new.ssi_overrun = kinfo->si_overrun;
97 new.ssi_ptr = (long) kinfo->si_ptr;
98 new.ssi_int = kinfo->si_int;
Davide Libenzifba2afa2007-05-10 22:23:13 -070099 break;
Eric W. Biedermancc731522017-07-16 22:36:59 -0500100 case SIL_POLL:
Eric W. Biederman5611f55e2018-04-24 20:39:16 -0500101 new.ssi_band = kinfo->si_band;
102 new.ssi_fd = kinfo->si_fd;
Davide Libenzifba2afa2007-05-10 22:23:13 -0700103 break;
Eric W. Biederman31931c92018-04-24 20:59:47 -0500104 case SIL_FAULT_BNDERR:
105 case SIL_FAULT_PKUERR:
Eric W. Biedermanf4ac7302021-04-30 17:58:56 -0500106 case SIL_FAULT_PERF_EVENT:
Eric W. Biederman31931c92018-04-24 20:59:47 -0500107 /*
Eric W. Biederman922e3012021-05-03 12:52:43 -0500108 * Fall through to the SIL_FAULT case. SIL_FAULT_BNDERR,
Eric W. Biedermanf4ac7302021-04-30 17:58:56 -0500109 * SIL_FAULT_PKUERR, and SIL_FAULT_PERF_EVENT are only
Eric W. Biederman922e3012021-05-03 12:52:43 -0500110 * generated by faults that deliver them synchronously to
111 * userspace. In case someone injects one of these signals
112 * and signalfd catches it treat it as SIL_FAULT.
Eric W. Biederman31931c92018-04-24 20:59:47 -0500113 */
Eric W. Biedermancc731522017-07-16 22:36:59 -0500114 case SIL_FAULT:
Eric W. Biederman5611f55e2018-04-24 20:39:16 -0500115 new.ssi_addr = (long) kinfo->si_addr;
Eric W. Biederman9abcabe2021-04-30 17:29:36 -0500116 break;
117 case SIL_FAULT_TRAPNO:
118 new.ssi_addr = (long) kinfo->si_addr;
Eric W. Biederman5611f55e2018-04-24 20:39:16 -0500119 new.ssi_trapno = kinfo->si_trapno;
Eric W. Biederman31931c92018-04-24 20:59:47 -0500120 break;
121 case SIL_FAULT_MCEERR:
122 new.ssi_addr = (long) kinfo->si_addr;
Eric W. Biederman31931c92018-04-24 20:59:47 -0500123 new.ssi_addr_lsb = (short) kinfo->si_addr_lsb;
Davide Libenzifba2afa2007-05-10 22:23:13 -0700124 break;
Eric W. Biedermancc731522017-07-16 22:36:59 -0500125 case SIL_CHLD:
Eric W. Biederman5611f55e2018-04-24 20:39:16 -0500126 new.ssi_pid = kinfo->si_pid;
127 new.ssi_uid = kinfo->si_uid;
128 new.ssi_status = kinfo->si_status;
129 new.ssi_utime = kinfo->si_utime;
130 new.ssi_stime = kinfo->si_stime;
Davide Libenzifba2afa2007-05-10 22:23:13 -0700131 break;
Eric W. Biedermancc731522017-07-16 22:36:59 -0500132 case SIL_RT:
Davide Libenzi0859ab52008-04-10 21:29:29 -0700133 /*
134 * This case catches also the signals queued by sigqueue().
135 */
Eric W. Biederman5611f55e2018-04-24 20:39:16 -0500136 new.ssi_pid = kinfo->si_pid;
137 new.ssi_uid = kinfo->si_uid;
138 new.ssi_ptr = (long) kinfo->si_ptr;
139 new.ssi_int = kinfo->si_int;
Davide Libenzifba2afa2007-05-10 22:23:13 -0700140 break;
Eric W. Biederman76b7f672018-04-24 20:48:32 -0500141 case SIL_SYS:
142 new.ssi_call_addr = (long) kinfo->si_call_addr;
143 new.ssi_syscall = kinfo->si_syscall;
144 new.ssi_arch = kinfo->si_arch;
145 break;
Davide Libenzifba2afa2007-05-10 22:23:13 -0700146 }
147
Jens Axboefbe38122024-04-02 12:12:18 -0600148 if (!copy_to_iter_full(&new, sizeof(struct signalfd_siginfo), to))
Eric W. Biederman5611f55e2018-04-24 20:39:16 -0500149 return -EFAULT;
150
Jens Axboefbe38122024-04-02 12:12:18 -0600151 return sizeof(struct signalfd_siginfo);
Davide Libenzifba2afa2007-05-10 22:23:13 -0700152}
153
Eric W. Biedermanae7795b2018-09-25 11:27:20 +0200154static ssize_t signalfd_dequeue(struct signalfd_ctx *ctx, kernel_siginfo_t *info,
Davi Arnautb3762bf2007-05-23 13:58:04 -0700155 int nonblock)
156{
Eric W. Biederman5768d892021-11-15 13:47:13 -0600157 enum pid_type type;
Davi Arnautb3762bf2007-05-23 13:58:04 -0700158 ssize_t ret;
Davi Arnautb3762bf2007-05-23 13:58:04 -0700159 DECLARE_WAITQUEUE(wait, current);
160
Davide Libenzib8fceee2007-09-20 12:40:16 -0700161 spin_lock_irq(&current->sighand->siglock);
Thomas Gleixnera2b80ce2024-06-10 18:42:33 +0200162 ret = dequeue_signal(&ctx->sigmask, info, &type);
Davi Arnautb3762bf2007-05-23 13:58:04 -0700163 switch (ret) {
164 case 0:
165 if (!nonblock)
166 break;
167 ret = -EAGAIN;
Gustavo A. R. Silvadf561f662020-08-23 17:36:59 -0500168 fallthrough;
Davi Arnautb3762bf2007-05-23 13:58:04 -0700169 default:
Davide Libenzib8fceee2007-09-20 12:40:16 -0700170 spin_unlock_irq(&current->sighand->siglock);
Davi Arnautb3762bf2007-05-23 13:58:04 -0700171 return ret;
172 }
173
Davide Libenzib8fceee2007-09-20 12:40:16 -0700174 add_wait_queue(&current->sighand->signalfd_wqh, &wait);
Davi Arnautb3762bf2007-05-23 13:58:04 -0700175 for (;;) {
176 set_current_state(TASK_INTERRUPTIBLE);
Thomas Gleixnera2b80ce2024-06-10 18:42:33 +0200177 ret = dequeue_signal(&ctx->sigmask, info, &type);
Davi Arnautb3762bf2007-05-23 13:58:04 -0700178 if (ret != 0)
179 break;
180 if (signal_pending(current)) {
181 ret = -ERESTARTSYS;
182 break;
183 }
Davide Libenzib8fceee2007-09-20 12:40:16 -0700184 spin_unlock_irq(&current->sighand->siglock);
Davi Arnautb3762bf2007-05-23 13:58:04 -0700185 schedule();
Davide Libenzib8fceee2007-09-20 12:40:16 -0700186 spin_lock_irq(&current->sighand->siglock);
Davi Arnautb3762bf2007-05-23 13:58:04 -0700187 }
Davide Libenzib8fceee2007-09-20 12:40:16 -0700188 spin_unlock_irq(&current->sighand->siglock);
Davi Arnautb3762bf2007-05-23 13:58:04 -0700189
Davide Libenzib8fceee2007-09-20 12:40:16 -0700190 remove_wait_queue(&current->sighand->signalfd_wqh, &wait);
Davi Arnautb3762bf2007-05-23 13:58:04 -0700191 __set_current_state(TASK_RUNNING);
192
193 return ret;
194}
195
Davide Libenzifba2afa2007-05-10 22:23:13 -0700196/*
Davide Libenzib8fceee2007-09-20 12:40:16 -0700197 * Returns a multiple of the size of a "struct signalfd_siginfo", or a negative
198 * error code. The "count" parameter must be at least the size of a
199 * "struct signalfd_siginfo".
Davide Libenzifba2afa2007-05-10 22:23:13 -0700200 */
Jens Axboefbe38122024-04-02 12:12:18 -0600201static ssize_t signalfd_read_iter(struct kiocb *iocb, struct iov_iter *to)
Davide Libenzifba2afa2007-05-10 22:23:13 -0700202{
Jens Axboefbe38122024-04-02 12:12:18 -0600203 struct file *file = iocb->ki_filp;
Davide Libenzifba2afa2007-05-10 22:23:13 -0700204 struct signalfd_ctx *ctx = file->private_data;
Jens Axboefbe38122024-04-02 12:12:18 -0600205 size_t count = iov_iter_count(to);
Davi Arnautb3762bf2007-05-23 13:58:04 -0700206 ssize_t ret, total = 0;
Eric W. Biedermanae7795b2018-09-25 11:27:20 +0200207 kernel_siginfo_t info;
Jens Axboefbe38122024-04-02 12:12:18 -0600208 bool nonblock;
Davide Libenzifba2afa2007-05-10 22:23:13 -0700209
Davi Arnautb3762bf2007-05-23 13:58:04 -0700210 count /= sizeof(struct signalfd_siginfo);
211 if (!count)
Davide Libenzifba2afa2007-05-10 22:23:13 -0700212 return -EINVAL;
Davide Libenzifba2afa2007-05-10 22:23:13 -0700213
Jens Axboefbe38122024-04-02 12:12:18 -0600214 nonblock = file->f_flags & O_NONBLOCK || iocb->ki_flags & IOCB_NOWAIT;
Davi Arnautb3762bf2007-05-23 13:58:04 -0700215 do {
216 ret = signalfd_dequeue(ctx, &info, nonblock);
217 if (unlikely(ret <= 0))
218 break;
Jens Axboefbe38122024-04-02 12:12:18 -0600219 ret = signalfd_copyinfo(to, &info);
Davi Arnautb3762bf2007-05-23 13:58:04 -0700220 if (ret < 0)
221 break;
Davi Arnautb3762bf2007-05-23 13:58:04 -0700222 total += ret;
223 nonblock = 1;
224 } while (--count);
225
Davide Libenzib8fceee2007-09-20 12:40:16 -0700226 return total ? total: ret;
Davide Libenzifba2afa2007-05-10 22:23:13 -0700227}
228
Cyrill Gorcunov138d22b2012-12-17 16:05:02 -0800229#ifdef CONFIG_PROC_FS
Joe Perchesa3816ab2014-09-29 16:08:25 -0700230static void signalfd_show_fdinfo(struct seq_file *m, struct file *f)
Cyrill Gorcunov138d22b2012-12-17 16:05:02 -0800231{
232 struct signalfd_ctx *ctx = f->private_data;
233 sigset_t sigmask;
234
235 sigmask = ctx->sigmask;
236 signotset(&sigmask);
237 render_sigset_t(m, "sigmask:\t", &sigmask);
Cyrill Gorcunov138d22b2012-12-17 16:05:02 -0800238}
239#endif
240
Davide Libenzifba2afa2007-05-10 22:23:13 -0700241static const struct file_operations signalfd_fops = {
Cyrill Gorcunov138d22b2012-12-17 16:05:02 -0800242#ifdef CONFIG_PROC_FS
243 .show_fdinfo = signalfd_show_fdinfo,
244#endif
Davide Libenzifba2afa2007-05-10 22:23:13 -0700245 .release = signalfd_release,
246 .poll = signalfd_poll,
Jens Axboefbe38122024-04-02 12:12:18 -0600247 .read_iter = signalfd_read_iter,
Arnd Bergmann6038f372010-08-15 18:52:59 +0200248 .llseek = noop_llseek,
Davide Libenzifba2afa2007-05-10 22:23:13 -0700249};
250
Al Viro5ed01272018-05-27 08:35:50 -0400251static int do_signalfd4(int ufd, sigset_t *mask, int flags)
Davide Libenzifba2afa2007-05-10 22:23:13 -0700252{
Davide Libenzifba2afa2007-05-10 22:23:13 -0700253 struct signalfd_ctx *ctx;
Davide Libenzifba2afa2007-05-10 22:23:13 -0700254
Ulrich Dreppere38b36f2008-07-23 21:29:42 -0700255 /* Check the SFD_* constants for consistency. */
256 BUILD_BUG_ON(SFD_CLOEXEC != O_CLOEXEC);
257 BUILD_BUG_ON(SFD_NONBLOCK != O_NONBLOCK);
258
Ulrich Drepper5fb5e042008-07-23 21:29:37 -0700259 if (flags & ~(SFD_CLOEXEC | SFD_NONBLOCK))
Ulrich Drepper9deb27b2008-07-23 21:29:24 -0700260 return -EINVAL;
261
Al Viro5ed01272018-05-27 08:35:50 -0400262 sigdelsetmask(mask, sigmask(SIGKILL) | sigmask(SIGSTOP));
263 signotset(mask);
Davide Libenzifba2afa2007-05-10 22:23:13 -0700264
265 if (ufd == -1) {
Jens Axboefbe38122024-04-02 12:12:18 -0600266 struct file *file;
267
Davide Libenzifba2afa2007-05-10 22:23:13 -0700268 ctx = kmalloc(sizeof(*ctx), GFP_KERNEL);
269 if (!ctx)
270 return -ENOMEM;
271
Al Viro5ed01272018-05-27 08:35:50 -0400272 ctx->sigmask = *mask;
Davide Libenzifba2afa2007-05-10 22:23:13 -0700273
Jens Axboefbe38122024-04-02 12:12:18 -0600274 ufd = get_unused_fd_flags(flags & O_CLOEXEC);
275 if (ufd < 0) {
276 kfree(ctx);
277 return ufd;
278 }
279
280 file = anon_inode_getfile("[signalfd]", &signalfd_fops, ctx,
281 O_RDWR | (flags & O_NONBLOCK));
282 if (IS_ERR(file)) {
283 put_unused_fd(ufd);
284 kfree(ctx);
Fedor Pchelkinf826bc92024-05-20 12:08:18 +0300285 return PTR_ERR(file);
Jens Axboefbe38122024-04-02 12:12:18 -0600286 }
287 file->f_mode |= FMODE_NOWAIT;
288
Jens Axboefbe38122024-04-02 12:12:18 -0600289 fd_install(ufd, file);
Davide Libenzifba2afa2007-05-10 22:23:13 -0700290 } else {
Al Viro2903ff02012-08-28 12:52:22 -0400291 struct fd f = fdget(ufd);
Al Viro1da91ea2024-05-31 14:12:01 -0400292 if (!fd_file(f))
Davide Libenzifba2afa2007-05-10 22:23:13 -0700293 return -EBADF;
Al Viro1da91ea2024-05-31 14:12:01 -0400294 ctx = fd_file(f)->private_data;
295 if (fd_file(f)->f_op != &signalfd_fops) {
Al Viro2903ff02012-08-28 12:52:22 -0400296 fdput(f);
Davide Libenzifba2afa2007-05-10 22:23:13 -0700297 return -EINVAL;
298 }
Davide Libenzib8fceee2007-09-20 12:40:16 -0700299 spin_lock_irq(&current->sighand->siglock);
Al Viro5ed01272018-05-27 08:35:50 -0400300 ctx->sigmask = *mask;
Davide Libenzib8fceee2007-09-20 12:40:16 -0700301 spin_unlock_irq(&current->sighand->siglock);
302
303 wake_up(&current->sighand->signalfd_wqh);
Al Viro2903ff02012-08-28 12:52:22 -0400304 fdput(f);
Davide Libenzifba2afa2007-05-10 22:23:13 -0700305 }
306
307 return ufd;
Davide Libenzifba2afa2007-05-10 22:23:13 -0700308}
Ulrich Drepper9deb27b2008-07-23 21:29:24 -0700309
Dominik Brodowski52fb6db2018-03-11 11:34:36 +0100310SYSCALL_DEFINE4(signalfd4, int, ufd, sigset_t __user *, user_mask,
311 size_t, sizemask, int, flags)
312{
Al Viro5ed01272018-05-27 08:35:50 -0400313 sigset_t mask;
314
Helge Dellera089e3f2020-08-11 18:36:04 -0700315 if (sizemask != sizeof(sigset_t))
Al Viro5ed01272018-05-27 08:35:50 -0400316 return -EINVAL;
Helge Dellera089e3f2020-08-11 18:36:04 -0700317 if (copy_from_user(&mask, user_mask, sizeof(mask)))
318 return -EFAULT;
Al Viro5ed01272018-05-27 08:35:50 -0400319 return do_signalfd4(ufd, &mask, flags);
Dominik Brodowski52fb6db2018-03-11 11:34:36 +0100320}
321
Heiko Carstens836f92a2009-01-14 14:14:33 +0100322SYSCALL_DEFINE3(signalfd, int, ufd, sigset_t __user *, user_mask,
323 size_t, sizemask)
Ulrich Drepper9deb27b2008-07-23 21:29:24 -0700324{
Al Viro5ed01272018-05-27 08:35:50 -0400325 sigset_t mask;
326
Helge Dellera089e3f2020-08-11 18:36:04 -0700327 if (sizemask != sizeof(sigset_t))
Al Viro5ed01272018-05-27 08:35:50 -0400328 return -EINVAL;
Helge Dellera089e3f2020-08-11 18:36:04 -0700329 if (copy_from_user(&mask, user_mask, sizeof(mask)))
330 return -EFAULT;
Al Viro5ed01272018-05-27 08:35:50 -0400331 return do_signalfd4(ufd, &mask, 0);
Ulrich Drepper9deb27b2008-07-23 21:29:24 -0700332}
Al Viro7d197ed2013-02-24 01:41:39 -0500333
334#ifdef CONFIG_COMPAT
Dominik Brodowski570484b2018-03-20 19:36:46 +0100335static long do_compat_signalfd4(int ufd,
Al Viro5ed01272018-05-27 08:35:50 -0400336 const compat_sigset_t __user *user_mask,
Dominik Brodowski570484b2018-03-20 19:36:46 +0100337 compat_size_t sigsetsize, int flags)
Al Viro7d197ed2013-02-24 01:41:39 -0500338{
Al Viro5ed01272018-05-27 08:35:50 -0400339 sigset_t mask;
Al Viro7d197ed2013-02-24 01:41:39 -0500340
341 if (sigsetsize != sizeof(compat_sigset_t))
342 return -EINVAL;
Al Viro5ed01272018-05-27 08:35:50 -0400343 if (get_compat_sigset(&mask, user_mask))
Al Viro7d197ed2013-02-24 01:41:39 -0500344 return -EFAULT;
Al Viro5ed01272018-05-27 08:35:50 -0400345 return do_signalfd4(ufd, &mask, flags);
Al Viro7d197ed2013-02-24 01:41:39 -0500346}
347
Dominik Brodowski570484b2018-03-20 19:36:46 +0100348COMPAT_SYSCALL_DEFINE4(signalfd4, int, ufd,
Al Viro5ed01272018-05-27 08:35:50 -0400349 const compat_sigset_t __user *, user_mask,
Dominik Brodowski570484b2018-03-20 19:36:46 +0100350 compat_size_t, sigsetsize,
351 int, flags)
352{
Al Viro5ed01272018-05-27 08:35:50 -0400353 return do_compat_signalfd4(ufd, user_mask, sigsetsize, flags);
Dominik Brodowski570484b2018-03-20 19:36:46 +0100354}
355
Al Viro7d197ed2013-02-24 01:41:39 -0500356COMPAT_SYSCALL_DEFINE3(signalfd, int, ufd,
Al Viro5ed01272018-05-27 08:35:50 -0400357 const compat_sigset_t __user *, user_mask,
Al Viro7d197ed2013-02-24 01:41:39 -0500358 compat_size_t, sigsetsize)
359{
Al Viro5ed01272018-05-27 08:35:50 -0400360 return do_compat_signalfd4(ufd, user_mask, sigsetsize, 0);
Al Viro7d197ed2013-02-24 01:41:39 -0500361}
362#endif