From b7fbe52c11d0c7b535ba75487d7e0913ede3671b Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Tue, 20 Apr 2004 17:41:53 -0700 Subject: [PATCH] compute_creds race From: Andy Lutomirski Fixes from me, Olaf Dietsche In fs/exec.c, compute_creds does: task_lock(current); if (bprm->e_uid != current->uid || bprm->e_gid != current->gid) { current->mm->dumpable = 0; if (must_not_trace_exec(current) || atomic_read(¤t->fs->count) > 1 || atomic_read(¤t->files->count) > 1 || atomic_read(¤t->sighand->count) > 1) { if(!capable(CAP_SETUID)) { bprm->e_uid = current->uid; bprm->e_gid = current->gid; } } } current->suid = current->euid = current->fsuid = bprm->e_uid; current->sgid = current->egid = current->fsgid = bprm->e_gid; task_unlock(current); security_bprm_compute_creds(bprm); I assume the task_lock is to prevent another process (on SMP or preempt) from ptracing the execing process between the check and the assignment. If that's the concern then the fact that the lock is dropped before the call to security_brpm_compute_creds means that, if security_bprm_compute_creds does anything interesting, there's a race. For my (nearly complete) caps patch, I obviously need to fix this. But I think it may be exploitable now. Suppose there are two processes, A (the malicious code) and B (which uses exec). B starts out unprivileged (A and B have, e.g., uid and euid = 500). 1. A ptraces B. 2. B calls exec on some setuid-root program. 3. in cap_bprm_set_security, B sets bprm->cap_permitted to the full set. 4. B gets to compute_creds in exec.c, calls task_lock, and does not change its uid. 5. B calls task_unlock. 6. A detaches from B (on preempt or SMP). 7. B gets to task_lock in cap_bprm_compute_creds, changes its capabilities, and returns from compute_creds into load_elf_binary. 8. load_elf_binary calls create_elf_tables (line 852 in 2.6.5-mm1), which calls cap_bprm_secureexec (through LSM), which returns false (!). 9. exec finishes. The setuid program is now running with uid=euid=500 but full permitted capabilities. There are two (or three) ways to effectively get local root now: 1. IIRC, linux 2.4 doesn't check capabilities in ptrace, so A could just ptrace B again. 2. LD_PRELOAD. 3. There are probably programs that will misbehave on their own under these circumstances. Is there some reason why this is not doable? The patch renames bprm_compute_creds to bprm_apply_creds and moves all uid logic into the hook, where the test and the resulting modification can both happen under task_lock(). This way, out-of-tree LSMs will fail to compile instead of malfunctioning. It should also make life easier for LSMs and will certainly make it easier for me to finish the cap patch. --- include/linux/security.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'include/linux') diff --git a/include/linux/security.h b/include/linux/security.h index 9baa2ed4ac96..2d16f6577669 100644 --- a/include/linux/security.h +++ b/include/linux/security.h @@ -44,7 +44,7 @@ extern int cap_capget (struct task_struct *target, kernel_cap_t *effective, kern extern int cap_capset_check (struct task_struct *target, kernel_cap_t *effective, kernel_cap_t *inheritable, kernel_cap_t *permitted); extern void cap_capset_set (struct task_struct *target, kernel_cap_t *effective, kernel_cap_t *inheritable, kernel_cap_t *permitted); extern int cap_bprm_set_security (struct linux_binprm *bprm); -extern void cap_bprm_compute_creds (struct linux_binprm *bprm); +extern void cap_bprm_apply_creds (struct linux_binprm *bprm); extern int cap_bprm_secureexec(struct linux_binprm *bprm); extern int cap_inode_setxattr(struct dentry *dentry, char *name, void *value, size_t size, int flags); extern int cap_inode_removexattr(struct dentry *dentry, char *name); @@ -102,7 +102,7 @@ struct swap_info_struct; * @bprm_free_security: * @bprm contains the linux_binprm structure to be modified. * Deallocate and clear the @bprm->security field. - * @bprm_compute_creds: + * @bprm_apply_creds: * Compute and set the security attributes of a process being transformed * by an execve operation based on the old attributes (current->security) * and the information saved in @bprm->security by the set_security hook. @@ -115,7 +115,7 @@ struct swap_info_struct; * @bprm contains the linux_binprm structure. * @bprm_set_security: * Save security information in the bprm->security field, typically based - * on information about the bprm->file, for later use by the compute_creds + * on information about the bprm->file, for later use by the apply_creds * hook. This hook may also optionally check permissions (e.g. for * transitions between security domains). * This hook may be called multiple times during a single execve, e.g. for @@ -924,7 +924,7 @@ struct swap_info_struct; * Check permission before allowing the @parent process to trace the * @child process. * Security modules may also want to perform a process tracing check - * during an execve in the set_security or compute_creds hooks of + * during an execve in the set_security or apply_creds hooks of * binprm_security_ops if the process is being traced and its security * attributes would be changed by the execve. * @parent contains the task_struct structure for parent process. @@ -1026,7 +1026,7 @@ struct security_operations { int (*bprm_alloc_security) (struct linux_binprm * bprm); void (*bprm_free_security) (struct linux_binprm * bprm); - void (*bprm_compute_creds) (struct linux_binprm * bprm); + void (*bprm_apply_creds) (struct linux_binprm * bprm); int (*bprm_set_security) (struct linux_binprm * bprm); int (*bprm_check_security) (struct linux_binprm * bprm); int (*bprm_secureexec) (struct linux_binprm * bprm); @@ -1290,9 +1290,9 @@ static inline void security_bprm_free (struct linux_binprm *bprm) { security_ops->bprm_free_security (bprm); } -static inline void security_bprm_compute_creds (struct linux_binprm *bprm) +static inline void security_bprm_apply_creds (struct linux_binprm *bprm) { - security_ops->bprm_compute_creds (bprm); + security_ops->bprm_apply_creds (bprm); } static inline int security_bprm_set (struct linux_binprm *bprm) { @@ -1962,9 +1962,9 @@ static inline int security_bprm_alloc (struct linux_binprm *bprm) static inline void security_bprm_free (struct linux_binprm *bprm) { } -static inline void security_bprm_compute_creds (struct linux_binprm *bprm) +static inline void security_bprm_apply_creds (struct linux_binprm *bprm) { - cap_bprm_compute_creds (bprm); + cap_bprm_apply_creds (bprm); } static inline int security_bprm_set (struct linux_binprm *bprm) -- cgit v1.2.3 From 137718ec5f67102faf88e87e900d3188936e039b Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Tue, 20 Apr 2004 17:42:39 -0700 Subject: [PATCH] lockfs - vfs bits From: Christoph Hellwig These are the generic lockfs bits. Basically it takes the XFS freezing statemachine into the VFS. It's all behind the kernel-doc documented freeze_bdev and thaw_bdev interfaces. Based on an older patch from Chris Mason. --- fs/block_dev.c | 1 + fs/buffer.c | 71 +++++++++++++++++++++++++++++++++++++++++++++ fs/super.c | 8 +++++ include/linux/buffer_head.h | 2 ++ include/linux/fs.h | 16 ++++++++++ 5 files changed, 98 insertions(+) (limited to 'include/linux') diff --git a/fs/block_dev.c b/fs/block_dev.c index b0314046ec4b..1b43058d8dc0 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c @@ -251,6 +251,7 @@ static void init_once(void * foo, kmem_cache_t * cachep, unsigned long flags) { memset(bdev, 0, sizeof(*bdev)); sema_init(&bdev->bd_sem, 1); + sema_init(&bdev->bd_mount_sem, 1); INIT_LIST_HEAD(&bdev->bd_inodes); INIT_LIST_HEAD(&bdev->bd_list); inode_init_once(&ei->vfs_inode); diff --git a/fs/buffer.c b/fs/buffer.c index 21b8ae31e827..7fc4e91f0ce9 100644 --- a/fs/buffer.c +++ b/fs/buffer.c @@ -227,6 +227,77 @@ int fsync_bdev(struct block_device *bdev) return sync_blockdev(bdev); } +/** + * freeze_bdev -- lock a filesystem and force it into a consistent state + * @bdev: blockdevice to lock + * + * This takes the block device bd_mount_sem to make sure no new mounts + * happen on bdev until thaw_bdev() is called. + * If a superblock is found on this device, we take the s_umount semaphore + * on it to make sure nobody unmounts until the snapshot creation is done. + */ +struct super_block *freeze_bdev(struct block_device *bdev) +{ + struct super_block *sb; + + down(&bdev->bd_mount_sem); + sb = get_super(bdev); + if (sb && !(sb->s_flags & MS_RDONLY)) { + sb->s_frozen = SB_FREEZE_WRITE; + wmb(); + + sync_inodes_sb(sb, 0); + DQUOT_SYNC(sb); + + lock_super(sb); + if (sb->s_dirt && sb->s_op->write_super) + sb->s_op->write_super(sb); + unlock_super(sb); + + if (sb->s_op->sync_fs) + sb->s_op->sync_fs(sb, 1); + + sync_blockdev(sb->s_bdev); + sync_inodes_sb(sb, 1); + + sb->s_frozen = SB_FREEZE_TRANS; + wmb(); + + sync_blockdev(sb->s_bdev); + + if (sb->s_op->write_super_lockfs) + sb->s_op->write_super_lockfs(sb); + } + + sync_blockdev(bdev); + return sb; /* thaw_bdev releases s->s_umount and bd_mount_sem */ +} +EXPORT_SYMBOL(freeze_bdev); + +/** + * thaw_bdev -- unlock filesystem + * @bdev: blockdevice to unlock + * @sb: associated superblock + * + * Unlocks the filesystem and marks it writeable again after freeze_bdev(). + */ +void thaw_bdev(struct block_device *bdev, struct super_block *sb) +{ + if (sb) { + BUG_ON(sb->s_bdev != bdev); + + if (sb->s_op->unlockfs) + sb->s_op->unlockfs(sb); + sb->s_frozen = SB_UNFROZEN; + wmb(); + wake_up(&sb->s_wait_unfrozen); + drop_super(sb); + } + + up(&bdev->bd_mount_sem); +} +EXPORT_SYMBOL(thaw_bdev); + /* * sync everything. Start out by waking pdflush, because that writes back * all queues in parallel. diff --git a/fs/super.c b/fs/super.c index f20abf04f8a5..e62838940bc7 100644 --- a/fs/super.c +++ b/fs/super.c @@ -77,6 +77,7 @@ static struct super_block *alloc_super(void) sema_init(&s->s_dquot.dqio_sem, 1); sema_init(&s->s_dquot.dqonoff_sem, 1); init_rwsem(&s->s_dquot.dqptr_sem); + init_waitqueue_head(&s->s_wait_unfrozen); s->s_maxbytes = MAX_NON_LFS; s->dq_op = sb_dquot_ops; s->s_qcop = sb_quotactl_ops; @@ -623,7 +624,14 @@ struct super_block *get_sb_bdev(struct file_system_type *fs_type, if (IS_ERR(bdev)) return (struct super_block *)bdev; + /* + * once the super is inserted into the list by sget, s_umount + * will protect the lockfs code from trying to start a snapshot + * while we are mounting + */ + down(&bdev->bd_mount_sem); s = sget(fs_type, test_bdev_super, set_bdev_super, bdev); + up(&bdev->bd_mount_sem); if (IS_ERR(s)) goto out; diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h index ebe0b1221579..99cb4139354b 100644 --- a/include/linux/buffer_head.h +++ b/include/linux/buffer_head.h @@ -157,6 +157,8 @@ void __wait_on_buffer(struct buffer_head *); wait_queue_head_t *bh_waitq_head(struct buffer_head *bh); void wake_up_buffer(struct buffer_head *bh); int fsync_bdev(struct block_device *); +struct super_block *freeze_bdev(struct block_device *); +void thaw_bdev(struct block_device *, struct super_block *); int fsync_super(struct super_block *); int fsync_no_super(struct block_device *); struct buffer_head *__find_get_block(struct block_device *, sector_t, int); diff --git a/include/linux/fs.h b/include/linux/fs.h index ed06629b972e..8971ae34dbdf 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -345,6 +345,7 @@ struct block_device { struct inode * bd_inode; /* will die */ int bd_openers; struct semaphore bd_sem; /* open/close mutex */ + struct semaphore bd_mount_sem; /* mount mutex */ struct list_head bd_inodes; void * bd_holder; int bd_holders; @@ -749,6 +750,9 @@ struct super_block { struct list_head s_instances; struct quota_info s_dquot; /* Diskquota specific options */ + int s_frozen; + wait_queue_head_t s_wait_unfrozen; + char s_id[32]; /* Informational name */ void *s_fs_info; /* Filesystem private info */ @@ -760,6 +764,18 @@ struct super_block { struct semaphore s_vfs_rename_sem; /* Kludge */ }; +/* + * Snapshotting support. + */ +enum { + SB_UNFROZEN = 0, + SB_FREEZE_WRITE = 1, + SB_FREEZE_TRANS = 2, +}; + +#define vfs_check_frozen(sb, level) \ + wait_event((sb)->s_wait_unfrozen, ((sb)->s_frozen < (level))) + /* * Superblock locking. */ -- cgit v1.2.3 From 014df416805b44b22d335e376ac30d6b6fc301b5 Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Tue, 20 Apr 2004 17:43:30 -0700 Subject: [PATCH] i4l: add compat ioctl's for CAPI From: Marcel Holtmann This patch adds the needed compat ioctl's for the CAPI on 64bit platforms. --- fs/compat_ioctl.c | 4 +++- include/linux/compat_ioctl.h | 16 +++++++++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) (limited to 'include/linux') diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c index de45d833d0f4..56ef9138e9cc 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c @@ -70,8 +70,10 @@ #include /* siocdevprivate_ioctl */ #include -#include #include +#include + +#include #include /* Ugly hack. */ diff --git a/include/linux/compat_ioctl.h b/include/linux/compat_ioctl.h index 278c533b6994..aa9733c90045 100644 --- a/include/linux/compat_ioctl.h +++ b/include/linux/compat_ioctl.h @@ -597,7 +597,7 @@ COMPATIBLE_IOCTL(RNDGETPOOL) COMPATIBLE_IOCTL(RNDADDENTROPY) COMPATIBLE_IOCTL(RNDZAPENTCNT) COMPATIBLE_IOCTL(RNDCLEARPOOL) -/* Bluetooth ioctls */ +/* Bluetooth */ COMPATIBLE_IOCTL(HCIDEVUP) COMPATIBLE_IOCTL(HCIDEVDOWN) COMPATIBLE_IOCTL(HCIDEVRESET) @@ -631,6 +631,20 @@ COMPATIBLE_IOCTL(CMTPCONNADD) COMPATIBLE_IOCTL(CMTPCONNDEL) COMPATIBLE_IOCTL(CMTPGETCONNLIST) COMPATIBLE_IOCTL(CMTPGETCONNINFO) +/* CAPI */ +COMPATIBLE_IOCTL(CAPI_REGISTER) +COMPATIBLE_IOCTL(CAPI_GET_MANUFACTURER) +COMPATIBLE_IOCTL(CAPI_GET_VERSION) +COMPATIBLE_IOCTL(CAPI_GET_SERIAL) +COMPATIBLE_IOCTL(CAPI_GET_PROFILE) +COMPATIBLE_IOCTL(CAPI_MANUFACTURER_CMD) +COMPATIBLE_IOCTL(CAPI_GET_ERRCODE) +COMPATIBLE_IOCTL(CAPI_INSTALLED) +COMPATIBLE_IOCTL(CAPI_GET_FLAGS) +COMPATIBLE_IOCTL(CAPI_SET_FLAGS) +COMPATIBLE_IOCTL(CAPI_CLR_FLAGS) +COMPATIBLE_IOCTL(CAPI_NCCI_OPENCOUNT) +COMPATIBLE_IOCTL(CAPI_NCCI_GETUNIT) /* Misc. */ COMPATIBLE_IOCTL(0x41545900) /* ATYIO_CLKR */ COMPATIBLE_IOCTL(0x41545901) /* ATYIO_CLKW */ -- cgit v1.2.3 From d8932719104b259b0c15633d8766c872621eb851 Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Wed, 21 Apr 2004 23:34:05 -0700 Subject: [PATCH] remove show_trace_task() It no longer has any callers. --- arch/alpha/kernel/traps.c | 12 ------------ arch/arm26/kernel/traps.c | 12 ------------ arch/cris/kernel/traps.c | 8 -------- arch/h8300/kernel/traps.c | 6 ------ arch/i386/kernel/traps.c | 10 ---------- arch/mips/kernel/traps.c | 5 ----- arch/parisc/kernel/traps.c | 5 ----- arch/ppc64/kernel/process.c | 6 ------ arch/s390/kernel/traps.c | 11 ----------- arch/sh/kernel/traps.c | 6 ------ arch/sparc64/kernel/traps.c | 7 ------- arch/um/kernel/sysrq.c | 11 ----------- arch/v850/kernel/process.c | 7 ------- arch/x86_64/kernel/traps.c | 10 ---------- include/linux/sched.h | 1 - 15 files changed, 117 deletions(-) (limited to 'include/linux') diff --git a/arch/alpha/kernel/traps.c b/arch/alpha/kernel/traps.c index 8906f66b65e7..52348791ce1e 100644 --- a/arch/alpha/kernel/traps.c +++ b/arch/alpha/kernel/traps.c @@ -137,18 +137,6 @@ dik_show_trace(unsigned long *sp) printk("\n"); } -void show_trace_task(struct task_struct * tsk) -{ - struct thread_info *ti = tsk->thread_info; - unsigned long fp, sp = ti->pcb.ksp, base = (unsigned long) ti; - - if (sp > base && sp+6*8 < base + 16*1024) { - fp = ((unsigned long*)sp)[6]; - if (fp > sp && fp < base + 16*1024) - dik_show_trace((unsigned long *)fp); - } -} - static int kstack_depth_to_print = 24; void show_stack(struct task_struct *task, unsigned long *sp) diff --git a/arch/arm26/kernel/traps.c b/arch/arm26/kernel/traps.c index d2ffd9016c07..f0a49fec0d9e 100644 --- a/arch/arm26/kernel/traps.c +++ b/arch/arm26/kernel/traps.c @@ -165,18 +165,6 @@ void dump_backtrace(struct pt_regs *regs, struct task_struct *tsk) c_backtrace(fp, processor_mode(regs)); } -/* - * This is called from SysRq-T (show_task) to display the current - * call trace for each process. Very useful. - */ -void show_trace_task(struct task_struct *tsk) -{ - if (tsk != current) { - unsigned int fp = thread_saved_fp(tsk); - c_backtrace(fp, 0x10); - } -} - /* FIXME - this is probably wrong.. */ void show_stack(struct task_struct *task, unsigned long *sp) { dump_mem("Stack: ", (unsigned long)sp, 8192+(unsigned long)task->thread_info); diff --git a/arch/cris/kernel/traps.c b/arch/cris/kernel/traps.c index 2a757b825c44..d9e6565655f4 100644 --- a/arch/cris/kernel/traps.c +++ b/arch/cris/kernel/traps.c @@ -60,14 +60,6 @@ void show_trace(unsigned long * stack) } } -void show_trace_task(struct task_struct *tsk) -{ - /* TODO, this is not really useful since its called from - * SysRq-T and we don't have a keyboard.. :) - */ -} - - /* * These constants are for searching for possible module text * segments. MODULE_RANGE is a guess of how much space is likely diff --git a/arch/h8300/kernel/traps.c b/arch/h8300/kernel/traps.c index 300e3279ca5a..253c87bc5b32 100644 --- a/arch/h8300/kernel/traps.c +++ b/arch/h8300/kernel/traps.c @@ -156,14 +156,8 @@ void show_stack(struct task_struct *task, unsigned long *esp) printk("\n"); } -void show_trace_task(struct task_struct *tsk) -{ - show_stack(tsk,(unsigned long *)tsk->thread.esp0); -} - void dump_stack(void) { show_stack(NULL,NULL); } - EXPORT_SYMBOL(dump_stack); diff --git a/arch/i386/kernel/traps.c b/arch/i386/kernel/traps.c index cf8da7ba4cdb..c770d878cbcf 100644 --- a/arch/i386/kernel/traps.c +++ b/arch/i386/kernel/traps.c @@ -123,16 +123,6 @@ void show_trace(struct task_struct *task, unsigned long * stack) printk("\n"); } -void show_trace_task(struct task_struct *tsk) -{ - unsigned long esp = tsk->thread.esp; - - /* User space on another CPU? */ - if ((esp ^ (unsigned long)tsk->thread_info) & ~(THREAD_SIZE - 1)) - return; - show_trace(tsk, (unsigned long *)esp); -} - void show_stack(struct task_struct *task, unsigned long *esp) { unsigned long *stack; diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c index d72026927fec..752dbd3e93fb 100644 --- a/arch/mips/kernel/traps.c +++ b/arch/mips/kernel/traps.c @@ -126,11 +126,6 @@ void show_trace(struct task_struct *task, unsigned long *stack) printk("\n"); } -void show_trace_task(struct task_struct *tsk) -{ - show_trace(tsk, (long *)tsk->thread.reg29); -} - /* * The architecture-independent dump_stack generator */ diff --git a/arch/parisc/kernel/traps.c b/arch/parisc/kernel/traps.c index f83053a37644..6f1f6f738d6c 100644 --- a/arch/parisc/kernel/traps.c +++ b/arch/parisc/kernel/traps.c @@ -202,11 +202,6 @@ void show_trace(struct task_struct *task, unsigned long *stack) printk("\n"); } -void show_trace_task(struct task_struct *tsk) -{ - show_trace(tsk, (unsigned long *)tsk->thread.regs.ksp); -} - void die_if_kernel(char *str, struct pt_regs *regs, long err) { if (user_mode(regs)) { diff --git a/arch/ppc64/kernel/process.c b/arch/ppc64/kernel/process.c index f74b14d7e58e..7c153dc24895 100644 --- a/arch/ppc64/kernel/process.c +++ b/arch/ppc64/kernel/process.c @@ -536,10 +536,4 @@ void dump_stack(void) { show_stack(current, (unsigned long *)__get_SP()); } - EXPORT_SYMBOL(dump_stack); - -void show_trace_task(struct task_struct *tsk) -{ - show_stack(tsk, (unsigned long *)tsk->thread.ksp); -} diff --git a/arch/s390/kernel/traps.c b/arch/s390/kernel/traps.c index d778f98a2c7c..016eb6cd48c9 100644 --- a/arch/s390/kernel/traps.c +++ b/arch/s390/kernel/traps.c @@ -105,17 +105,6 @@ void show_trace(struct task_struct *task, unsigned long * stack) printk("\n"); } -void show_trace_task(struct task_struct *tsk) -{ - /* - * We can't print the backtrace of a running process. It is - * unreliable at best and can cause kernel oopses. - */ - if (tsk->state == TASK_RUNNING) - return; - show_trace(tsk, (unsigned long *) tsk->thread.ksp); -} - void show_stack(struct task_struct *task, unsigned long *sp) { unsigned long *stack; diff --git a/arch/sh/kernel/traps.c b/arch/sh/kernel/traps.c index 5211a375afa8..3e63d8a70ed3 100644 --- a/arch/sh/kernel/traps.c +++ b/arch/sh/kernel/traps.c @@ -705,14 +705,8 @@ void show_task(unsigned long *sp) show_stack(NULL, sp); } -void show_trace_task(struct task_struct *tsk) -{ - show_task((unsigned long *)tsk->thread.sp); -} - void dump_stack(void) { show_stack(NULL, NULL); } - EXPORT_SYMBOL(dump_stack); diff --git a/arch/sparc64/kernel/traps.c b/arch/sparc64/kernel/traps.c index 3cf8af39ac95..47d685193ade 100644 --- a/arch/sparc64/kernel/traps.c +++ b/arch/sparc64/kernel/traps.c @@ -1760,13 +1760,6 @@ void show_stack(struct task_struct *tsk, unsigned long *_ksp) #endif } -void show_trace_task(struct task_struct *tsk) -{ - if (tsk) - show_stack(tsk, - (unsigned long *) tsk->thread_info->ksp); -} - void dump_stack(void) { unsigned long *ksp; diff --git a/arch/um/kernel/sysrq.c b/arch/um/kernel/sysrq.c index 078dc11132d3..ce108f7d6971 100644 --- a/arch/um/kernel/sysrq.c +++ b/arch/um/kernel/sysrq.c @@ -42,19 +42,8 @@ void dump_stack(void) show_trace(&stack); } - EXPORT_SYMBOL(dump_stack); -void show_trace_task(struct task_struct *tsk) -{ - unsigned long esp = PT_REGS_SP(&tsk->thread.regs); - - /* User space on another CPU? */ - if ((esp ^ (unsigned long)tsk) & (PAGE_MASK<<1)) - return; - show_trace((unsigned long *)esp); -} - /* * Overrides for Emacs so that we follow Linus's tabbing style. * Emacs will notice this stuff at the end of the file and automatically diff --git a/arch/v850/kernel/process.c b/arch/v850/kernel/process.c index 977d75772d81..2fccb4cc7b82 100644 --- a/arch/v850/kernel/process.c +++ b/arch/v850/kernel/process.c @@ -234,10 +234,3 @@ unsigned long get_wchan (struct task_struct *p) return 0; } - -void show_trace_task (struct task_struct *t) -{ - /* blarg XXX */ - printk ("show_trace_task: KSP = 0x%lx, USP = 0x%lx, UPC = 0x%lx\n", - t->thread.ksp, KSTK_ESP (t), KSTK_EIP (t)); -} diff --git a/arch/x86_64/kernel/traps.c b/arch/x86_64/kernel/traps.c index 5afe235c0474..2efdbaa1ecfa 100644 --- a/arch/x86_64/kernel/traps.c +++ b/arch/x86_64/kernel/traps.c @@ -197,16 +197,6 @@ void show_trace(unsigned long *stack) printk("\n"); } -void show_trace_task(struct task_struct *tsk) -{ - unsigned long rsp = tsk->thread.rsp; - - /* User space on another CPU? */ - if ((rsp ^ (unsigned long)tsk->thread_info) & (PAGE_MASK<<1)) - return; - show_trace((unsigned long *)rsp); -} - void show_stack(struct task_struct *tsk, unsigned long * rsp) { unsigned long *stack; diff --git a/include/linux/sched.h b/include/linux/sched.h index 428b48964fc8..e414003e872b 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -151,7 +151,6 @@ extern void init_idle(task_t *idle, int cpu); extern void show_state(void); extern void show_regs(struct pt_regs *); -extern void show_trace_task(task_t *tsk); /* * TASK is a pointer to the task whose backtrace we want to see (or NULL for current -- cgit v1.2.3 From e5c7f247d6701be52bb10044db6dfbb1099135e4 Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Wed, 21 Apr 2004 23:36:19 -0700 Subject: [PATCH] dynamic proc cleanups From: Matt Mackall Delete obsolete comment and kill test of obsolete define. --- arch/alpha/kernel/irq.c | 14 +++++--------- include/linux/proc_fs.h | 2 -- 2 files changed, 5 insertions(+), 11 deletions(-) (limited to 'include/linux') diff --git a/arch/alpha/kernel/irq.c b/arch/alpha/kernel/irq.c index 0e317230f81e..c51bf8dbfc8a 100644 --- a/arch/alpha/kernel/irq.c +++ b/arch/alpha/kernel/irq.c @@ -415,16 +415,12 @@ init_irq_proc (void) #endif /* - * Create entries for all existing IRQs. If the number of IRQs - * is greater the 1/4 the total dynamic inode space for /proc, - * don't pollute the inode space + * Create entries for all existing IRQs. */ - if (ACTUAL_NR_IRQS < (PROC_NDYNAMIC / 4)) { - for (i = 0; i < ACTUAL_NR_IRQS; i++) { - if (irq_desc[i].handler == &no_irq_type) - continue; - register_irq_proc(i); - } + for (i = 0; i < ACTUAL_NR_IRQS; i++) { + if (irq_desc[i].handler == &no_irq_type) + continue; + register_irq_proc(i); } } diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h index 0b12bd800fd1..2d439a8390c0 100644 --- a/include/linux/proc_fs.h +++ b/include/linux/proc_fs.h @@ -24,8 +24,6 @@ enum { PROC_ROOT_INO = 1, }; -/* Finally, the dynamically allocatable proc entries are reserved: */ - #define PROC_SUPER_MAGIC 0x9fa0 /* -- cgit v1.2.3 From 32419a40f3a9a700dba410e717476c67f79b2b0e Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Wed, 21 Apr 2004 23:38:04 -0700 Subject: [PATCH] sunrpc rmmod oops fix From: "J. Bruce Fields" Unregister svcauth_gss caches on exit from gss module; fixes an oops on rmmod. --- include/linux/sunrpc/svcauth_gss.h | 1 + net/sunrpc/auth_gss/auth_gss.c | 1 + net/sunrpc/auth_gss/svcauth_gss.c | 7 +++++++ 3 files changed, 9 insertions(+) (limited to 'include/linux') diff --git a/include/linux/sunrpc/svcauth_gss.h b/include/linux/sunrpc/svcauth_gss.h index a444c9edb9e9..3a2206f61de0 100644 --- a/include/linux/sunrpc/svcauth_gss.h +++ b/include/linux/sunrpc/svcauth_gss.h @@ -20,6 +20,7 @@ #include int gss_svc_init(void); +void gss_svc_shutdown(void); int svcauth_gss_register_pseudoflavor(u32 pseudoflavor, char * name); #endif /* __KERNEL__ */ diff --git a/net/sunrpc/auth_gss/auth_gss.c b/net/sunrpc/auth_gss/auth_gss.c index b1b922f09257..971124109c8c 100644 --- a/net/sunrpc/auth_gss/auth_gss.c +++ b/net/sunrpc/auth_gss/auth_gss.c @@ -984,6 +984,7 @@ out: static void __exit exit_rpcsec_gss(void) { + gss_svc_shutdown(); gss_mech_unregister_all(); rpcauth_unregister(&authgss_ops); } diff --git a/net/sunrpc/auth_gss/svcauth_gss.c b/net/sunrpc/auth_gss/svcauth_gss.c index a60a541e9f5e..dae18e9792a6 100644 --- a/net/sunrpc/auth_gss/svcauth_gss.c +++ b/net/sunrpc/auth_gss/svcauth_gss.c @@ -1063,3 +1063,10 @@ gss_svc_init(void) svc_auth_register(RPC_AUTH_GSS, &svcauthops_gss); return 0; } + +void +gss_svc_shutdown(void) +{ + cache_unregister(&rsc_cache); + cache_unregister(&rsi_cache); +} -- cgit v1.2.3