| .. | .. |
|---|
| 25 | 25 | * Now we silently close acct_file on attempt to reopen. Cleaned sys_acct(). |
|---|
| 26 | 26 | * XTerms and EMACS are manifestations of pure evil. 21/10/98, AV. |
|---|
| 27 | 27 | * |
|---|
| 28 | | - * Fixed a nasty interaction with with sys_umount(). If the accointing |
|---|
| 28 | + * Fixed a nasty interaction with sys_umount(). If the accounting |
|---|
| 29 | 29 | * was suspeneded we failed to stop it on umount(). Messy. |
|---|
| 30 | 30 | * Another one: remount to readonly didn't stop accounting. |
|---|
| 31 | 31 | * Question: what should we do if we have CAP_SYS_ADMIN but not |
|---|
| .. | .. |
|---|
| 40 | 40 | * is one more bug... 10/11/98, AV. |
|---|
| 41 | 41 | * |
|---|
| 42 | 42 | * Oh, fsck... Oopsable SMP race in do_process_acct() - we must hold |
|---|
| 43 | | - * ->mmap_sem to walk the vma list of current->mm. Nasty, since it leaks |
|---|
| 43 | + * ->mmap_lock to walk the vma list of current->mm. Nasty, since it leaks |
|---|
| 44 | 44 | * a struct file opened for write. Fixed. 2/6/2000, AV. |
|---|
| 45 | 45 | */ |
|---|
| 46 | 46 | |
|---|
| .. | .. |
|---|
| 263 | 263 | * sys_acct - enable/disable process accounting |
|---|
| 264 | 264 | * @name: file name for accounting records or NULL to shutdown accounting |
|---|
| 265 | 265 | * |
|---|
| 266 | | - * Returns 0 for success or negative errno values for failure. |
|---|
| 267 | | - * |
|---|
| 268 | 266 | * sys_acct() is the only system call needed to implement process |
|---|
| 269 | 267 | * accounting. It takes the name of the file where accounting records |
|---|
| 270 | 268 | * should be written. If the filename is NULL, accounting will be |
|---|
| 271 | 269 | * shutdown. |
|---|
| 270 | + * |
|---|
| 271 | + * Returns: 0 for success or negative errno values for failure. |
|---|
| 272 | 272 | */ |
|---|
| 273 | 273 | SYSCALL_DEFINE1(acct, const char __user *, name) |
|---|
| 274 | 274 | { |
|---|
| .. | .. |
|---|
| 331 | 331 | exp++; |
|---|
| 332 | 332 | } |
|---|
| 333 | 333 | |
|---|
| 334 | + if (exp > (((comp_t) ~0U) >> MANTSIZE)) |
|---|
| 335 | + return (comp_t) ~0U; |
|---|
| 334 | 336 | /* |
|---|
| 335 | 337 | * Clean it up and polish it off. |
|---|
| 336 | 338 | */ |
|---|
| .. | .. |
|---|
| 416 | 418 | { |
|---|
| 417 | 419 | struct pacct_struct *pacct = ¤t->signal->pacct; |
|---|
| 418 | 420 | u64 elapsed, run_time; |
|---|
| 421 | + time64_t btime; |
|---|
| 419 | 422 | struct tty_struct *tty; |
|---|
| 420 | 423 | |
|---|
| 421 | 424 | /* |
|---|
| .. | .. |
|---|
| 448 | 451 | } |
|---|
| 449 | 452 | #endif |
|---|
| 450 | 453 | do_div(elapsed, AHZ); |
|---|
| 451 | | - ac->ac_btime = get_seconds() - elapsed; |
|---|
| 454 | + btime = ktime_get_real_seconds() - elapsed; |
|---|
| 455 | + ac->ac_btime = clamp_t(time64_t, btime, 0, U32_MAX); |
|---|
| 452 | 456 | #if ACCT_VERSION==2 |
|---|
| 453 | 457 | ac->ac_ahz = AHZ; |
|---|
| 454 | 458 | #endif |
|---|
| .. | .. |
|---|
| 539 | 543 | if (group_dead && current->mm) { |
|---|
| 540 | 544 | struct vm_area_struct *vma; |
|---|
| 541 | 545 | |
|---|
| 542 | | - down_read(¤t->mm->mmap_sem); |
|---|
| 546 | + mmap_read_lock(current->mm); |
|---|
| 543 | 547 | vma = current->mm->mmap; |
|---|
| 544 | 548 | while (vma) { |
|---|
| 545 | 549 | vsize += vma->vm_end - vma->vm_start; |
|---|
| 546 | 550 | vma = vma->vm_next; |
|---|
| 547 | 551 | } |
|---|
| 548 | | - up_read(¤t->mm->mmap_sem); |
|---|
| 552 | + mmap_read_unlock(current->mm); |
|---|
| 549 | 553 | } |
|---|
| 550 | 554 | |
|---|
| 551 | 555 | spin_lock_irq(¤t->sighand->siglock); |
|---|
| .. | .. |
|---|
| 584 | 588 | } |
|---|
| 585 | 589 | |
|---|
| 586 | 590 | /** |
|---|
| 587 | | - * acct_process |
|---|
| 588 | | - * |
|---|
| 589 | | - * handles process accounting for an exiting task |
|---|
| 591 | + * acct_process - handles process accounting for an exiting task |
|---|
| 590 | 592 | */ |
|---|
| 591 | 593 | void acct_process(void) |
|---|
| 592 | 594 | { |
|---|