mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 02:30:34 +02:00 
			
		
		
		
	signals: add from_ancestor_ns parameter to send_signal()
send_signal() (or its helper) needs to determine the pid namespace of the sender. But a signal sent via kill_pid_info_as_uid() comes from within the kernel and send_signal() does not need to determine the pid namespace of the sender. So define a helper for send_signal() which takes an additional parameter, 'from_ancestor_ns' and have kill_pid_info_as_uid() use that helper directly. The 'from_ancestor_ns' parameter will be used in a follow-on patch. Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com> Cc: Oleg Nesterov <oleg@tv-sign.ru> Cc: Roland McGrath <roland@redhat.com> Cc: "Eric W. Biederman" <ebiederm@xmission.com> Cc: Daniel Lezcano <daniel.lezcano@free.fr> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
		
							parent
							
								
									f008faff0e
								
							
						
					
					
						commit
						7978b567d3
					
				
					 1 changed files with 9 additions and 3 deletions
				
			
		| 
						 | 
					@ -823,8 +823,8 @@ static inline int legacy_queue(struct sigpending *signals, int sig)
 | 
				
			||||||
	return (sig < SIGRTMIN) && sigismember(&signals->signal, sig);
 | 
						return (sig < SIGRTMIN) && sigismember(&signals->signal, sig);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int send_signal(int sig, struct siginfo *info, struct task_struct *t,
 | 
					static int __send_signal(int sig, struct siginfo *info, struct task_struct *t,
 | 
				
			||||||
			int group)
 | 
								int group, int from_ancestor_ns)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct sigpending *pending;
 | 
						struct sigpending *pending;
 | 
				
			||||||
	struct sigqueue *q;
 | 
						struct sigqueue *q;
 | 
				
			||||||
| 
						 | 
					@ -899,6 +899,12 @@ static int send_signal(int sig, struct siginfo *info, struct task_struct *t,
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static int send_signal(int sig, struct siginfo *info, struct task_struct *t,
 | 
				
			||||||
 | 
								int group)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						return __send_signal(sig, info, t, group, 0);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int print_fatal_signals;
 | 
					int print_fatal_signals;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void print_fatal_signal(struct pt_regs *regs, int signr)
 | 
					static void print_fatal_signal(struct pt_regs *regs, int signr)
 | 
				
			||||||
| 
						 | 
					@ -1143,7 +1149,7 @@ int kill_pid_info_as_uid(int sig, struct siginfo *info, struct pid *pid,
 | 
				
			||||||
	if (sig && p->sighand) {
 | 
						if (sig && p->sighand) {
 | 
				
			||||||
		unsigned long flags;
 | 
							unsigned long flags;
 | 
				
			||||||
		spin_lock_irqsave(&p->sighand->siglock, flags);
 | 
							spin_lock_irqsave(&p->sighand->siglock, flags);
 | 
				
			||||||
		ret = __group_send_sig_info(sig, info, p);
 | 
							ret = __send_signal(sig, info, p, 1, 0);
 | 
				
			||||||
		spin_unlock_irqrestore(&p->sighand->siglock, flags);
 | 
							spin_unlock_irqrestore(&p->sighand->siglock, flags);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
out_unlock:
 | 
					out_unlock:
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue