Add an execve command for kse_thr_interrupt to allow libpthread to
restore signal mask correctly, this is required by POSIX. Reviewed by: deischen
This commit is contained in:
parent
f6b2c4eca5
commit
84e0b075f6
@ -52,6 +52,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include <sys/pioctl.h>
|
||||
#include <sys/namei.h>
|
||||
#include <sys/sf_buf.h>
|
||||
#include <sys/syscallsubr.h>
|
||||
#include <sys/sysent.h>
|
||||
#include <sys/shm.h>
|
||||
#include <sys/sysctl.h>
|
||||
@ -78,8 +79,6 @@ MALLOC_DEFINE(M_PARGS, "proc-args", "Process arguments");
|
||||
static int sysctl_kern_ps_strings(SYSCTL_HANDLER_ARGS);
|
||||
static int sysctl_kern_usrstack(SYSCTL_HANDLER_ARGS);
|
||||
static int sysctl_kern_stackprot(SYSCTL_HANDLER_ARGS);
|
||||
static int kern_execve(struct thread *td, char *fname, char **argv,
|
||||
char **envv, struct mac *mac_p);
|
||||
static int do_execve(struct thread *td, char *fname, char **argv,
|
||||
char **envv, struct mac *mac_p);
|
||||
|
||||
@ -207,7 +206,7 @@ __mac_execve(td, uap)
|
||||
#endif
|
||||
}
|
||||
|
||||
static int
|
||||
int
|
||||
kern_execve(td, fname, argv, envv, mac_p)
|
||||
struct thread *td;
|
||||
char *fname;
|
||||
|
@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include <sys/proc.h>
|
||||
#include <sys/ptrace.h>
|
||||
#include <sys/smp.h>
|
||||
#include <sys/syscallsubr.h>
|
||||
#include <sys/sysproto.h>
|
||||
#include <sys/sched.h>
|
||||
#include <sys/signalvar.h>
|
||||
@ -176,11 +177,13 @@ struct kse_thr_interrupt_args {
|
||||
int
|
||||
kse_thr_interrupt(struct thread *td, struct kse_thr_interrupt_args *uap)
|
||||
{
|
||||
struct kse_execve_args args;
|
||||
struct proc *p;
|
||||
struct thread *td2;
|
||||
struct kse_upcall *ku;
|
||||
struct kse_thr_mailbox *tmbx;
|
||||
uint32_t flags;
|
||||
int error;
|
||||
|
||||
p = td->td_proc;
|
||||
|
||||
@ -256,6 +259,20 @@ kse_thr_interrupt(struct thread *td, struct kse_thr_interrupt_args *uap)
|
||||
}
|
||||
return (0);
|
||||
|
||||
case KSE_INTR_EXECVE:
|
||||
error = copyin((void *)uap->data, &args, sizeof(args));
|
||||
if (error)
|
||||
return (error);
|
||||
error = kern_execve(td, args.path, args.argv, args.envp, NULL);
|
||||
if (error == 0) {
|
||||
PROC_LOCK(p);
|
||||
SIGSETOR(td->td_siglist, args.sigpend);
|
||||
PROC_UNLOCK(p);
|
||||
kern_sigprocmask(td, SIG_SETMASK, &args.sigmask, NULL,
|
||||
0);
|
||||
}
|
||||
return (error);
|
||||
|
||||
default:
|
||||
return (EINVAL);
|
||||
}
|
||||
|
@ -112,6 +112,16 @@ struct kse_mailbox {
|
||||
#define KSE_INTR_SENDSIG 3
|
||||
#define KSE_INTR_SIGEXIT 4
|
||||
#define KSE_INTR_DBSUSPEND 5
|
||||
#define KSE_INTR_EXECVE 6
|
||||
|
||||
struct kse_execve_args {
|
||||
sigset_t sigmask;
|
||||
sigset_t sigpend;
|
||||
char *path;
|
||||
char **argv;
|
||||
char **envp;
|
||||
void *reserved;
|
||||
};
|
||||
|
||||
#ifndef _KERNEL
|
||||
int kse_create(struct kse_mailbox *, int);
|
||||
|
@ -31,6 +31,7 @@
|
||||
#include <sys/signal.h>
|
||||
#include <sys/uio.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/mac.h>
|
||||
|
||||
struct mbuf;
|
||||
struct msghdr;
|
||||
@ -98,6 +99,8 @@ int kern_truncate(struct thread *td, char *path, enum uio_seg pathseg,
|
||||
int kern_unlink(struct thread *td, char *path, enum uio_seg pathseg);
|
||||
int kern_utimes(struct thread *td, char *path, enum uio_seg pathseg,
|
||||
struct timeval *tptr, enum uio_seg tptrseg);
|
||||
int kern_execve(struct thread *td, char *fname, char **argv, char **envv,
|
||||
struct mac *mac_p);
|
||||
|
||||
/* flags for kern_sigaction */
|
||||
#define KSA_OSIGSET 0x0001 /* uses osigact_t */
|
||||
|
Loading…
x
Reference in New Issue
Block a user