Skip to content

kmod: Optional timeout on the wait in call_usermodehelper_exec

Boaz Harrosh linux-fsdevel linux-nfs lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest6 patches 11 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/6kmod: Unexport call_usermodehelper_freeinfo()include/linux/kmod.h kernel/kmod.c+1 -50 replies
2/6kmod: Convert two call sites to call_usermodehelper_fns()kernel/sys.c security/keys/request_key.c+11 -210 replies
3/6kmod: Move call_usermodehelper_fns() to .c file and unexport all it's helpersinclude/linux/kmod.h kernel/kmod.c+24 -310 replies
4/6completion: Add new wait_for_completion_timeout_stateinclude/linux/completion.h kernel/sched/core.c+58 -05 replies
4/6kmod: add new wait_for_completion_timeout_state() helperkernel/kmod.c+40 -00 replies
5/6kmod: Add new call_usermodehelper_timeout() APIfs/exec.c include/linux/kmod.h kernel/kmod.c +2 more+30 -212 replies
6/6kmod: optional: Convert the use of xchg to a krefinclude/linux/kmod.h kernel/kmod.c+20 -271 reply

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCHSET 0/6 version 2] kmod: Optional timeout on the wait in call_usermodehelper_exec

I'm re-sending the timeout optional waiting in call_usermodehelper()

Diff from version 1:
- Rebased on Olegs patches, based on Linus tree as of [e22057c]
- Fix bugs as noted by Oleg Nesterov, Thanks Oleg for looking into this.
- As noted by Oleg it would be cleaner to export from sched/core a new generic wait_for_complition_state() API that encapsulate all the different waits in one API. This is the option-A below.
If the maintainers of kernel/sched/ do not like this API then an option-B is presented as a static implementation in kmod.c.
- As requested By Oleg the convert to kref is optional at the very end and is independent of the timeout changes.
- Added kernel/sched maintainers to the list (as advised by get_maintainers.pl)

Version 1:
My motivation is that I added yet another Kernel dependency on the call_usermodehelper() function and am not completely happy with the error case of having the user-mode program stuck forever. In such case I would like the Kernel part to timeout and properly error recover and clean up. So therefor the proposed 5th patch.

Please review and tell me what you guys think.

List of patches:
[PATCH 1/6] kmod: Unexport call_usermodehelper_freeinfo()

This one has minor conflicts with Tetsuo's patch which ever is applied first.

[PATCH 2/6] kmod: kmod: Convert two call sites to call_usermodehelper_fns()

Fix mem leak in the case of -ENOMEM. Tetsuo what was the optimization you had for this one?

[PATCH 3/6] kmod: kmod: Move call_usermodehelper_fns() to .c file and unexport all it's helpers
Good common sense

[PATCH 4/6 OPTION-A] completion: Add new wait_for_completion_timeout_state [PATCH 4/6 OPTION-B] kmod: {OPTION B} Add new wait_for_completion_timeout_state

These two are interchangeable. I prefer the first one. I don't think kmod will be the only user for long. And it is much cleaner when wait_for_common() is used.
Ingo, Peter, kernel/sched/ people please ack/nack on this approach so we can decide how to advance?

[PATCH 5/6] kmod: Add new call_usermodehelper_timeout() API

And finally my motivation for all this.

[PATCH 6/6] kmod: optional: Convert the use of xchg to a kref

This is optional. I'm including it here since I already had that code when I was not aware of Oleg's xchng patch. whoever is the maintainer of this code should decide. I'm signed on the patch but I don't have strong feelings one way or the other.

Thanks
Boaz