kernel-ark/include
Alexey Dobriyan 786d7e1612 Fix rmmod/read/write races in /proc entries
Fix following races:
===========================================
1. Write via ->write_proc sleeps in copy_from_user(). Module disappears
   meanwhile. Or, more generically, system call done on /proc file, method
   supplied by module is called, module dissapeares meanwhile.

   pde = create_proc_entry()
   if (!pde)
	return -ENOMEM;
   pde->write_proc = ...
				open
				write
				copy_from_user
   pde = create_proc_entry();
   if (!pde) {
	remove_proc_entry();
	return -ENOMEM;
	/* module unloaded */
   }
				*boom*
==========================================
2. bogo-revoke aka proc_kill_inodes()

  remove_proc_entry		vfs_read
  proc_kill_inodes		[check ->f_op validness]
				[check ->f_op->read validness]
				[verify_area, security permissions checks]
	->f_op = NULL;
				if (file->f_op->read)
					/* ->f_op dereference, boom */

NOTE, NOTE, NOTE: file_operations are proxied for regular files only. Let's
see how this scheme behaves, then extend if needed for directories.
Directories creators in /proc only set ->owner for them, so proxying for
directories may be unneeded.

NOTE, NOTE, NOTE: methods being proxied are ->llseek, ->read, ->write,
->poll, ->unlocked_ioctl, ->ioctl, ->compat_ioctl, ->open, ->release.
If your in-tree module uses something else, yell on me. Full audit pending.

[akpm@linux-foundation.org: build fix]
Signed-off-by: Alexey Dobriyan <adobriyan@sw.ru>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-07-16 09:05:39 -07:00
..
acpi Pull osi-now into release branch 2007-06-02 01:02:09 -04:00
asm-alpha fix alpha ISA support 2007-07-16 09:05:37 -07:00
asm-arm page table handling cleanup 2007-07-16 09:05:36 -07:00
asm-arm26 ARM26: enable arbitary speed tty ioctls and split input/output speed 2007-07-16 09:05:38 -07:00
asm-avr32 page table handling cleanup 2007-07-16 09:05:36 -07:00
asm-blackfin Blackfin arch: Add peripheral io API to gpio header file 2007-07-12 17:06:45 +08:00
asm-cris etrax: enable arbitary speed setting on tty ports 2007-07-16 09:05:38 -07:00
asm-frv FRV: Connect up new syscalls 2007-07-16 09:05:37 -07:00
asm-generic sched: simplify sched_find_first_bit() 2007-07-09 18:52:00 +02:00
asm-h8300 h8300 entry.S update 2007-07-16 09:05:37 -07:00
asm-i386 kill vmalloc_earlyreserve 2007-07-16 09:05:36 -07:00
asm-ia64 page table handling cleanup 2007-07-16 09:05:36 -07:00
asm-m32r m32r: enable arbitary speed tty rate setting 2007-07-16 09:05:38 -07:00
asm-m68k page table handling cleanup 2007-07-16 09:05:36 -07:00
asm-m68knommu PCI: remove pci_dac_dma_... APIs 2007-07-11 16:02:11 -07:00
asm-mips page table handling cleanup 2007-07-16 09:05:36 -07:00
asm-parisc page table handling cleanup 2007-07-16 09:05:36 -07:00
asm-powerpc page table handling cleanup 2007-07-16 09:05:36 -07:00
asm-ppc page table handling cleanup 2007-07-16 09:05:36 -07:00
asm-s390 page table handling cleanup 2007-07-16 09:05:36 -07:00
asm-sh page table handling cleanup 2007-07-16 09:05:36 -07:00
asm-sh64 page table handling cleanup 2007-07-16 09:05:36 -07:00
asm-sparc page table handling cleanup 2007-07-16 09:05:36 -07:00
asm-sparc64 page table handling cleanup 2007-07-16 09:05:36 -07:00
asm-um Add generic exit-time stack-depth checking to CONFIG_DEBUG_STACK_USAGE 2007-07-16 09:05:38 -07:00
asm-v850 v850: enable arbitary speed tty ioctls 2007-07-16 09:05:39 -07:00
asm-x86_64 page table handling cleanup 2007-07-16 09:05:36 -07:00
asm-xtensa page table handling cleanup 2007-07-16 09:05:36 -07:00
crypto
keys
linux Fix rmmod/read/write races in /proc entries 2007-07-16 09:05:39 -07:00
math-emu
media
mtd
net Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6 2007-07-15 16:50:46 -07:00
pcmcia PCMCIA-NETDEV : add new ID of lan&modem multifunction card 2007-07-08 22:16:39 -04:00
rdma IB/cm: Include HCA ACK delay in local ACK timeout 2007-07-10 21:50:05 -07:00
rxrpc
scsi [SCSI] Remove unused method scsi_device_cancel 2007-07-14 16:01:16 -05:00
sound [ALSA] version 1.0.14 2007-05-31 11:03:27 +02:00
video
Kbuild