Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 13 May 2019 11:17:32 +0000 (UTC)
From:      Dmitry Chagin <dchagin@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r347521 - stable/11/sys/compat/linux
Message-ID:  <201905131117.x4DBHWe4013530@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: dchagin
Date: Mon May 13 11:17:31 2019
New Revision: 347521
URL: https://svnweb.freebsd.org/changeset/base/347521

Log:
  MFC r346965:
  
  Follow the FreeBSD and implement PDEATH_SIG prctl ops in the Linuxulator.
  It was first introduced in r163734 and missied by me in r283383.

Modified:
  stable/11/sys/compat/linux/linux_emul.c
  stable/11/sys/compat/linux/linux_emul.h
  stable/11/sys/compat/linux/linux_misc.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/compat/linux/linux_emul.c
==============================================================================
--- stable/11/sys/compat/linux/linux_emul.c	Mon May 13 10:43:18 2019	(r347520)
+++ stable/11/sys/compat/linux/linux_emul.c	Mon May 13 11:17:31 2019	(r347521)
@@ -127,7 +127,6 @@ linux_proc_init(struct thread *td, struct thread *newt
 
 		em->em_tid = p->p_pid;
 		em->flags = 0;
-		em->pdeath_signal = 0;
 		em->robust_futexes = NULL;
 		em->child_clear_tid = NULL;
 		em->child_set_tid = NULL;

Modified: stable/11/sys/compat/linux/linux_emul.h
==============================================================================
--- stable/11/sys/compat/linux/linux_emul.h	Mon May 13 10:43:18 2019	(r347520)
+++ stable/11/sys/compat/linux/linux_emul.h	Mon May 13 11:17:31 2019	(r347521)
@@ -40,7 +40,6 @@ struct linux_emuldata {
 	int    *child_set_tid;	/* in clone(): Child's TID to set on clone */
 	int    *child_clear_tid;/* in clone(): Child's TID to clear on exit */
 
-	int	pdeath_signal;		/* parent death signal */
 	int	flags;			/* thread emuldata flags */
 	int	em_tid;			/* thread id */
 

Modified: stable/11/sys/compat/linux/linux_misc.c
==============================================================================
--- stable/11/sys/compat/linux/linux_misc.c	Mon May 13 10:43:18 2019	(r347520)
+++ stable/11/sys/compat/linux/linux_misc.c	Mon May 13 11:17:31 2019	(r347521)
@@ -49,6 +49,7 @@ __FBSDID("$FreeBSD$");
 #include <sys/namei.h>
 #include <sys/priv.h>
 #include <sys/proc.h>
+#include <sys/procctl.h>
 #include <sys/reboot.h>
 #include <sys/racct.h>
 #include <sys/random.h>
@@ -1995,7 +1996,6 @@ linux_prctl(struct thread *td, struct linux_prctl_args
 	int error = 0, max_size;
 	struct proc *p = td->td_proc;
 	char comm[LINUX_MAX_COMM_LEN];
-	struct linux_emuldata *em;
 	int pdeath_signal;
 
 #ifdef DEBUG
@@ -2009,17 +2009,18 @@ linux_prctl(struct thread *td, struct linux_prctl_args
 	case LINUX_PR_SET_PDEATHSIG:
 		if (!LINUX_SIG_VALID(args->arg2))
 			return (EINVAL);
-		em = em_find(td);
-		KASSERT(em != NULL, ("prctl: emuldata not found.\n"));
-		em->pdeath_signal = args->arg2;
-		break;
+		pdeath_signal = linux_to_bsd_signal(args->arg2);
+		return (kern_procctl(td, P_PID, 0, PROC_PDEATHSIG_CTL,
+		    &pdeath_signal));
 	case LINUX_PR_GET_PDEATHSIG:
-		em = em_find(td);
-		KASSERT(em != NULL, ("prctl: emuldata not found.\n"));
-		pdeath_signal = em->pdeath_signal;
-		error = copyout(&pdeath_signal,
+		error = kern_procctl(td, P_PID, 0, PROC_PDEATHSIG_STATUS,
+		    &pdeath_signal);
+		if (error != 0)
+			return (error);
+		pdeath_signal = bsd_to_linux_signal(pdeath_signal);
+		return (copyout(&pdeath_signal,
 		    (void *)(register_t)args->arg2,
-		    sizeof(pdeath_signal));
+		    sizeof(pdeath_signal)));
 		break;
 	case LINUX_PR_GET_KEEPCAPS:
 		/*



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201905131117.x4DBHWe4013530>