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

Commit a610d6e6 authored by Al Viro's avatar Al Viro
Browse files

pull clearing RESTORE_SIGMASK into block_sigmask()



Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 5754f412
Loading
Loading
Loading
Loading
+0 −5
Original line number Diff line number Diff line
@@ -481,11 +481,6 @@ handle_signal(int sig, struct k_sigaction *ka, siginfo_t *info,
		return;
	}
	block_sigmask(ka, sig);
	/* A signal was successfully delivered, and the
	   saved sigmask was stored on the signal frame,
	   and will be restored by sigreturn.  So we can
	   simply clear the restore sigmask flag.  */
	clear_thread_flag(TIF_RESTORE_SIGMASK);
}

static inline void
+3 −15
Original line number Diff line number Diff line
@@ -528,7 +528,7 @@ setup_rt_frame(int usig, struct k_sigaction *ka, siginfo_t *info,
/*
 * OK, we're invoking a handler
 */	
static int
static void
handle_signal(unsigned long sig, struct k_sigaction *ka,
	      siginfo_t *info, struct pt_regs *regs)
{
@@ -559,17 +559,14 @@ handle_signal(unsigned long sig, struct k_sigaction *ka,

	if (ret != 0) {
		force_sigsegv(sig, tsk);
		return ret;
		return;
	}

	/*
	 * Block the signal if we were successful.
	 */
	block_sigmask(ka, sig);

	tracehook_signal_handler(sig, info, ka, regs, 0);

	return 0;
}

/*
@@ -633,16 +630,7 @@ static void do_signal(struct pt_regs *regs, int syscall)
			clear_thread_flag(TIF_SYSCALL_RESTARTSYS);
		}

		if (handle_signal(signr, &ka, &info, regs) == 0) {
			/*
			 * A signal was successfully delivered; the saved
			 * sigmask will have been stored in the signal frame,
			 * and will be restored by sigreturn, so we can simply
			 * clear the TIF_RESTORE_SIGMASK flag.
			 */
			if (test_thread_flag(TIF_RESTORE_SIGMASK))
				clear_thread_flag(TIF_RESTORE_SIGMASK);
		}
		handle_signal(signr, &ka, &info, regs);
		return;
	}

+4 −7
Original line number Diff line number Diff line
@@ -238,16 +238,13 @@ handle_signal(unsigned long sig, struct k_sigaction *ka, siginfo_t *info,
	 */
	ret |= !valid_user_regs(regs);

	if (ret != 0) {
		force_sigsegv(sig, current);
		return;
	}

	/*
	 * Block the signal if we were successful.
	 */
	if (ret != 0)
		force_sigsegv(sig, current);
	else
		block_sigmask(ka, sig);
	clear_thread_flag(TIF_RESTORE_SIGMASK);
}

/*
+7 −17
Original line number Diff line number Diff line
@@ -247,7 +247,7 @@ handle_restart(struct pt_regs *regs, struct k_sigaction *ka, int has_handler)
/*
 * OK, we're invoking a handler
 */
static int
static void
handle_signal(int sig, siginfo_t *info, struct k_sigaction *ka,
	      struct pt_regs *regs)
{
@@ -260,11 +260,12 @@ handle_signal(int sig, siginfo_t *info, struct k_sigaction *ka,

	/* set up the stack frame */
	ret = setup_rt_frame(sig, ka, info, sigmask_to_save(), regs);
	if (ret)
		return;

	if (ret == 0)
	block_sigmask(ka, sig);

	return ret;
	tracehook_signal_handler(sig, info, ka, regs,
			test_thread_flag(TIF_SINGLESTEP));
}

/*
@@ -290,18 +291,7 @@ asmlinkage void do_signal(struct pt_regs *regs)
	signr = get_signal_to_deliver(&info, &ka, regs, NULL);
	if (signr > 0) {
		/* Whee!  Actually deliver the signal.  */
		if (handle_signal(signr, &info, &ka, regs) == 0) {
			/* a signal was successfully delivered; the saved
			 * sigmask will have been stored in the signal frame,
			 * and will be restored by sigreturn, so we can simply
			 * clear the TIF_RESTORE_SIGMASK flag */
			if (test_thread_flag(TIF_RESTORE_SIGMASK))
				clear_thread_flag(TIF_RESTORE_SIGMASK);

			tracehook_signal_handler(signr, &info, &ka, regs,
				test_thread_flag(TIF_SINGLESTEP));
		}

		handle_signal(signr, &info, &ka, regs);
		return;
	}

+6 −17
Original line number Diff line number Diff line
@@ -248,7 +248,7 @@ handle_restart(struct pt_regs *regs, struct k_sigaction *ka, int has_handler)
/*
 * handle the actual delivery of a signal to userspace
 */
static int handle_signal(int sig,
static void handle_signal(int sig,
			 siginfo_t *info, struct k_sigaction *ka,
			 struct pt_regs *regs, int syscall)
{
@@ -277,11 +277,10 @@ static int handle_signal(int sig,
	}

	/* Set up the stack frame */
	ret = setup_rt_frame(sig, ka, info, sigmask_to_save(), regs);
	if (ret == 0)
	if (setup_rt_frame(sig, ka, info, sigmask_to_save(), regs) < 0)
		return;
	block_sigmask(ka, sig);

	return ret;
	tracehook_signal_handler(sig, info, ka, regs, 0);
}

/*
@@ -300,17 +299,7 @@ static void do_signal(struct pt_regs *regs, int syscall)

	signr = get_signal_to_deliver(&info, &ka, regs, NULL);
	if (signr > 0) {
		if (handle_signal(signr, &info, &ka, regs, syscall) == 0) {
			/* a signal was successfully delivered; the saved
			 * sigmask will have been stored in the signal frame,
			 * and will be restored by sigreturn, so we can simply
			 * clear the TIF_RESTORE_SIGMASK flag */
			if (test_thread_flag(TIF_RESTORE_SIGMASK))
				clear_thread_flag(TIF_RESTORE_SIGMASK);

			tracehook_signal_handler(signr, &info, &ka, regs, 0);
		}

		handle_signal(signr, &info, &ka, regs, syscall);
		return;
	}

Loading