.. | .. |
---|
92 | 92 | #include <linux/user_namespace.h> |
---|
93 | 93 | #include <linux/fs_struct.h> |
---|
94 | 94 | |
---|
95 | | -#include <asm/pgtable.h> |
---|
96 | 95 | #include <asm/processor.h> |
---|
97 | 96 | #include "internal.h" |
---|
98 | 97 | |
---|
.. | .. |
---|
248 | 247 | seq_putc(m, '\n'); |
---|
249 | 248 | } |
---|
250 | 249 | |
---|
251 | | -static void collect_sigign_sigcatch(struct task_struct *p, sigset_t *ign, |
---|
252 | | - sigset_t *catch) |
---|
| 250 | +static void collect_sigign_sigcatch(struct task_struct *p, sigset_t *sigign, |
---|
| 251 | + sigset_t *sigcatch) |
---|
253 | 252 | { |
---|
254 | 253 | struct k_sigaction *k; |
---|
255 | 254 | int i; |
---|
.. | .. |
---|
257 | 256 | k = p->sighand->action; |
---|
258 | 257 | for (i = 1; i <= _NSIG; ++i, ++k) { |
---|
259 | 258 | if (k->sa.sa_handler == SIG_IGN) |
---|
260 | | - sigaddset(ign, i); |
---|
| 259 | + sigaddset(sigign, i); |
---|
261 | 260 | else if (k->sa.sa_handler != SIG_DFL) |
---|
262 | | - sigaddset(catch, i); |
---|
| 261 | + sigaddset(sigcatch, i); |
---|
263 | 262 | } |
---|
264 | 263 | } |
---|
265 | 264 | |
---|
.. | .. |
---|
342 | 341 | seq_put_decimal_ull(m, "NoNewPrivs:\t", task_no_new_privs(p)); |
---|
343 | 342 | #ifdef CONFIG_SECCOMP |
---|
344 | 343 | seq_put_decimal_ull(m, "\nSeccomp:\t", p->seccomp.mode); |
---|
| 344 | +#ifdef CONFIG_SECCOMP_FILTER |
---|
| 345 | + seq_put_decimal_ull(m, "\nSeccomp_filters:\t", |
---|
| 346 | + atomic_read(&p->seccomp.filter_count)); |
---|
345 | 347 | #endif |
---|
346 | | - seq_printf(m, "\nSpeculation_Store_Bypass:\t"); |
---|
| 348 | +#endif |
---|
| 349 | + seq_puts(m, "\nSpeculation_Store_Bypass:\t"); |
---|
347 | 350 | switch (arch_prctl_spec_ctrl_get(p, PR_SPEC_STORE_BYPASS)) { |
---|
348 | 351 | case -EINVAL: |
---|
349 | | - seq_printf(m, "unknown"); |
---|
| 352 | + seq_puts(m, "unknown"); |
---|
350 | 353 | break; |
---|
351 | 354 | case PR_SPEC_NOT_AFFECTED: |
---|
352 | | - seq_printf(m, "not vulnerable"); |
---|
| 355 | + seq_puts(m, "not vulnerable"); |
---|
353 | 356 | break; |
---|
354 | 357 | case PR_SPEC_PRCTL | PR_SPEC_FORCE_DISABLE: |
---|
355 | | - seq_printf(m, "thread force mitigated"); |
---|
| 358 | + seq_puts(m, "thread force mitigated"); |
---|
356 | 359 | break; |
---|
357 | 360 | case PR_SPEC_PRCTL | PR_SPEC_DISABLE: |
---|
358 | | - seq_printf(m, "thread mitigated"); |
---|
| 361 | + seq_puts(m, "thread mitigated"); |
---|
359 | 362 | break; |
---|
360 | 363 | case PR_SPEC_PRCTL | PR_SPEC_ENABLE: |
---|
361 | | - seq_printf(m, "thread vulnerable"); |
---|
| 364 | + seq_puts(m, "thread vulnerable"); |
---|
362 | 365 | break; |
---|
363 | 366 | case PR_SPEC_DISABLE: |
---|
364 | | - seq_printf(m, "globally mitigated"); |
---|
| 367 | + seq_puts(m, "globally mitigated"); |
---|
365 | 368 | break; |
---|
366 | 369 | default: |
---|
367 | | - seq_printf(m, "vulnerable"); |
---|
| 370 | + seq_puts(m, "vulnerable"); |
---|
368 | 371 | break; |
---|
369 | 372 | } |
---|
370 | 373 | seq_putc(m, '\n'); |
---|
.. | .. |
---|
392 | 395 | seq_putc(m, '\n'); |
---|
393 | 396 | } |
---|
394 | 397 | |
---|
| 398 | +static inline void task_thp_status(struct seq_file *m, struct mm_struct *mm) |
---|
| 399 | +{ |
---|
| 400 | + bool thp_enabled = IS_ENABLED(CONFIG_TRANSPARENT_HUGEPAGE); |
---|
| 401 | + |
---|
| 402 | + if (thp_enabled) |
---|
| 403 | + thp_enabled = !test_bit(MMF_DISABLE_THP, &mm->flags); |
---|
| 404 | + seq_printf(m, "THP_enabled:\t%d\n", thp_enabled); |
---|
| 405 | +} |
---|
| 406 | + |
---|
395 | 407 | int proc_pid_status(struct seq_file *m, struct pid_namespace *ns, |
---|
396 | 408 | struct pid *pid, struct task_struct *task) |
---|
397 | 409 | { |
---|
.. | .. |
---|
406 | 418 | if (mm) { |
---|
407 | 419 | task_mem(m, mm); |
---|
408 | 420 | task_core_dumping(m, mm); |
---|
| 421 | + task_thp_status(m, mm); |
---|
409 | 422 | mmput(mm); |
---|
410 | 423 | } |
---|
411 | 424 | task_sig(m, task); |
---|
.. | .. |
---|
523 | 536 | nice = task_nice(task); |
---|
524 | 537 | |
---|
525 | 538 | /* convert nsec -> ticks */ |
---|
526 | | - start_time = nsec_to_clock_t(task->real_start_time); |
---|
| 539 | + start_time = nsec_to_clock_t(task->start_boottime); |
---|
527 | 540 | |
---|
528 | 541 | seq_put_decimal_ull(m, "", pid_nr_ns(pid, ns)); |
---|
529 | 542 | seq_puts(m, " ("); |
---|
.. | .. |
---|
625 | 638 | int proc_pid_statm(struct seq_file *m, struct pid_namespace *ns, |
---|
626 | 639 | struct pid *pid, struct task_struct *task) |
---|
627 | 640 | { |
---|
628 | | - unsigned long size = 0, resident = 0, shared = 0, text = 0, data = 0; |
---|
629 | 641 | struct mm_struct *mm = get_task_mm(task); |
---|
630 | 642 | |
---|
631 | 643 | if (mm) { |
---|
| 644 | + unsigned long size; |
---|
| 645 | + unsigned long resident = 0; |
---|
| 646 | + unsigned long shared = 0; |
---|
| 647 | + unsigned long text = 0; |
---|
| 648 | + unsigned long data = 0; |
---|
| 649 | + |
---|
632 | 650 | size = task_statm(mm, &shared, &text, &data, &resident); |
---|
633 | 651 | mmput(mm); |
---|
634 | | - } |
---|
635 | | - /* |
---|
636 | | - * For quick read, open code by putting numbers directly |
---|
637 | | - * expected format is |
---|
638 | | - * seq_printf(m, "%lu %lu %lu %lu 0 %lu 0\n", |
---|
639 | | - * size, resident, shared, text, data); |
---|
640 | | - */ |
---|
641 | | - seq_put_decimal_ull(m, "", size); |
---|
642 | | - seq_put_decimal_ull(m, " ", resident); |
---|
643 | | - seq_put_decimal_ull(m, " ", shared); |
---|
644 | | - seq_put_decimal_ull(m, " ", text); |
---|
645 | | - seq_put_decimal_ull(m, " ", 0); |
---|
646 | | - seq_put_decimal_ull(m, " ", data); |
---|
647 | | - seq_put_decimal_ull(m, " ", 0); |
---|
648 | | - seq_putc(m, '\n'); |
---|
649 | 652 | |
---|
| 653 | + /* |
---|
| 654 | + * For quick read, open code by putting numbers directly |
---|
| 655 | + * expected format is |
---|
| 656 | + * seq_printf(m, "%lu %lu %lu %lu 0 %lu 0\n", |
---|
| 657 | + * size, resident, shared, text, data); |
---|
| 658 | + */ |
---|
| 659 | + seq_put_decimal_ull(m, "", size); |
---|
| 660 | + seq_put_decimal_ull(m, " ", resident); |
---|
| 661 | + seq_put_decimal_ull(m, " ", shared); |
---|
| 662 | + seq_put_decimal_ull(m, " ", text); |
---|
| 663 | + seq_put_decimal_ull(m, " ", 0); |
---|
| 664 | + seq_put_decimal_ull(m, " ", data); |
---|
| 665 | + seq_put_decimal_ull(m, " ", 0); |
---|
| 666 | + seq_putc(m, '\n'); |
---|
| 667 | + } else { |
---|
| 668 | + seq_write(m, "0 0 0 0 0 0 0\n", 14); |
---|
| 669 | + } |
---|
650 | 670 | return 0; |
---|
651 | 671 | } |
---|
652 | 672 | |
---|
.. | .. |
---|
711 | 731 | { |
---|
712 | 732 | struct inode *inode = file_inode(seq->file); |
---|
713 | 733 | |
---|
714 | | - seq_printf(seq, "%d ", pid_nr_ns(v, proc_pid_ns(inode))); |
---|
| 734 | + seq_printf(seq, "%d ", pid_nr_ns(v, proc_pid_ns(inode->i_sb))); |
---|
715 | 735 | return 0; |
---|
716 | 736 | } |
---|
717 | 737 | |
---|