Thread (32 messages) flat view 32 messages, 3 authors, 2024-02-21

Re: [PATCH v2 2/2] pidfd: change pidfd_send_signal() to respect PIDFD_THREAD

From: Oleg Nesterov <oleg@redhat.com>
Date: 2024-02-16 13:07:53
Also in: lkml

On 02/16, Christian Brauner wrote:
On Wed, Feb 14, 2024 at 01:36:56PM +0100, Oleg Nesterov wrote:
quoted
and I am not sure that task_pid(current) == pid should allow
the "arbitrary signals" if PIDFD_SIGNAL_PROCESS_GROUP.

Perhaps

	/* Only allow sending arbitrary signals to yourself. */
	ret = -EPERM;
	if ((task_pid(current) != pid || type == PIDTYPE_PGID) &&
	    (kinfo.si_code >= 0 || kinfo.si_code == SI_TKILL)
		goto err;
Honestly, we should probably just do:

if (kinfo->si_code != SI_USER)
        goto err
Hmm. This doesn't look right. The purpose of the current check is to
forbid SI_TKILL and si_code >= 0, and SI_USER == 0.

SI_USER means that the target can trust the values of si_pid/si_uid
in siginfo.
+		if (kinfo.si_code != SI_USER)
 			goto err;
See above...

Oleg.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help