alistair23-linux/arch/sh
Frederic Weisbecker b2812d031d hw-breakpoints: Change/Enforce some breakpoints policies
The current policies of breakpoints in x86 and SH are the following:

- task bound breakpoints can only break on userspace addresses
- cpu wide breakpoints can only break on kernel addresses

The former rule prevents ptrace breakpoints to be set to trigger on
kernel addresses, which is good. But as a side effect, we can't
breakpoint on kernel addresses for task bound breakpoints.

The latter rule simply makes no sense, there is no reason why we
can't set breakpoints on userspace while performing cpu bound
profiles.

We want the following new policies:

- task bound breakpoint can set userspace address breakpoints, with
no particular privilege required.
- task bound breakpoints can set kernelspace address breakpoints but
must be privileged to do that.
- cpu bound breakpoints can do what they want as they are privileged
already.

To implement these new policies, this patch checks if we are dealing
with a kernel address breakpoint, if so and if the exclude_kernel
parameter is set, we tell the user that the breakpoint is invalid,
which makes a good generic ptrace protection.
If we don't have exclude_kernel, ensure the user has the right
privileges as kernel breakpoints are quite sensitive (risk of
trap recursion attacks and global performance impacts).

[ Paul Mundt: keep addr space check for sh signal delivery and fix
  double function declaration]

Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Will Deacon <will.deacon@arm.com>
Cc: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com>
Cc: K. Prasad <prasad@linux.vnet.ibm.com>
Cc: Paul Mundt <lethal@linux-sh.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Jason Wessel <jason.wessel@windriver.com>
Cc: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-05-01 04:32:10 +02:00
..
boards sh: ms7724: Add tiny-document for sound 2010-03-23 13:19:34 +09:00
boot arch/sh/boot/compressed/cache.c: Checkpatch cleanup 2010-03-01 11:57:31 +09:00
cchips sh: Fix up hp6xx build. 2010-02-05 17:45:14 +09:00
configs sh: Update ecovec_defconfig 2010-03-29 11:37:49 +09:00
drivers include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
include hw-breakpoints: Change/Enforce some breakpoints policies 2010-05-01 04:32:10 +02:00
kernel hw-breakpoints: Change/Enforce some breakpoints policies 2010-05-01 04:32:10 +02:00
lib arch/sh/lib/libgcc.h: Checkpatch cleanup 2010-03-01 11:57:29 +09:00
lib64
math-emu sh: Move over to dynamically allocated FPU context. 2010-01-13 12:51:40 +09:00
mm Merge branch 'master' into export-slabh 2010-04-05 11:37:28 +09:00
oprofile sh: oprofile: Fix up count size mismatch for common impl. 2009-11-05 17:13:15 +09:00
tools Merge branch 'sh/stable-updates' 2010-01-18 20:47:37 +09:00
Kconfig pci-dma: sh: use include/linux/pci-dma.h 2010-03-12 15:52:41 -08:00
Kconfig.cpu sh: Turn on speculative return for SH7785 and SH7786 2010-02-18 18:54:18 +09:00
Kconfig.debug sh: Remove old early serial console code V2 2009-12-15 12:07:35 +09:00
Makefile sh: mach-titan: Kill off unused PIO port mangling. 2010-01-28 15:08:21 +09:00