Skip to content

SYSCTL: Use RCU to avoid races with string sysctls

Andi Kleen linux-arch lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest11 patches 11 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/11Add rcustring ADT for RCU protected stringsinclude/linux/rcustring.h lib/Makefile lib/rcustring.c+134 -13 replies
2/11Add a kernel_address() that works for data tooinclude/linux/kernel.h kernel/extable.c+19 -00 replies
3/11SYSCTL: Add proc_rcu_string to manage sysctls using rcu stringsinclude/linux/sysctl.h kernel/sysctl.c kernel/sysctl_check.c+69 -03 replies
4/11SYSCTL: Use RCU strings for core_pattern sysctlfs/exec.c kernel/sysctl.c+7 -80 replies
5/11SYSCTL: Add call_usermodehelper_cleanup()include/linux/kmod.h+10 -10 replies
6/11SYSCTL: Convert modprobe_path to proc_rcu_string()kernel/kmod.c kernel/sysctl.c+30 -100 replies
7/11SYSCTL: Convert poweroff_command to proc_rcu_stringinclude/linux/reboot.h kernel/sys.c kernel/sysctl.c+8 -40 replies
8/11SYSCTL: Convert hotplug helper string to proc_rcu_string()include/linux/kobject.h kernel/sysctl.c lib/kobject_uevent.c+34 -201 reply
9/11SYSCTL: Add a mutex to the page_alloc zone order sysctlmm/page_alloc.c+7 -40 replies
10/11SYSCTL: Use RCU protected sysctl for ocfs group add helperfs/ocfs2/stackglue.c+13 -40 replies
11/11SYSCTL: Convert IRDA text sysctl to RCUnet/irda/irlmp.c net/irda/irsysctl.c+7 -50 replies

Reviews trailers per patch

1 of 11 patches has a Reviewed-by or Acked-by.

PatchGreg Kroah-Hartman
1/11
2/11
3/11
4/11
5/11
6/11
7/11
8/11A-b
9/11
10/11
11/11

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/11] SYSCTL: Use RCU to avoid races with string sysctls

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 also fixed the zone order list sysctl to use a mutex to avoid racing with itself.

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