linux/include
Stephen Smalley 006ebb40d3 Security: split proc ptrace checking into read vs. attach
Enable security modules to distinguish reading of process state via
proc from full ptrace access by renaming ptrace_may_attach to
ptrace_may_access and adding a mode argument indicating whether only
read access or full attach access is requested.  This allows security
modules to permit access to reading process state without granting
full ptrace access.  The base DAC/capability checking remains unchanged.

Read access to /proc/pid/mem continues to apply a full ptrace attach
check since check_mem_permission() already requires the current task
to already be ptracing the target.  The other ptrace checks within
proc for elements like environ, maps, and fds are changed to pass the
read mode instead of attach.

In the SELinux case, we model such reading of process state as a
reading of a proc file labeled with the target process' label.  This
enables SELinux policy to permit such reading of process state without
permitting control or manipulation of the target process, as there are
a number of cases where programs probe for such information via proc
but do not need to be able to control the target (e.g. procps,
lsof, PolicyKit, ConsoleKit).  At present we have to choose between
allowing full ptrace in policy (more permissive than required/desired)
or breaking functionality (or in some cases just silencing the denials
via dontaudit rules but this can hide genuine attacks).

This version of the patch incorporates comments from Casey Schaufler
(change/replace existing ptrace_may_attach interface, pass access
mode), and Chris Wright (provide greater consistency in the checking).

Note that like their predecessors __ptrace_may_attach and
ptrace_may_attach, the __ptrace_may_access and ptrace_may_access
interfaces use different return value conventions from each other (0
or -errno vs. 1 or 0).  I retained this difference to avoid any
changes to the caller logic but made the difference clearer by
changing the latter interface to return a bool rather than an int and
by adding a comment about it to ptrace.h for any future callers.

Signed-off-by:  Stephen Smalley <sds@tycho.nsa.gov>
Acked-by: Chris Wright <chrisw@sous-sol.org>
Signed-off-by: James Morris <jmorris@namei.org>
2008-07-14 15:01:47 +10:00
..
acpi proper prototype for acpi_processor_tstate_has_changed() 2008-06-11 19:13:46 -04:00
asm-alpha alpha: fix compile error in arch/alpha/mm/init.c 2008-06-23 18:26:04 -07:00
asm-arm [ARM] 5091/1: Add missing bitfield include to regs-lcd.h 2008-06-12 20:49:38 +01:00
asm-avr32 Fix name of Russell King in various comments 2008-07-10 18:04:43 -07:00
asm-blackfin Blackfin Serial Driver: Use timer to poll CTS PIN instead of workqueue. 2008-06-19 17:46:39 +08:00
asm-cris cris: types: use <asm-generic/int-*.h> for the cris architecture 2008-05-02 16:18:20 -07:00
asm-frv frv: fix irqs_disabled() to return an int, not an unsigned long 2008-07-12 14:33:42 -07:00
asm-generic Christoph has moved 2008-07-04 10:40:04 -07:00
asm-h8300 h8300: fix typo in header guard 2008-06-06 11:29:12 -07:00
asm-ia64 [IA64] Fix CONFIG_IA64_SGI_UV build error 2008-06-16 09:02:03 -07:00
asm-m32r asm-m32r/uaccess.h must #include <asm/setup.h> 2008-06-06 11:29:13 -07:00
asm-m68k m68k: Add ext2_find_{first,next}_bit() for ext4 2008-06-12 18:05:39 -07:00
asm-m68knommu m68knommu: rework definition of HZ 2008-05-01 08:08:36 -07:00
asm-mips [MIPS] Fix bug in atomic_sub_if_positive. 2008-07-04 08:22:15 +01:00
asm-mn10300 MN10300: Fix typo in header guard 2008-05-28 07:59:06 -07:00
asm-parisc parisc: fix miscompilation of ip_fast_csum with gcc >= 4.3 2008-06-13 10:49:56 -04:00
asm-powerpc Correct hash flushing from huge_ptep_set_wrprotect() 2008-07-08 09:27:58 -07:00
asm-ppc [POWERPC] ppc: More compile fixes 2008-05-12 22:57:51 +10:00
asm-s390 [S390] protect _PAGE_SPECIAL bit against mprotect 2008-07-08 11:31:15 +02:00
asm-sh sh: fix miscompilation of ip_fast_csum with gcc >= 4.3 2008-06-02 12:40:14 +09:00
asm-sparc sparc: remove CVS keywords 2008-05-20 00:33:44 -07:00
asm-sparc64 sparc64: IO accessors fix 2008-05-30 02:01:28 -07:00
asm-um uml: activate_mm: remove the dead PF_BORROWED_MM check 2008-06-06 11:36:22 -07:00
asm-v850 v850: fix typo in header guard 2008-06-06 11:29:12 -07:00
asm-x86 Merge branch 'x86-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip 2008-07-12 14:34:31 -07:00
asm-xtensa asm-{alpha,h8300,um,v850,xtensa}/param.h: unbreak HZ for userspace 2008-05-14 19:11:14 -07:00
crypto
keys
linux Security: split proc ptrace checking into read vs. attach 2008-07-14 15:01:47 +10:00
math-emu
media V4L/DVB (8092): videodev: simplify and fix standard enumeration 2008-06-26 15:58:57 -03:00
mtd
net net-sched: change tcf_destroy_chain() to clear start of filter list 2008-07-01 19:52:38 -07:00
pcmcia
rdma IB/core: Remove IB_DEVICE_SEND_W_INV capability flag 2008-06-09 09:58:42 -07:00
rxrpc
scsi Merge git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6 2008-05-02 13:52:35 -07:00
sound [ALSA] ac97 - Fix ASUS A9T laptop output 2008-05-30 16:20:42 +02:00
video
xen x86: Make xen use the paravirt clocksource structs and functions 2008-06-24 21:02:32 +03:00
Kbuild