.. | .. |
---|
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 | { |
---|
.. | .. |
---|
416 | 416 | { |
---|
417 | 417 | struct pacct_struct *pacct = ¤t->signal->pacct; |
---|
418 | 418 | u64 elapsed, run_time; |
---|
| 419 | + time64_t btime; |
---|
419 | 420 | struct tty_struct *tty; |
---|
420 | 421 | |
---|
421 | 422 | /* |
---|
.. | .. |
---|
448 | 449 | } |
---|
449 | 450 | #endif |
---|
450 | 451 | do_div(elapsed, AHZ); |
---|
451 | | - ac->ac_btime = get_seconds() - elapsed; |
---|
| 452 | + btime = ktime_get_real_seconds() - elapsed; |
---|
| 453 | + ac->ac_btime = clamp_t(time64_t, btime, 0, U32_MAX); |
---|
452 | 454 | #if ACCT_VERSION==2 |
---|
453 | 455 | ac->ac_ahz = AHZ; |
---|
454 | 456 | #endif |
---|
.. | .. |
---|
539 | 541 | if (group_dead && current->mm) { |
---|
540 | 542 | struct vm_area_struct *vma; |
---|
541 | 543 | |
---|
542 | | - down_read(¤t->mm->mmap_sem); |
---|
| 544 | + mmap_read_lock(current->mm); |
---|
543 | 545 | vma = current->mm->mmap; |
---|
544 | 546 | while (vma) { |
---|
545 | 547 | vsize += vma->vm_end - vma->vm_start; |
---|
546 | 548 | vma = vma->vm_next; |
---|
547 | 549 | } |
---|
548 | | - up_read(¤t->mm->mmap_sem); |
---|
| 550 | + mmap_read_unlock(current->mm); |
---|
549 | 551 | } |
---|
550 | 552 | |
---|
551 | 553 | spin_lock_irq(¤t->sighand->siglock); |
---|
.. | .. |
---|
584 | 586 | } |
---|
585 | 587 | |
---|
586 | 588 | /** |
---|
587 | | - * acct_process |
---|
588 | | - * |
---|
589 | | - * handles process accounting for an exiting task |
---|
| 589 | + * acct_process - handles process accounting for an exiting task |
---|
590 | 590 | */ |
---|
591 | 591 | void acct_process(void) |
---|
592 | 592 | { |
---|