Skip to content

SYSCTL: Use RCU to avoid races with string sysctls v2

Andi Kleen linux-arch lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest9 patches 14 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/9Add rcustring ADT for RCU protected strings v2include/linux/rcustring.h lib/Makefile lib/rcustring.c+137 -17 replies
2/9Add a kernel_address() that works for data tooinclude/linux/kernel.h kernel/extable.c+19 -05 replies
3/9SYSCTL: Add proc_rcu_string to manage sysctls using rcu stringsinclude/linux/sysctl.h kernel/sysctl.c kernel/sysctl_check.c+69 -00 replies
4/9SYSCTL: Use RCU strings for core_pattern sysctlfs/exec.c kernel/sysctl.c+8 -92 replies
5/9SYSCTL: Add call_usermodehelper_cleanup()include/linux/kmod.h+10 -10 replies
6/9SYSCTL: Convert modprobe_path to proc_rcu_string()kernel/kmod.c kernel/sysctl.c+30 -100 replies
7/9SYSCTL: Convert poweroff_command to proc_rcu_stringinclude/linux/reboot.h kernel/sys.c kernel/sysctl.c+8 -40 replies
8/9SYSCTL: Convert hotplug helper string to proc_rcu_string()include/linux/kobject.h kernel/sysctl.c lib/kobject_uevent.c+34 -200 replies
9/9SYSCTL: Use RCU protected sysctl for ocfs group add helperfs/ocfs2/stackglue.c+13 -40 replies

Reviews trailers per patch

2 of 9 patches have a Reviewed-by or Acked-by.

PatchGreg Kroah-HartmanPaul E. McKenney
1/9R-b
2/9
3/9
4/9
5/9
6/9
7/9
8/9A-b
9/9

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

Read the v1 thread

Cover letter [PATCH] [0/9] SYSCTL: Use RCU to avoid races with string sysctls v2

v2 version that addresses all the earlier review comments minus patches that were already merged.

I think this one is ready for merge now. Andrew, could you please take it?

---

With BKL-less sysctls most of the writable string sysctls are racy. There is no locking on the reader side, so a reader could see an inconsistent string or worse miss the terminating null and walk of beyond it.

This patch kit adds a new "rcu string" variant to avoid these problems and convers the racy users. One the writer side the strings are always copied to new memory and the readers use rcu_read_lock() to get a stable view. For readers who access the string over sleeps the reader copies the string.

This is all hidden in a new generic "rcu_string" ADT which can be also used for other purposes.

This finally implements all the letters in RCU, most other users leave out the 'C'.

I left some obscure users in architectures (sparc, mips) alone and audited all of the others. The sparc reboot_cmd one has references to asm files which I didn't want to touch and the mips variant seemd just too obscure.

All the others are not racy.

-Andi