Re: [PATCH 3/6] kernel: split syscall restart from signal handling

From: Jens Axboe
Date: Thu Oct 08 2020 - 10:31:38 EST


On 10/8/20 8:21 AM, Oleg Nesterov wrote:
> 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@xxxxxxxxx>
>> ---
>> 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.

Yeah I guess that would be a bit simpler, maybe I'm too focused on
decoupling the two. But if we go this route, and avoid sighand->lock for
just having TIF_NOTIFY_SIGNAL set, then that should be functionally
equivalent as far as I'm concerned.

I'll make the reduction, I'd prefer to keep this as small/simple as
possible initially.

--
Jens Axboe