Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 75907d4d authored by Al Viro's avatar Al Viro
Browse files

generic compat_sys_rt_sigqueueinfo()



conditional on GENERIC_COMPAT_RT_SIGQUEUEINFO; by the end of that series
it will become the same thing as COMPAT and conditional will die out.

Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent fe9c1db2
Loading
Loading
Loading
Loading
+3 −0
Original line number Original line Diff line number Diff line
@@ -365,6 +365,9 @@ config GENERIC_COMPAT_RT_SIGPROCMASK
config GENERIC_COMPAT_RT_SIGPENDING
config GENERIC_COMPAT_RT_SIGPENDING
	bool
	bool


config GENERIC_COMPAT_RT_SIGQUEUEINFO
	bool

#
#
# ABI hall of shame
# ABI hall of shame
#
#
+4 −0
Original line number Original line Diff line number Diff line
@@ -602,6 +602,10 @@ asmlinkage long compat_sys_rt_sigprocmask(int how, compat_sigset_t __user *set,
asmlinkage long compat_sys_rt_sigpending(compat_sigset_t __user *uset,
asmlinkage long compat_sys_rt_sigpending(compat_sigset_t __user *uset,
					 compat_size_t sigsetsize);
					 compat_size_t sigsetsize);
#endif
#endif
#ifdef CONFIG_GENERIC_COMPAT_RT_SIGQUEUEINFO
asmlinkage long compat_sys_rt_sigqueueinfo(compat_pid_t pid, int sig,
				struct compat_siginfo __user *uinfo);
#endif
asmlinkage long compat_sys_sysinfo(struct compat_sysinfo __user *info);
asmlinkage long compat_sys_sysinfo(struct compat_sysinfo __user *info);
asmlinkage long compat_sys_ioctl(unsigned int fd, unsigned int cmd,
asmlinkage long compat_sys_ioctl(unsigned int fd, unsigned int cmd,
				 unsigned long arg);
				 unsigned long arg);
+32 −13
Original line number Original line Diff line number Diff line
@@ -2983,6 +2983,22 @@ SYSCALL_DEFINE2(tkill, pid_t, pid, int, sig)
	return do_tkill(0, pid, sig);
	return do_tkill(0, pid, sig);
}
}


static int do_rt_sigqueueinfo(pid_t pid, int sig, siginfo_t *info)
{
	/* Not even root can pretend to send signals from the kernel.
	 * Nor can they impersonate a kill()/tgkill(), which adds source info.
	 */
	if (info->si_code >= 0 || info->si_code == SI_TKILL) {
		/* We used to allow any < 0 si_code */
		WARN_ON_ONCE(info->si_code < 0);
		return -EPERM;
	}
	info->si_signo = sig;

	/* POSIX.1b doesn't mention process groups.  */
	return kill_proc_info(sig, info, pid);
}

/**
/**
 *  sys_rt_sigqueueinfo - send signal information to a signal
 *  sys_rt_sigqueueinfo - send signal information to a signal
 *  @pid: the PID of the thread
 *  @pid: the PID of the thread
@@ -2993,23 +3009,26 @@ SYSCALL_DEFINE3(rt_sigqueueinfo, pid_t, pid, int, sig,
		siginfo_t __user *, uinfo)
		siginfo_t __user *, uinfo)
{
{
	siginfo_t info;
	siginfo_t info;

	if (copy_from_user(&info, uinfo, sizeof(siginfo_t)))
	if (copy_from_user(&info, uinfo, sizeof(siginfo_t)))
		return -EFAULT;
		return -EFAULT;

	return do_rt_sigqueueinfo(pid, sig, &info);
	/* Not even root can pretend to send signals from the kernel.
	 * Nor can they impersonate a kill()/tgkill(), which adds source info.
	 */
	if (info.si_code >= 0 || info.si_code == SI_TKILL) {
		/* We used to allow any < 0 si_code */
		WARN_ON_ONCE(info.si_code < 0);
		return -EPERM;
}
}
	info.si_signo = sig;


	/* POSIX.1b doesn't mention process groups.  */
#ifdef CONFIG_COMPAT
	return kill_proc_info(sig, &info, pid);
#ifdef CONFIG_GENERIC_COMPAT_RT_SIGQUEUEINFO
COMPAT_SYSCALL_DEFINE3(rt_sigqueueinfo,
			compat_pid_t, pid,
			int, sig,
			struct compat_siginfo __user *, uinfo)
{
	siginfo_t info;
	int ret = copy_siginfo_from_user32(&info, uinfo);
	if (unlikely(ret))
		return ret;
	return do_rt_sigqueueinfo(pid, sig, &info);
}
}
#endif
#endif


long do_rt_tgsigqueueinfo(pid_t tgid, pid_t pid, int sig, siginfo_t *info)
long do_rt_tgsigqueueinfo(pid_t tgid, pid_t pid, int sig, siginfo_t *info)
{
{