RFC : Fix for unsafe notifier chain
Get series with b4
b4 am 1132366767.9617.12.camel@linuxchandraVersions newest first
- v1 RFC Latest7 patches 0 repliesNew
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/7 | : Interface change to the notifier chain mechanism - basic fixinclude/ kernel/ | +121 | 0 replies | |
| 2/7 | : simple set of notifier_head definition changesarch/ arch/ arch/ +22 more | +28 | 0 replies | |
| 3/7 | : notifier_head changes with removal of reducdant protectiondrivers/ kernel/ kernel/ +1 more | +13 | 0 replies | |
| 4/7 | : changes notifier head of diechains and add notify_chain_unregisterarch/ arch/ arch/ +7 more | +59 | 0 replies | |
| 5/7 | : Do not unregister from calloutdrivers/ drivers/ | +20 | 0 replies | |
| 6/7 | : Do not register from calloutdrivers/ | +4 | 0 replies | |
| 7/7 | : Use notify call chain mechanism for usb notifiicationdrivers/ | +7 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
Cover letter [RFC][PATCH 0/7]: Fix for unsafe notifier chain
In 2.6.14, notifier chains are unsafe. notifier_call_chain() walks through the list of a call chain without any protection.
Alan Stern <[email protected]> brought the issue and suggested a fix in lkml on Oct 24 2005:
http://marc.theaimsgroup.com/?l=linux-kernel&m=113018709002036&w=2
There was a lot of discussion on that thread regarding the issue, and following were the conclusions about the requirements of the notifier call mechanism:
- The chain list has to be protected in all the places where the list is accessed.
- We need a new notifier_head data structure to encompass the head of the notifier chain and a semaphore that protects the list.
- There should be two types of call chains: one that is called in a process context and another that is called in atomic/interrupt context.
- No lock should be acquired in notifier_call_chain() for an atomic-type chain.
- notifier_chain_register() and notifier_chain_unregister() should be called only from process context.
- notifier_chain_unregister() should _not_ be called from a callout routine.
I posted an RFC that meets the above listed requirements last Friday:
- http://marc.theaimsgroup.com/?l=linux-kernel&m=113175279131346&w=2
Paul McKenney provided some suggestions w.r.t RCU usage. This patchset fixes the issues he raised. Keith Owens posted some changes to the diechain for various architectures; his changes are included here.
This is posted as an RFC as we want to get a green signal from the owners of the files that our classification of chains as ATOMIC or BLOCKING is ok. Please comment.
This patchset has 7 patches:
1 of 7: Changes the definition of the heads. Same as what was posted last
Friday with changes w.r.t Paul's comments.
2 of 7: Changes that affected only the notifier_head definition.
3 of 7: Changes in which we removed some protection (it's no longer needed
as the basic infrastructure itself provides the protection).
4 of 7: changes for diechain for different architectures.
5 of 7: changes removing calls to notifier_unregister in the callout. 6 of 7: changes to dcdbas.c (requires special handling).
7 of 7: changes to make usb_notify to use the notify chain infrastructure
instead of its own.
----------------------------------------
Here are the list of chains and their classification:
BLOCKING:
+++++++++arch/powerpc/platforms/pseries/reconfig.c: pSeries_reconfig_chainarch/s390/kernel/process.c: idle_chaindrivers/base/memory.c: memory_chaindrivers/cpufreq/cpufreq.c: cpufreq_policy_notifier_listdrivers/cpufreq/cpufreq.c: cpufreq_transition_notifier_listdrivers/macintosh/adb.c: adb_client_listdrivers/macintosh/via-pmu.c: sleep_notifier_listdrivers/macintosh/via-pmu68k.c: sleep_notifier_listdrivers/macintosh/windfarm_core.c: wf_client_listdrivers/usb/core/notify.c: usb_notifier_listdrivers/video/fbmem.c: fb_notifier_listkernel/cpu.c: cpu_chainkernel/module.c: module_notify_listkernel/profile.c: munmap_notifierkernel/profile.c: task_exit_notifierkernel/sys.c: reboot_notifier_listnet/core/dev.c: netdev_chainnet/decnet/dn_dev.c: dnaddr_chainnet/ipv4/devinet.c: inetaddr_chain
ATOMIC:
+++++++arch/i386/kernel/traps.c: i386die_chainarch/ia64/kernel/traps.c: ia64die_chainarch/powerpc/kernel/traps.c: powerpc_die_chainarch/sparc64/kernel/traps.c: sparc64die_chainarch/x86_64/kernel/traps.c: die_chaindrivers/char/ipmi/ipmi_si_intf.c: xaction_notifier_listkernel/panic.c: panic_notifier_listkernel/profile.c: task_free_notifiernet/bluetooth/hci_core.c: hci_notifiernet/ipv4/netfilter/ip_conntrack_core.c: ip_conntrack_chainnet/ipv4/netfilter/ip_conntrack_core.c: ip_conntrack_expect_chainnet/ipv6/addrconf.c: inet6addr_chainnet/netfilter/nf_conntrack_core.c: nf_conntrack_chainnen/netfilter/nf_conntrack_core.c: nf_conntrack_expect_chainnet/netlink/af_netlink.c: netlink_chain
Signature · 4 lines
----------------------------------------------------------------------
Chandra Seetharaman | Be careful what you choose....
- [email protected] | .......you may get it.
----------------------------------------------------------------------