Skip to content

make vfork killable

Oleg Nesterov linux-mm lkml 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest3 patches 11 repliesIn review
  2. v18 patches 20 repliesSuperseded

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3vfork: introduce complete_vfork_done()fs/exec.c include/linux/sched.h kernel/fork.c+13 -130 replies
2/3vfork: make it killablekernel/fork.c+32 -82 replies
3/3coredump_wait: don't call complete_vfork_done()fs/exec.c include/linux/sched.h kernel/fork.c+3 -142 replies

Reviews trailers per patch

1 of 3 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchTejun Heo
SeriesA-b
1/3
2/3
3/3A-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH v2 0/3] make vfork killable

Hi Tejun,

Quoted 2 lines · Tejun Heo

If the current implementation is too nasty,

OK, I agree, the patches I sent doesn't look very clear/clean.

But,

Quoted 2 lines

an alternative approach
could be handling vfork waiting as a type of job control stop.

Well, I didn't see the code, but to be honest this doesn't look like a good idea to me. Firstly, personally I do not think this has something to do with the job control stop.

And, to me sys_restart_syscall() looks like the very natural approach, and simple.

Quoted 2 lines

* When entering get_signal_to_deliver(), if vfork child exists, save sigmask and block all blockable signals.

Oh, I'd like to avoid this. Why should we change get_signal_to_deliver() paths to help vfork?

Quoted 2 lines

* When leaving get_signal_to_deliver(), restore sigmask if saved on entry.

And I _think_ we need much more complications. We still need to communicate with the child, for example. Unless we are going to add the "struct completion vfork_done" or something into task_struct, personally I dislike this idea.

Quoted 2 lines

Haven't really thought a lot about the details so this might end up uglier than the current attempt. :)

I _hope_ it is much uglier, but I can be wrong of course ;)

OK. Can't we make the first step at least? Make it killable. I think this will simplify the next changes anyway.

So. This seried makes vfork() killable. No restarts, just s/wait_for_completion/wait_for_completion_killable/ + clear child->vfork_done if killed.

The only overhead this patch adds to CLONE_VFORK

- parent does get_task_struct() + put_task_struct()

- child does task_lock() + task_unlock()

4/3 is off-topic, somehow I hate PF_STARTING irrationally. and it helps to make the diffstat below better ;)

Oleg.

 fs/exec.c             |   18 +-------------
 include/linux/sched.h |    1 -
 kernel/fork.c         |   61 +++++++++++++++++++++++++++++++-----------------
 3 files changed, 41 insertions(+), 39 deletions(-)