diff options
author | Dave Kleikamp <shaggy@austin.ibm.com> | 2006-01-24 15:34:47 -0500 |
---|---|---|
committer | Dave Kleikamp <shaggy@austin.ibm.com> | 2006-01-24 15:34:47 -0500 |
commit | 0a0fc0ddbe732779366ab6b1b879f62195e65967 (patch) | |
tree | 7b42490a676cf39ae0691b6859ecf7fd410f229b /fs/exec.c | |
parent | 4d5dbd0945d9e0833dd7964a3d6ee33157f7cc7a (diff) | |
parent | 3ee68c4af3fd7228c1be63254b9f884614f9ebb2 (diff) |
Merge with /home/shaggy/git/linus-clean/
Diffstat (limited to 'fs/exec.c')
-rw-r--r-- | fs/exec.c | 44 |
1 files changed, 17 insertions, 27 deletions
@@ -306,9 +306,6 @@ void install_arg_page(struct vm_area_struct *vma, | |||
306 | struct page *page, unsigned long address) | 306 | struct page *page, unsigned long address) |
307 | { | 307 | { |
308 | struct mm_struct *mm = vma->vm_mm; | 308 | struct mm_struct *mm = vma->vm_mm; |
309 | pgd_t * pgd; | ||
310 | pud_t * pud; | ||
311 | pmd_t * pmd; | ||
312 | pte_t * pte; | 309 | pte_t * pte; |
313 | spinlock_t *ptl; | 310 | spinlock_t *ptl; |
314 | 311 | ||
@@ -316,14 +313,7 @@ void install_arg_page(struct vm_area_struct *vma, | |||
316 | goto out; | 313 | goto out; |
317 | 314 | ||
318 | flush_dcache_page(page); | 315 | flush_dcache_page(page); |
319 | pgd = pgd_offset(mm, address); | 316 | pte = get_locked_pte(mm, address, &ptl); |
320 | pud = pud_alloc(mm, pgd, address); | ||
321 | if (!pud) | ||
322 | goto out; | ||
323 | pmd = pmd_alloc(mm, pud, address); | ||
324 | if (!pmd) | ||
325 | goto out; | ||
326 | pte = pte_alloc_map_lock(mm, pmd, address, &ptl); | ||
327 | if (!pte) | 317 | if (!pte) |
328 | goto out; | 318 | goto out; |
329 | if (!pte_none(*pte)) { | 319 | if (!pte_none(*pte)) { |
@@ -334,7 +324,7 @@ void install_arg_page(struct vm_area_struct *vma, | |||
334 | lru_cache_add_active(page); | 324 | lru_cache_add_active(page); |
335 | set_pte_at(mm, address, pte, pte_mkdirty(pte_mkwrite(mk_pte( | 325 | set_pte_at(mm, address, pte, pte_mkdirty(pte_mkwrite(mk_pte( |
336 | page, vma->vm_page_prot)))); | 326 | page, vma->vm_page_prot)))); |
337 | page_add_anon_rmap(page, vma, address); | 327 | page_add_new_anon_rmap(page, vma, address); |
338 | pte_unmap_unlock(pte, ptl); | 328 | pte_unmap_unlock(pte, ptl); |
339 | 329 | ||
340 | /* no need for flush_tlb */ | 330 | /* no need for flush_tlb */ |
@@ -487,7 +477,7 @@ struct file *open_exec(const char *name) | |||
487 | int err; | 477 | int err; |
488 | struct file *file; | 478 | struct file *file; |
489 | 479 | ||
490 | err = path_lookup_open(name, LOOKUP_FOLLOW, &nd, FMODE_READ); | 480 | err = path_lookup_open(AT_FDCWD, name, LOOKUP_FOLLOW, &nd, FMODE_READ); |
491 | file = ERR_PTR(err); | 481 | file = ERR_PTR(err); |
492 | 482 | ||
493 | if (!err) { | 483 | if (!err) { |
@@ -585,7 +575,7 @@ static int exec_mmap(struct mm_struct *mm) | |||
585 | * disturbing other processes. (Other processes might share the signal | 575 | * disturbing other processes. (Other processes might share the signal |
586 | * table via the CLONE_SIGHAND option to clone().) | 576 | * table via the CLONE_SIGHAND option to clone().) |
587 | */ | 577 | */ |
588 | static inline int de_thread(struct task_struct *tsk) | 578 | static int de_thread(struct task_struct *tsk) |
589 | { | 579 | { |
590 | struct signal_struct *sig = tsk->signal; | 580 | struct signal_struct *sig = tsk->signal; |
591 | struct sighand_struct *newsighand, *oldsighand = tsk->sighand; | 581 | struct sighand_struct *newsighand, *oldsighand = tsk->sighand; |
@@ -642,10 +632,10 @@ static inline int de_thread(struct task_struct *tsk) | |||
642 | * synchronize with any firing (by calling del_timer_sync) | 632 | * synchronize with any firing (by calling del_timer_sync) |
643 | * before we can safely let the old group leader die. | 633 | * before we can safely let the old group leader die. |
644 | */ | 634 | */ |
645 | sig->real_timer.data = (unsigned long)current; | 635 | sig->real_timer.data = current; |
646 | spin_unlock_irq(lock); | 636 | spin_unlock_irq(lock); |
647 | if (del_timer_sync(&sig->real_timer)) | 637 | if (hrtimer_cancel(&sig->real_timer)) |
648 | add_timer(&sig->real_timer); | 638 | hrtimer_restart(&sig->real_timer); |
649 | spin_lock_irq(lock); | 639 | spin_lock_irq(lock); |
650 | } | 640 | } |
651 | while (atomic_read(&sig->count) > count) { | 641 | while (atomic_read(&sig->count) > count) { |
@@ -668,7 +658,7 @@ static inline int de_thread(struct task_struct *tsk) | |||
668 | if (!thread_group_leader(current)) { | 658 | if (!thread_group_leader(current)) { |
669 | struct task_struct *parent; | 659 | struct task_struct *parent; |
670 | struct dentry *proc_dentry1, *proc_dentry2; | 660 | struct dentry *proc_dentry1, *proc_dentry2; |
671 | unsigned long exit_state, ptrace; | 661 | unsigned long ptrace; |
672 | 662 | ||
673 | /* | 663 | /* |
674 | * Wait for the thread group leader to be a zombie. | 664 | * Wait for the thread group leader to be a zombie. |
@@ -726,15 +716,15 @@ static inline int de_thread(struct task_struct *tsk) | |||
726 | list_del(¤t->tasks); | 716 | list_del(¤t->tasks); |
727 | list_add_tail(¤t->tasks, &init_task.tasks); | 717 | list_add_tail(¤t->tasks, &init_task.tasks); |
728 | current->exit_signal = SIGCHLD; | 718 | current->exit_signal = SIGCHLD; |
729 | exit_state = leader->exit_state; | 719 | |
720 | BUG_ON(leader->exit_state != EXIT_ZOMBIE); | ||
721 | leader->exit_state = EXIT_DEAD; | ||
730 | 722 | ||
731 | write_unlock_irq(&tasklist_lock); | 723 | write_unlock_irq(&tasklist_lock); |
732 | spin_unlock(&leader->proc_lock); | 724 | spin_unlock(&leader->proc_lock); |
733 | spin_unlock(¤t->proc_lock); | 725 | spin_unlock(¤t->proc_lock); |
734 | proc_pid_flush(proc_dentry1); | 726 | proc_pid_flush(proc_dentry1); |
735 | proc_pid_flush(proc_dentry2); | 727 | proc_pid_flush(proc_dentry2); |
736 | |||
737 | BUG_ON(exit_state != EXIT_ZOMBIE); | ||
738 | } | 728 | } |
739 | 729 | ||
740 | /* | 730 | /* |
@@ -770,7 +760,7 @@ no_thread_group: | |||
770 | spin_lock(&oldsighand->siglock); | 760 | spin_lock(&oldsighand->siglock); |
771 | spin_lock(&newsighand->siglock); | 761 | spin_lock(&newsighand->siglock); |
772 | 762 | ||
773 | current->sighand = newsighand; | 763 | rcu_assign_pointer(current->sighand, newsighand); |
774 | recalc_sigpending(); | 764 | recalc_sigpending(); |
775 | 765 | ||
776 | spin_unlock(&newsighand->siglock); | 766 | spin_unlock(&newsighand->siglock); |
@@ -778,7 +768,7 @@ no_thread_group: | |||
778 | write_unlock_irq(&tasklist_lock); | 768 | write_unlock_irq(&tasklist_lock); |
779 | 769 | ||
780 | if (atomic_dec_and_test(&oldsighand->count)) | 770 | if (atomic_dec_and_test(&oldsighand->count)) |
781 | kmem_cache_free(sighand_cachep, oldsighand); | 771 | sighand_free(oldsighand); |
782 | } | 772 | } |
783 | 773 | ||
784 | BUG_ON(!thread_group_leader(current)); | 774 | BUG_ON(!thread_group_leader(current)); |
@@ -790,7 +780,7 @@ no_thread_group: | |||
790 | * so that a new one can be started | 780 | * so that a new one can be started |
791 | */ | 781 | */ |
792 | 782 | ||
793 | static inline void flush_old_files(struct files_struct * files) | 783 | static void flush_old_files(struct files_struct * files) |
794 | { | 784 | { |
795 | long j = -1; | 785 | long j = -1; |
796 | struct fdtable *fdt; | 786 | struct fdtable *fdt; |
@@ -974,7 +964,7 @@ int prepare_binprm(struct linux_binprm *bprm) | |||
974 | 964 | ||
975 | EXPORT_SYMBOL(prepare_binprm); | 965 | EXPORT_SYMBOL(prepare_binprm); |
976 | 966 | ||
977 | static inline int unsafe_exec(struct task_struct *p) | 967 | static int unsafe_exec(struct task_struct *p) |
978 | { | 968 | { |
979 | int unsafe = 0; | 969 | int unsafe = 0; |
980 | if (p->ptrace & PT_PTRACED) { | 970 | if (p->ptrace & PT_PTRACED) { |
@@ -1472,6 +1462,7 @@ int do_coredump(long signr, int exit_code, struct pt_regs * regs) | |||
1472 | if (!(current->signal->flags & SIGNAL_GROUP_EXIT)) { | 1462 | if (!(current->signal->flags & SIGNAL_GROUP_EXIT)) { |
1473 | current->signal->flags = SIGNAL_GROUP_EXIT; | 1463 | current->signal->flags = SIGNAL_GROUP_EXIT; |
1474 | current->signal->group_exit_code = exit_code; | 1464 | current->signal->group_exit_code = exit_code; |
1465 | current->signal->group_stop_count = 0; | ||
1475 | retval = 0; | 1466 | retval = 0; |
1476 | } | 1467 | } |
1477 | spin_unlock_irq(¤t->sighand->siglock); | 1468 | spin_unlock_irq(¤t->sighand->siglock); |
@@ -1487,7 +1478,6 @@ int do_coredump(long signr, int exit_code, struct pt_regs * regs) | |||
1487 | * Clear any false indication of pending signals that might | 1478 | * Clear any false indication of pending signals that might |
1488 | * be seen by the filesystem code called to write the core file. | 1479 | * be seen by the filesystem code called to write the core file. |
1489 | */ | 1480 | */ |
1490 | current->signal->group_stop_count = 0; | ||
1491 | clear_thread_flag(TIF_SIGPENDING); | 1481 | clear_thread_flag(TIF_SIGPENDING); |
1492 | 1482 | ||
1493 | if (current->signal->rlim[RLIMIT_CORE].rlim_cur < binfmt->min_coredump) | 1483 | if (current->signal->rlim[RLIMIT_CORE].rlim_cur < binfmt->min_coredump) |
@@ -1515,7 +1505,7 @@ int do_coredump(long signr, int exit_code, struct pt_regs * regs) | |||
1515 | goto close_fail; | 1505 | goto close_fail; |
1516 | if (!file->f_op->write) | 1506 | if (!file->f_op->write) |
1517 | goto close_fail; | 1507 | goto close_fail; |
1518 | if (do_truncate(file->f_dentry, 0, file) != 0) | 1508 | if (do_truncate(file->f_dentry, 0, 0, file) != 0) |
1519 | goto close_fail; | 1509 | goto close_fail; |
1520 | 1510 | ||
1521 | retval = binfmt->core_dump(signr, regs, file); | 1511 | retval = binfmt->core_dump(signr, regs, file); |