lkml.org 
[lkml]   [2020]   [Oct]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH 3/6] kernel: split syscall restart from signal handling
On 10/05, Jens Axboe wrote:
>
> Move the restart syscall logic into a separate generic entry helper,
> and handle that part separately from signal checking and delivery.
>
> This is in preparation for being able to do syscall restarting
> independently from handling signals.
>
> Signed-off-by: Jens Axboe <axboe@kernel.dk>
> ---
> arch/x86/kernel/signal.c | 32 ++++++++++++++++++--------------
> include/linux/entry-common.h | 14 ++++++++++++--
> kernel/entry/common.c | 11 ++++++++---
> 3 files changed, 38 insertions(+), 19 deletions(-)

Can't we avoid this patch and the and simplify the change in
exit_to_user_mode_loop() from the next patch? Can't the much more simple
patch below work?

Then later we can even change arch_do_signal() to accept the additional
argument, ti_work, so that it can use ti_work & TIF_NOTIFY_SIGNAL/SIGPENDING
instead of test_thread_flag/task_sigpending.

Oleg.

--- x/arch/x86/kernel/signal.c
+++ x/arch/x86/kernel/signal.c
@@ -808,7 +808,10 @@ void arch_do_signal(struct pt_regs *regs
{
struct ksignal ksig;

- if (get_signal(&ksig)) {
+ if (test_thread_flag(TIF_NOTIFY_SIGNAL))
+ tracehook_notify_signal();
+
+ if (task_sigpending(current) && get_signal(&ksig)) {
/* Whee! Actually deliver the signal. */
handle_signal(&ksig, regs);
return;
--- x/kernel/entry/common.c
+++ x/kernel/entry/common.c
@@ -155,7 +155,7 @@ static unsigned long exit_to_user_mode_l
if (ti_work & _TIF_PATCH_PENDING)
klp_update_patch_state(current);

- if (ti_work & _TIF_SIGPENDING)
+ if (ti_work & (_TIF_SIGPENDING | _TIF_NOTIFY_SIGNAL)
arch_do_signal(regs);

if (ti_work & _TIF_NOTIFY_RESUME) {
\
 
 \ /
  Last update: 2020-10-08 16:22    [W:0.161 / U:1.444 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site