diff options
author | Kawai, Hidehiro <hidehiro.kawai.ez@hitachi.com> | 2007-07-19 04:48:27 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-07-19 13:04:46 -0400 |
commit | 6c5d523826dc639df709ed0f88c5d2ce25379652 (patch) | |
tree | ef2fa8cb30266b3a9b047902794e78c583b099da /include | |
parent | 76fdbb25f963de5dc1e308325f0578a2f92b1c2d (diff) |
coredump masking: reimplementation of dumpable using two flags
This patch changes mm_struct.dumpable to a pair of bit flags.
set_dumpable() converts three-value dumpable to two flags and stores it into
lower two bits of mm_struct.flags instead of mm_struct.dumpable.
get_dumpable() behaves in the opposite way.
[akpm@linux-foundation.org: export set_dumpable]
Signed-off-by: Hidehiro Kawai <hidehiro.kawai.ez@hitachi.com>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: David Howells <dhowells@redhat.com>
Cc: Hugh Dickins <hugh@veritas.com>
Cc: Nick Piggin <nickpiggin@yahoo.com.au>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/asm-ia64/processor.h | 4 | ||||
-rw-r--r-- | include/linux/sched.h | 9 |
2 files changed, 10 insertions, 3 deletions
diff --git a/include/asm-ia64/processor.h b/include/asm-ia64/processor.h index db81ba406cef..6251c76437d2 100644 --- a/include/asm-ia64/processor.h +++ b/include/asm-ia64/processor.h | |||
@@ -295,9 +295,9 @@ struct thread_struct { | |||
295 | regs->ar_bspstore = current->thread.rbs_bot; \ | 295 | regs->ar_bspstore = current->thread.rbs_bot; \ |
296 | regs->ar_fpsr = FPSR_DEFAULT; \ | 296 | regs->ar_fpsr = FPSR_DEFAULT; \ |
297 | regs->loadrs = 0; \ | 297 | regs->loadrs = 0; \ |
298 | regs->r8 = current->mm->dumpable; /* set "don't zap registers" flag */ \ | 298 | regs->r8 = get_dumpable(current->mm); /* set "don't zap registers" flag */ \ |
299 | regs->r12 = new_sp - 16; /* allocate 16 byte scratch area */ \ | 299 | regs->r12 = new_sp - 16; /* allocate 16 byte scratch area */ \ |
300 | if (unlikely(!current->mm->dumpable)) { \ | 300 | if (unlikely(!get_dumpable(current->mm))) { \ |
301 | /* \ | 301 | /* \ |
302 | * Zap scratch regs to avoid leaking bits between processes with different \ | 302 | * Zap scratch regs to avoid leaking bits between processes with different \ |
303 | * uid/privileges. \ | 303 | * uid/privileges. \ |
diff --git a/include/linux/sched.h b/include/linux/sched.h index 731edaca8ffd..8dbd08366400 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -345,6 +345,13 @@ typedef unsigned long mm_counter_t; | |||
345 | (mm)->hiwater_vm = (mm)->total_vm; \ | 345 | (mm)->hiwater_vm = (mm)->total_vm; \ |
346 | } while (0) | 346 | } while (0) |
347 | 347 | ||
348 | extern void set_dumpable(struct mm_struct *mm, int value); | ||
349 | extern int get_dumpable(struct mm_struct *mm); | ||
350 | |||
351 | /* mm flags */ | ||
352 | #define MMF_DUMPABLE 0 /* core dump is permitted */ | ||
353 | #define MMF_DUMP_SECURELY 1 /* core file is readable only by root */ | ||
354 | |||
348 | struct mm_struct { | 355 | struct mm_struct { |
349 | struct vm_area_struct * mmap; /* list of VMAs */ | 356 | struct vm_area_struct * mmap; /* list of VMAs */ |
350 | struct rb_root mm_rb; | 357 | struct rb_root mm_rb; |
@@ -402,7 +409,7 @@ struct mm_struct { | |||
402 | unsigned int token_priority; | 409 | unsigned int token_priority; |
403 | unsigned int last_interval; | 410 | unsigned int last_interval; |
404 | 411 | ||
405 | unsigned char dumpable:2; | 412 | unsigned long flags; /* Must use atomic bitops to access the bits */ |
406 | 413 | ||
407 | /* coredumping support */ | 414 | /* coredumping support */ |
408 | int core_waiters; | 415 | int core_waiters; |