No conflicts.
Showing the changes to kernel (20 of 405 files). Show all
Unified · Split
| @@ -205,9 +205,6 @@ async_cookie_t async_schedule_node_domain(async_func_t func, void *data, · 204 unmodified lines | |||
| 205 | atomic_inc(&entry_count); | 205 | atomic_inc(&entry_count); |
| 206 | spin_unlock_irqrestore(&async_lock, flags); | 206 | spin_unlock_irqrestore(&async_lock, flags); |
| 207 | 207 | ||
| 208 | /* mark that this task has queued an async job, used by module init */ | ||
| 209 | current->flags |= PF_USED_ASYNC; | ||
| 210 | |||
| 211 | /* schedule for execution */ | 208 | /* schedule for execution */ |
| 212 | queue_work_node(node, system_unbound_wq, &entry->work); | 209 | queue_work_node(node, system_unbound_wq, &entry->work); |
| 213 | 210 | ||
| @@ -541,20 +541,22 @@ static void kauditd_printk_skb(struct sk_buff *skb) · 540 unmodified lines | |||
| 541 | /** | 541 | /** |
| 542 | * kauditd_rehold_skb - Handle a audit record send failure in the hold queue | 542 | * kauditd_rehold_skb - Handle a audit record send failure in the hold queue |
| 543 | * @skb: audit record | 543 | * @skb: audit record |
| 544 | * @error: error code (unused) | ||
| 544 | * | 545 | * |
| 545 | * Description: | 546 | * Description: |
| 546 | * This should only be used by the kauditd_thread when it fails to flush the | 547 | * This should only be used by the kauditd_thread when it fails to flush the |
| 547 | * hold queue. | 548 | * hold queue. |
| 548 | */ | 549 | */ |
| 549 | static void kauditd_rehold_skb(struct sk_buff *skb) | 550 | static void kauditd_rehold_skb(struct sk_buff *skb, __always_unused int error) |
| 550 | { | 551 | { |
| 551 | /* put the record back in the queue at the same place */ | 552 | /* put the record back in the queue */ |
| 552 | skb_queue_head(&audit_hold_queue, skb); | 553 | skb_queue_tail(&audit_hold_queue, skb); |
| 553 | } | 554 | } |
| 554 | 555 | ||
| 555 | /** | 556 | /** |
| 556 | * kauditd_hold_skb - Queue an audit record, waiting for auditd | 557 | * kauditd_hold_skb - Queue an audit record, waiting for auditd |
| 557 | * @skb: audit record | 558 | * @skb: audit record |
| 559 | * @error: error code | ||
| 558 | * | 560 | * |
| 559 | * Description: | 561 | * Description: |
| 560 | * Queue the audit record, waiting for an instance of auditd. When this | 562 | * Queue the audit record, waiting for an instance of auditd. When this |
| @@ -564,19 +566,31 @@ static void kauditd_rehold_skb(struct sk_buff *skb) · 3 unmodified lines | |||
| 564 | * and queue it, if we have room. If we want to hold on to the record, but we | 566 | * and queue it, if we have room. If we want to hold on to the record, but we |
| 565 | * don't have room, record a record lost message. | 567 | * don't have room, record a record lost message. |
| 566 | */ | 568 | */ |
| 567 | static void kauditd_hold_skb(struct sk_buff *skb) | 569 | static void kauditd_hold_skb(struct sk_buff *skb, int error) |
| 568 | { | 570 | { |
| 569 | /* at this point it is uncertain if we will ever send this to auditd so | 571 | /* at this point it is uncertain if we will ever send this to auditd so |
| 570 | * try to send the message via printk before we go any further */ | 572 | * try to send the message via printk before we go any further */ |
| 571 | kauditd_printk_skb(skb); | 573 | kauditd_printk_skb(skb); |
| 572 | 574 | ||
| 573 | /* can we just silently drop the message? */ | 575 | /* can we just silently drop the message? */ |
| 574 | if (!audit_default) { | 576 | if (!audit_default) |
| 575 | kfree_skb(skb); | 577 | goto drop; |
| 576 | return; | 578 | |
| 579 | /* the hold queue is only for when the daemon goes away completely, | ||
| 580 | * not -EAGAIN failures; if we are in a -EAGAIN state requeue the | ||
| 581 | * record on the retry queue unless it's full, in which case drop it | ||
| 582 | */ | ||
| 583 | if (error == -EAGAIN) { | ||
| 584 | if (!audit_backlog_limit || | ||
| 585 | skb_queue_len(&audit_retry_queue) < audit_backlog_limit) { | ||
| 586 | skb_queue_tail(&audit_retry_queue, skb); | ||
| 587 | return; | ||
| 588 | } | ||
| 589 | audit_log_lost("kauditd retry queue overflow"); | ||
| 590 | goto drop; | ||
| 577 | } | 591 | } |
| 578 | 592 | ||
| 579 | /* if we have room, queue the message */ | 593 | /* if we have room in the hold queue, queue the message */ |
| 580 | if (!audit_backlog_limit || | 594 | if (!audit_backlog_limit || |
| 581 | skb_queue_len(&audit_hold_queue) < audit_backlog_limit) { | 595 | skb_queue_len(&audit_hold_queue) < audit_backlog_limit) { |
| 582 | skb_queue_tail(&audit_hold_queue, skb); | 596 | skb_queue_tail(&audit_hold_queue, skb); |
| @@ -585,24 +599,32 @@ static void kauditd_hold_skb(struct sk_buff *skb) · 2 unmodified lines | |||
| 585 | 599 | ||
| 586 | /* we have no other options - drop the message */ | 600 | /* we have no other options - drop the message */ |
| 587 | audit_log_lost("kauditd hold queue overflow"); | 601 | audit_log_lost("kauditd hold queue overflow"); |
| 602 | drop: | ||
| 588 | kfree_skb(skb); | 603 | kfree_skb(skb); |
| 589 | } | 604 | } |
| 590 | 605 | ||
| 591 | /** | 606 | /** |
| 592 | * kauditd_retry_skb - Queue an audit record, attempt to send again to auditd | 607 | * kauditd_retry_skb - Queue an audit record, attempt to send again to auditd |
| 593 | * @skb: audit record | 608 | * @skb: audit record |
| 609 | * @error: error code (unused) | ||
| 594 | * | 610 | * |
| 595 | * Description: | 611 | * Description: |
| 596 | * Not as serious as kauditd_hold_skb() as we still have a connected auditd, | 612 | * Not as serious as kauditd_hold_skb() as we still have a connected auditd, |
| 597 | * but for some reason we are having problems sending it audit records so | 613 | * but for some reason we are having problems sending it audit records so |
| 598 | * queue the given record and attempt to resend. | 614 | * queue the given record and attempt to resend. |
| 599 | */ | 615 | */ |
| 600 | static void kauditd_retry_skb(struct sk_buff *skb) | 616 | static void kauditd_retry_skb(struct sk_buff *skb, __always_unused int error) |
| 601 | { | 617 | { |
| 602 | /* NOTE: because records should only live in the retry queue for a | 618 | if (!audit_backlog_limit || |
| 603 | * short period of time, before either being sent or moved to the hold | 619 | skb_queue_len(&audit_retry_queue) < audit_backlog_limit) { |
| 604 | * queue, we don't currently enforce a limit on this queue */ | 620 | skb_queue_tail(&audit_retry_queue, skb); |
| 605 | skb_queue_tail(&audit_retry_queue, skb); | 621 | return; |
| 622 | } | ||
| 623 | |||
| 624 | /* we have to drop the record, send it via printk as a last effort */ | ||
| 625 | kauditd_printk_skb(skb); | ||
| 626 | audit_log_lost("kauditd retry queue overflow"); | ||
| 627 | kfree_skb(skb); | ||
| 606 | } | 628 | } |
| 607 | 629 | ||
| 608 | /** | 630 | /** |
| @@ -640,7 +662,7 @@ static void auditd_reset(const struct auditd_connection *ac) · 31 unmodified lines | |||
| 640 | /* flush the retry queue to the hold queue, but don't touch the main | 662 | /* flush the retry queue to the hold queue, but don't touch the main |
| 641 | * queue since we need to process that normally for multicast */ | 663 | * queue since we need to process that normally for multicast */ |
| 642 | while ((skb = skb_dequeue(&audit_retry_queue))) | 664 | while ((skb = skb_dequeue(&audit_retry_queue))) |
| 643 | kauditd_hold_skb(skb); | 665 | kauditd_hold_skb(skb, -ECONNREFUSED); |
| 644 | } | 666 | } |
| 645 | 667 | ||
| 646 | /** | 668 | /** |
| @@ -714,16 +736,18 @@ static int kauditd_send_queue(struct sock *sk, u32 portid, · 67 unmodified lines | |||
| 714 | struct sk_buff_head *queue, | 736 | struct sk_buff_head *queue, |
| 715 | unsigned int retry_limit, | 737 | unsigned int retry_limit, |
| 716 | void (*skb_hook)(struct sk_buff *skb), | 738 | void (*skb_hook)(struct sk_buff *skb), |
| 717 | void (*err_hook)(struct sk_buff *skb)) | 739 | void (*err_hook)(struct sk_buff *skb, int error)) |
| 718 | { | 740 | { |
| 719 | int rc = 0; | 741 | int rc = 0; |
| 720 | struct sk_buff *skb; | 742 | struct sk_buff *skb = NULL; |
| 743 | struct sk_buff *skb_tail; | ||
| 721 | unsigned int failed = 0; | 744 | unsigned int failed = 0; |
| 722 | 745 | ||
| 723 | /* NOTE: kauditd_thread takes care of all our locking, we just use | 746 | /* NOTE: kauditd_thread takes care of all our locking, we just use |
| 724 | * the netlink info passed to us (e.g. sk and portid) */ | 747 | * the netlink info passed to us (e.g. sk and portid) */ |
| 725 | 748 | ||
| 726 | while ((skb = skb_dequeue(queue))) { | 749 | skb_tail = skb_peek_tail(queue); |
| 750 | while ((skb != skb_tail) && (skb = skb_dequeue(queue))) { | ||
| 727 | /* call the skb_hook for each skb we touch */ | 751 | /* call the skb_hook for each skb we touch */ |
| 728 | if (skb_hook) | 752 | if (skb_hook) |
| 729 | (*skb_hook)(skb); | 753 | (*skb_hook)(skb); |
| @@ -731,7 +755,7 @@ static int kauditd_send_queue(struct sock *sk, u32 portid, · 1 unmodified line | |||
| 731 | /* can we send to anyone via unicast? */ | 755 | /* can we send to anyone via unicast? */ |
| 732 | if (!sk) { | 756 | if (!sk) { |
| 733 | if (err_hook) | 757 | if (err_hook) |
| 734 | (*err_hook)(skb); | 758 | (*err_hook)(skb, -ECONNREFUSED); |
| 735 | continue; | 759 | continue; |
| 736 | } | 760 | } |
| 737 | 761 | ||
| @@ -745,7 +769,7 @@ retry: · 7 unmodified lines | |||
| 745 | rc == -ECONNREFUSED || rc == -EPERM) { | 769 | rc == -ECONNREFUSED || rc == -EPERM) { |
| 746 | sk = NULL; | 770 | sk = NULL; |
| 747 | if (err_hook) | 771 | if (err_hook) |
| 748 | (*err_hook)(skb); | 772 | (*err_hook)(skb, rc); |
| 749 | if (rc == -EAGAIN) | 773 | if (rc == -EAGAIN) |
| 750 | rc = 0; | 774 | rc = 0; |
| 751 | /* continue to drain the queue */ | 775 | /* continue to drain the queue */ |
| @@ -207,7 +207,7 @@ BTF_ID(func, bpf_lsm_socket_socketpair) · 206 unmodified lines | |||
| 207 | 207 | ||
| 208 | BTF_ID(func, bpf_lsm_syslog) | 208 | BTF_ID(func, bpf_lsm_syslog) |
| 209 | BTF_ID(func, bpf_lsm_task_alloc) | 209 | BTF_ID(func, bpf_lsm_task_alloc) |
| 210 | BTF_ID(func, bpf_lsm_task_getsecid_subj) | 210 | BTF_ID(func, bpf_lsm_current_getsecid_subj) |
| 211 | BTF_ID(func, bpf_lsm_task_getsecid_obj) | 211 | BTF_ID(func, bpf_lsm_task_getsecid_obj) |
| 212 | BTF_ID(func, bpf_lsm_task_prctl) | 212 | BTF_ID(func, bpf_lsm_task_prctl) |
| 213 | BTF_ID(func, bpf_lsm_task_setscheduler) | 213 | BTF_ID(func, bpf_lsm_task_setscheduler) |
| @@ -104,7 +104,7 @@ static struct bpf_ringbuf *bpf_ringbuf_area_alloc(size_t data_sz, int numa_node) · 103 unmodified lines | |||
| 104 | } | 104 | } |
| 105 | 105 | ||
| 106 | rb = vmap(pages, nr_meta_pages + 2 * nr_data_pages, | 106 | rb = vmap(pages, nr_meta_pages + 2 * nr_data_pages, |
| 107 | VM_ALLOC | VM_USERMAP, PAGE_KERNEL); | 107 | VM_MAP | VM_USERMAP, PAGE_KERNEL); |
| 108 | if (rb) { | 108 | if (rb) { |
| 109 | kmemleak_not_leak(pages); | 109 | kmemleak_not_leak(pages); |
| 110 | rb->pages = pages; | 110 | rb->pages = pages; |
| @@ -550,11 +550,12 @@ static __always_inline u64 notrace bpf_prog_start_time(void) · 549 unmodified lines | |||
| 550 | static void notrace inc_misses_counter(struct bpf_prog *prog) | 550 | static void notrace inc_misses_counter(struct bpf_prog *prog) |
| 551 | { | 551 | { |
| 552 | struct bpf_prog_stats *stats; | 552 | struct bpf_prog_stats *stats; |
| 553 | unsigned int flags; | ||
| 553 | 554 | ||
| 554 | stats = this_cpu_ptr(prog->stats); | 555 | stats = this_cpu_ptr(prog->stats); |
| 555 | u64_stats_update_begin(&stats->syncp); | 556 | flags = u64_stats_update_begin_irqsave(&stats->syncp); |
| 556 | u64_stats_inc(&stats->misses); | 557 | u64_stats_inc(&stats->misses); |
| 557 | u64_stats_update_end(&stats->syncp); | 558 | u64_stats_update_end_irqrestore(&stats->syncp, flags); |
| 558 | } | 559 | } |
| 559 | 560 | ||
| 560 | /* The logic is similar to bpf_prog_run(), but with an explicit | 561 | /* The logic is similar to bpf_prog_run(), but with an explicit |
| @@ -549,6 +549,14 @@ static ssize_t cgroup_release_agent_write(struct kernfs_open_file *of, · 548 unmodified lines | |||
| 549 | 549 | ||
| 550 | BUILD_BUG_ON(sizeof(cgrp->root->release_agent_path) < PATH_MAX); | 550 | BUILD_BUG_ON(sizeof(cgrp->root->release_agent_path) < PATH_MAX); |
| 551 | 551 | ||
| 552 | /* | ||
| 553 | * Release agent gets called with all capabilities, | ||
| 554 | * require capabilities to set release agent. | ||
| 555 | */ | ||
| 556 | if ((of->file->f_cred->user_ns != &init_user_ns) || | ||
| 557 | !capable(CAP_SYS_ADMIN)) | ||
| 558 | return -EPERM; | ||
| 559 | |||
| 552 | cgrp = cgroup_kn_lock_live(of->kn, false); | 560 | cgrp = cgroup_kn_lock_live(of->kn, false); |
| 553 | if (!cgrp) | 561 | if (!cgrp) |
| 554 | return -ENODEV; | 562 | return -ENODEV; |
| @@ -954,6 +962,12 @@ int cgroup1_parse_param(struct fs_context *fc, struct fs_parameter *param) · 399 unmodified lines | |||
| 954 | /* Specifying two release agents is forbidden */ | 962 | /* Specifying two release agents is forbidden */ |
| 955 | if (ctx->release_agent) | 963 | if (ctx->release_agent) |
| 956 | return invalfc(fc, "release_agent respecified"); | 964 | return invalfc(fc, "release_agent respecified"); |
| 965 | /* | ||
| 966 | * Release agent gets called with all capabilities, | ||
| 967 | * require capabilities to set release agent. | ||
| 968 | */ | ||
| 969 | if ((fc->user_ns != &init_user_ns) || !capable(CAP_SYS_ADMIN)) | ||
| 970 | return invalfc(fc, "Setting release_agent not allowed"); | ||
| 957 | ctx->release_agent = param->string; | 971 | ctx->release_agent = param->string; |
| 958 | param->string = NULL; | 972 | param->string = NULL; |
| 959 | break; | 973 | break; |
| @@ -590,6 +590,35 @@ static inline void free_cpuset(struct cpuset *cs) · 589 unmodified lines | |||
| 590 | kfree(cs); | 590 | kfree(cs); |
| 591 | } | 591 | } |
| 592 | 592 | ||
| 593 | /* | ||
| 594 | * validate_change_legacy() - Validate conditions specific to legacy (v1) | ||
| 595 | * behavior. | ||
| 596 | */ | ||
| 597 | static int validate_change_legacy(struct cpuset *cur, struct cpuset *trial) | ||
| 598 | { | ||
| 599 | struct cgroup_subsys_state *css; | ||
| 600 | struct cpuset *c, *par; | ||
| 601 | int ret; | ||
| 602 | |||
| 603 | WARN_ON_ONCE(!rcu_read_lock_held()); | ||
| 604 | |||
| 605 | /* Each of our child cpusets must be a subset of us */ | ||
| 606 | ret = -EBUSY; | ||
| 607 | cpuset_for_each_child(c, css, cur) | ||
| 608 | if (!is_cpuset_subset(c, trial)) | ||
| 609 | goto out; | ||
| 610 | |||
| 611 | /* On legacy hierarchy, we must be a subset of our parent cpuset. */ | ||
| 612 | ret = -EACCES; | ||
| 613 | par = parent_cs(cur); | ||
| 614 | if (par && !is_cpuset_subset(trial, par)) | ||
| 615 | goto out; | ||
| 616 | |||
| 617 | ret = 0; | ||
| 618 | out: | ||
| 619 | return ret; | ||
| 620 | } | ||
| 621 | |||
| 593 | /* | 622 | /* |
| 594 | * validate_change() - Used to validate that any proposed cpuset change | 623 | * validate_change() - Used to validate that any proposed cpuset change |
| 595 | * follows the structural rules for cpusets. | 624 | * follows the structural rules for cpusets. |
| @@ -614,20 +643,21 @@ static int validate_change(struct cpuset *cur, struct cpuset *trial) · 18 unmodified lines | |||
| 614 | { | 643 | { |
| 615 | struct cgroup_subsys_state *css; | 644 | struct cgroup_subsys_state *css; |
| 616 | struct cpuset *c, *par; | 645 | struct cpuset *c, *par; |
| 617 | int ret; | 646 | int ret = 0; |
| 618 | |||
| 619 | /* The checks don't apply to root cpuset */ | ||
| 620 | if (cur == &top_cpuset) | ||
| 621 | return 0; | ||
| 622 | 647 | ||
| 623 | rcu_read_lock(); | 648 | rcu_read_lock(); |
| 624 | par = parent_cs(cur); | ||
| 625 | 649 | ||
| 626 | /* On legacy hierarchy, we must be a subset of our parent cpuset. */ | 650 | if (!is_in_v2_mode()) |
| 627 | ret = -EACCES; | 651 | ret = validate_change_legacy(cur, trial); |
| 628 | if (!is_in_v2_mode() && !is_cpuset_subset(trial, par)) | 652 | if (ret) |
| 653 | goto out; | ||
| 654 | |||
| 655 | /* Remaining checks don't apply to root cpuset */ | ||
| 656 | if (cur == &top_cpuset) | ||
| 629 | goto out; | 657 | goto out; |
| 630 | 658 | ||
| 659 | par = parent_cs(cur); | ||
| 660 | |||
| 631 | /* | 661 | /* |
| 632 | * If either I or some sibling (!= me) is exclusive, we can't | 662 | * If either I or some sibling (!= me) is exclusive, we can't |
| 633 | * overlap | 663 | * overlap |
| @@ -1175,9 +1205,7 @@ enum subparts_cmd { · 541 unmodified lines | |||
| 1175 | * | 1205 | * |
| 1176 | * Because of the implicit cpu exclusive nature of a partition root, | 1206 | * Because of the implicit cpu exclusive nature of a partition root, |
| 1177 | * cpumask changes that violates the cpu exclusivity rule will not be | 1207 | * cpumask changes that violates the cpu exclusivity rule will not be |
| 1178 | * permitted when checked by validate_change(). The validate_change() | 1208 | * permitted when checked by validate_change(). |
| 1179 | * function will also prevent any changes to the cpu list if it is not | ||
| 1180 | * a superset of children's cpu lists. | ||
| 1181 | */ | 1209 | */ |
| 1182 | static int update_parent_subparts_cpumask(struct cpuset *cpuset, int cmd, | 1210 | static int update_parent_subparts_cpumask(struct cpuset *cpuset, int cmd, |
| 1183 | struct cpumask *newmask, | 1211 | struct cpumask *newmask, |
| @@ -1522,10 +1550,15 @@ static void update_sibling_cpumasks(struct cpuset *parent, struct cpuset *cs, · 338 unmodified lines | |||
| 1522 | struct cpuset *sibling; | 1550 | struct cpuset *sibling; |
| 1523 | struct cgroup_subsys_state *pos_css; | 1551 | struct cgroup_subsys_state *pos_css; |
| 1524 | 1552 | ||
| 1553 | percpu_rwsem_assert_held(&cpuset_rwsem); | ||
| 1554 | |||
| 1525 | /* | 1555 | /* |
| 1526 | * Check all its siblings and call update_cpumasks_hier() | 1556 | * Check all its siblings and call update_cpumasks_hier() |
| 1527 | * if their use_parent_ecpus flag is set in order for them | 1557 | * if their use_parent_ecpus flag is set in order for them |
| 1528 | * to use the right effective_cpus value. | 1558 | * to use the right effective_cpus value. |
| 1559 | * | ||
| 1560 | * The update_cpumasks_hier() function may sleep. So we have to | ||
| 1561 | * release the RCU read lock before calling it. | ||
| 1529 | */ | 1562 | */ |
| 1530 | rcu_read_lock(); | 1563 | rcu_read_lock(); |
| 1531 | cpuset_for_each_child(sibling, pos_css, parent) { | 1564 | cpuset_for_each_child(sibling, pos_css, parent) { |
| @@ -1533,8 +1566,13 @@ static void update_sibling_cpumasks(struct cpuset *parent, struct cpuset *cs, · 1 unmodified line | |||
| 1533 | continue; | 1566 | continue; |
| 1534 | if (!sibling->use_parent_ecpus) | 1567 | if (!sibling->use_parent_ecpus) |
| 1535 | continue; | 1568 | continue; |
| 1569 | if (!css_tryget_online(&sibling->css)) | ||
| 1570 | continue; | ||
| 1536 | 1571 | ||
| 1572 | rcu_read_unlock(); | ||
| 1537 | update_cpumasks_hier(sibling, tmp); | 1573 | update_cpumasks_hier(sibling, tmp); |
| 1574 | rcu_read_lock(); | ||
| 1575 | css_put(&sibling->css); | ||
| 1538 | } | 1576 | } |
| 1539 | rcu_read_unlock(); | 1577 | rcu_read_unlock(); |
| 1540 | } | 1578 | } |
| @@ -1607,8 +1645,7 @@ static int update_cpumask(struct cpuset *cs, struct cpuset *trialcs, · 66 unmodified lines | |||
| 1607 | * Make sure that subparts_cpus is a subset of cpus_allowed. | 1645 | * Make sure that subparts_cpus is a subset of cpus_allowed. |
| 1608 | */ | 1646 | */ |
| 1609 | if (cs->nr_subparts_cpus) { | 1647 | if (cs->nr_subparts_cpus) { |
| 1610 | cpumask_andnot(cs->subparts_cpus, cs->subparts_cpus, | 1648 | cpumask_and(cs->subparts_cpus, cs->subparts_cpus, cs->cpus_allowed); |
| 1611 | cs->cpus_allowed); | ||
| 1612 | cs->nr_subparts_cpus = cpumask_weight(cs->subparts_cpus); | 1649 | cs->nr_subparts_cpus = cpumask_weight(cs->subparts_cpus); |
| 1613 | } | 1650 | } |
| 1614 | spin_unlock_irq(&callback_lock); | 1651 | spin_unlock_irq(&callback_lock); |
| @@ -2462,7 +2462,11 @@ static void perf_remove_from_context(struct perf_event *event, unsigned long fla · 2461 unmodified lines | |||
| 2462 | * event_function_call() user. | 2462 | * event_function_call() user. |
| 2463 | */ | 2463 | */ |
| 2464 | raw_spin_lock_irq(&ctx->lock); | 2464 | raw_spin_lock_irq(&ctx->lock); |
| 2465 | if (!ctx->is_active) { | 2465 | /* |
| 2466 | * Cgroup events are per-cpu events, and must IPI because of | ||
| 2467 | * cgrp_cpuctx_list. | ||
| 2468 | */ | ||
| 2469 | if (!ctx->is_active && !is_cgroup_event(event)) { | ||
| 2466 | __perf_remove_from_context(event, __get_cpu_context(ctx), | 2470 | __perf_remove_from_context(event, __get_cpu_context(ctx), |
| 2467 | ctx, (void *)flags); | 2471 | ctx, (void *)flags); |
| 2468 | raw_spin_unlock_irq(&ctx->lock); | 2472 | raw_spin_unlock_irq(&ctx->lock); |
| @@ -2895,11 +2899,14 @@ perf_install_in_context(struct perf_event_context *ctx, · 426 unmodified lines | |||
| 2895 | * perf_event_attr::disabled events will not run and can be initialized | 2899 | * perf_event_attr::disabled events will not run and can be initialized |
| 2896 | * without IPI. Except when this is the first event for the context, in | 2900 | * without IPI. Except when this is the first event for the context, in |
| 2897 | * that case we need the magic of the IPI to set ctx->is_active. | 2901 | * that case we need the magic of the IPI to set ctx->is_active. |
| 2902 | * Similarly, cgroup events for the context also needs the IPI to | ||
| 2903 | * manipulate the cgrp_cpuctx_list. | ||
| 2898 | * | 2904 | * |
| 2899 | * The IOC_ENABLE that is sure to follow the creation of a disabled | 2905 | * The IOC_ENABLE that is sure to follow the creation of a disabled |
| 2900 | * event will issue the IPI and reprogram the hardware. | 2906 | * event will issue the IPI and reprogram the hardware. |
| 2901 | */ | 2907 | */ |
| 2902 | if (__perf_effective_state(event) == PERF_EVENT_STATE_OFF && ctx->nr_events) { | 2908 | if (__perf_effective_state(event) == PERF_EVENT_STATE_OFF && |
| 2909 | ctx->nr_events && !is_cgroup_event(event)) { | ||
| 2903 | raw_spin_lock_irq(&ctx->lock); | 2910 | raw_spin_lock_irq(&ctx->lock); |
| 2904 | if (ctx->task == TASK_TOMBSTONE) { | 2911 | if (ctx->task == TASK_TOMBSTONE) { |
| 2905 | raw_spin_unlock_irq(&ctx->lock); | 2912 | raw_spin_unlock_irq(&ctx->lock); |
| @@ -5985,6 +5992,8 @@ static void ring_buffer_attach(struct perf_event *event, · 3079 unmodified lines | |||
| 5985 | struct perf_buffer *old_rb = NULL; | 5992 | struct perf_buffer *old_rb = NULL; |
| 5986 | unsigned long flags; | 5993 | unsigned long flags; |
| 5987 | 5994 | ||
| 5995 | WARN_ON_ONCE(event->parent); | ||
| 5996 | |||
| 5988 | if (event->rb) { | 5997 | if (event->rb) { |
| 5989 | /* | 5998 | /* |
| 5990 | * Should be impossible, we set this when removing | 5999 | * Should be impossible, we set this when removing |
| @@ -6042,6 +6051,9 @@ static void ring_buffer_wakeup(struct perf_event *event) · 51 unmodified lines | |||
| 6042 | { | 6051 | { |
| 6043 | struct perf_buffer *rb; | 6052 | struct perf_buffer *rb; |
| 6044 | 6053 | ||
| 6054 | if (event->parent) | ||
| 6055 | event = event->parent; | ||
| 6056 | |||
| 6045 | rcu_read_lock(); | 6057 | rcu_read_lock(); |
| 6046 | rb = rcu_dereference(event->rb); | 6058 | rb = rcu_dereference(event->rb); |
| 6047 | if (rb) { | 6059 | if (rb) { |
| @@ -6055,6 +6067,9 @@ struct perf_buffer *ring_buffer_get(struct perf_event *event) · 7 unmodified lines | |||
| 6055 | { | 6067 | { |
| 6056 | struct perf_buffer *rb; | 6068 | struct perf_buffer *rb; |
| 6057 | 6069 | ||
| 6070 | if (event->parent) | ||
| 6071 | event = event->parent; | ||
| 6072 | |||
| 6058 | rcu_read_lock(); | 6073 | rcu_read_lock(); |
| 6059 | rb = rcu_dereference(event->rb); | 6074 | rb = rcu_dereference(event->rb); |
| 6060 | if (rb) { | 6075 | if (rb) { |
| @@ -6763,7 +6778,7 @@ static unsigned long perf_prepare_sample_aux(struct perf_event *event, · 702 unmodified lines | |||
| 6763 | if (WARN_ON_ONCE(READ_ONCE(sampler->oncpu) != smp_processor_id())) | 6778 | if (WARN_ON_ONCE(READ_ONCE(sampler->oncpu) != smp_processor_id())) |
| 6764 | goto out; | 6779 | goto out; |
| 6765 | 6780 | ||
| 6766 | rb = ring_buffer_get(sampler->parent ? sampler->parent : sampler); | 6781 | rb = ring_buffer_get(sampler); |
| 6767 | if (!rb) | 6782 | if (!rb) |
| 6768 | goto out; | 6783 | goto out; |
| 6769 | 6784 | ||
| @@ -6829,7 +6844,7 @@ static void perf_aux_sample_output(struct perf_event *event, · 59 unmodified lines | |||
| 6829 | if (WARN_ON_ONCE(!sampler || !data->aux_size)) | 6844 | if (WARN_ON_ONCE(!sampler || !data->aux_size)) |
| 6830 | return; | 6845 | return; |
| 6831 | 6846 | ||
| 6832 | rb = ring_buffer_get(sampler->parent ? sampler->parent : sampler); | 6847 | rb = ring_buffer_get(sampler); |
| 6833 | if (!rb) | 6848 | if (!rb) |
| 6834 | return; | 6849 | return; |
| 6835 | 6850 | ||
| @@ -3725,12 +3725,6 @@ static noinline int do_init_module(struct module *mod) · 3724 unmodified lines | |||
| 3725 | } | 3725 | } |
| 3726 | freeinit->module_init = mod->init_layout.base; | 3726 | freeinit->module_init = mod->init_layout.base; |
| 3727 | 3727 | ||
| 3728 | /* | ||
| 3729 | * We want to find out whether @mod uses async during init. Clear | ||
| 3730 | * PF_USED_ASYNC. async_schedule*() will set it. | ||
| 3731 | */ | ||
| 3732 | current->flags &= ~PF_USED_ASYNC; | ||
| 3733 | |||
| 3734 | do_mod_ctors(mod); | 3728 | do_mod_ctors(mod); |
| 3735 | /* Start the module */ | 3729 | /* Start the module */ |
| 3736 | if (mod->init != NULL) | 3730 | if (mod->init != NULL) |
| @@ -3756,22 +3750,13 @@ static noinline int do_init_module(struct module *mod) · 19 unmodified lines | |||
| 3756 | 3750 | ||
| 3757 | /* | 3751 | /* |
| 3758 | * We need to finish all async code before the module init sequence | 3752 | * We need to finish all async code before the module init sequence |
| 3759 | * is done. This has potential to deadlock. For example, a newly | 3753 | * is done. This has potential to deadlock if synchronous module |
| 3760 | * detected block device can trigger request_module() of the | 3754 | * loading is requested from async (which is not allowed!). |
| 3761 | * default iosched from async probing task. Once userland helper | ||
| 3762 | * reaches here, async_synchronize_full() will wait on the async | ||
| 3763 | * task waiting on request_module() and deadlock. | ||
| 3764 | * | ||
| 3765 | * This deadlock is avoided by perfomring async_synchronize_full() | ||
| 3766 | * iff module init queued any async jobs. This isn't a full | ||
| 3767 | * solution as it will deadlock the same if module loading from | ||
| 3768 | * async jobs nests more than once; however, due to the various | ||
| 3769 | * constraints, this hack seems to be the best option for now. | ||
| 3770 | * Please refer to the following thread for details. | ||
| 3771 | * | 3755 | * |
| 3772 | * http://thread.gmane.org/gmane.linux.kernel/1420814 | 3756 | * See commit 0fdff3ec6d87 ("async, kmod: warn on synchronous |
| 3757 | * request_module() from async workers") for more details. | ||
| 3773 | */ | 3758 | */ |
| 3774 | if (!mod->async_probe_requested && (current->flags & PF_USED_ASYNC)) | 3759 | if (!mod->async_probe_requested) |
| 3775 | async_synchronize_full(); | 3760 | async_synchronize_full(); |
| 3776 | 3761 | ||
| 3777 | ftrace_free_mem(mod, mod->init_layout.base, mod->init_layout.base + | 3762 | ftrace_free_mem(mod, mod->init_layout.base, mod->init_layout.base + |
| @@ -978,8 +978,7 @@ static void memory_bm_recycle(struct memory_bitmap *bm) · 977 unmodified lines | |||
| 978 | * Register a range of page frames the contents of which should not be saved | 978 | * Register a range of page frames the contents of which should not be saved |
| 979 | * during hibernation (to be used in the early initialization code). | 979 | * during hibernation (to be used in the early initialization code). |
| 980 | */ | 980 | */ |
| 981 | void __init __register_nosave_region(unsigned long start_pfn, | 981 | void __init register_nosave_region(unsigned long start_pfn, unsigned long end_pfn) |
| 982 | unsigned long end_pfn, int use_kmalloc) | ||
| 983 | { | 982 | { |
| 984 | struct nosave_region *region; | 983 | struct nosave_region *region; |
| 985 | 984 | ||
| @@ -995,18 +994,12 @@ void __init __register_nosave_region(unsigned long start_pfn, · 9 unmodified lines | |||
| 995 | goto Report; | 994 | goto Report; |
| 996 | } | 995 | } |
| 997 | } | 996 | } |
| 998 | if (use_kmalloc) { | 997 | /* This allocation cannot fail */ |
| 999 | /* During init, this shouldn't fail */ | 998 | region = memblock_alloc(sizeof(struct nosave_region), |
| 1000 | region = kmalloc(sizeof(struct nosave_region), GFP_KERNEL); | 999 | SMP_CACHE_BYTES); |
| 1001 | BUG_ON(!region); | 1000 | if (!region) |
| 1002 | } else { | 1001 | panic("%s: Failed to allocate %zu bytes\n", __func__, |
| 1003 | /* This allocation cannot fail */ | 1002 | sizeof(struct nosave_region)); |
| 1004 | region = memblock_alloc(sizeof(struct nosave_region), | ||
| 1005 | SMP_CACHE_BYTES); | ||
| 1006 | if (!region) | ||
| 1007 | panic("%s: Failed to allocate %zu bytes\n", __func__, | ||
| 1008 | sizeof(struct nosave_region)); | ||
| 1009 | } | ||
| 1010 | region->start_pfn = start_pfn; | 1003 | region->start_pfn = start_pfn; |
| 1011 | region->end_pfn = end_pfn; | 1004 | region->end_pfn = end_pfn; |
| 1012 | list_add_tail(®ion->list, &nosave_regions); | 1005 | list_add_tail(®ion->list, &nosave_regions); |
| @@ -39,23 +39,20 @@ ssize_t pm_show_wakelocks(char *buf, bool show_active) · 38 unmodified lines | |||
| 39 | { | 39 | { |
| 40 | struct rb_node *node; | 40 | struct rb_node *node; |
| 41 | struct wakelock *wl; | 41 | struct wakelock *wl; |
| 42 | char *str = buf; | 42 | int len = 0; |
| 43 | char *end = buf + PAGE_SIZE; | ||
| 44 | 43 | ||
| 45 | mutex_lock(&wakelocks_lock); | 44 | mutex_lock(&wakelocks_lock); |
| 46 | 45 | ||
| 47 | for (node = rb_first(&wakelocks_tree); node; node = rb_next(node)) { | 46 | for (node = rb_first(&wakelocks_tree); node; node = rb_next(node)) { |
| 48 | wl = rb_entry(node, struct wakelock, node); | 47 | wl = rb_entry(node, struct wakelock, node); |
| 49 | if (wl->ws->active == show_active) | 48 | if (wl->ws->active == show_active) |
| 50 | str += scnprintf(str, end - str, "%s ", wl->name); | 49 | len += sysfs_emit_at(buf, len, "%s ", wl->name); |
| 51 | } | 50 | } |
| 52 | if (str > buf) | ||
| 53 | str--; | ||
| 54 | 51 | ||
| 55 | str += scnprintf(str, end - str, "\n"); | 52 | len += sysfs_emit_at(buf, len, "\n"); |
| 56 | 53 | ||
| 57 | mutex_unlock(&wakelocks_lock); | 54 | mutex_unlock(&wakelocks_lock); |
| 58 | return (str - buf); | 55 | return len; |
| 59 | } | 56 | } |
| 60 | 57 | ||
| 61 | #if CONFIG_PM_WAKELOCKS_LIMIT > 0 | 58 | #if CONFIG_PM_WAKELOCKS_LIMIT > 0 |
| @@ -12,7 +12,7 @@ · 11 unmodified lines | |||
| 12 | static const int ten_thousand = 10000; | 12 | static const int ten_thousand = 10000; |
| 13 | 13 | ||
| 14 | static int proc_dointvec_minmax_sysadmin(struct ctl_table *table, int write, | 14 | static int proc_dointvec_minmax_sysadmin(struct ctl_table *table, int write, |
| 15 | void __user *buffer, size_t *lenp, loff_t *ppos) | 15 | void *buffer, size_t *lenp, loff_t *ppos) |
| 16 | { | 16 | { |
| 17 | if (write && !capable(CAP_SYS_ADMIN)) | 17 | if (write && !capable(CAP_SYS_ADMIN)) |
| 18 | return -EPERM; | 18 | return -EPERM; |
| @@ -123,7 +123,7 @@ static struct rcu_tasks rt_name = \ · 122 unmodified lines | |||
| 123 | .call_func = call, \ | 123 | .call_func = call, \ |
| 124 | .rtpcpu = &rt_name ## __percpu, \ | 124 | .rtpcpu = &rt_name ## __percpu, \ |
| 125 | .name = n, \ | 125 | .name = n, \ |
| 126 | .percpu_enqueue_shift = ilog2(CONFIG_NR_CPUS), \ | 126 | .percpu_enqueue_shift = ilog2(CONFIG_NR_CPUS) + 1, \ |
| 127 | .percpu_enqueue_lim = 1, \ | 127 | .percpu_enqueue_lim = 1, \ |
| 128 | .percpu_dequeue_lim = 1, \ | 128 | .percpu_dequeue_lim = 1, \ |
| 129 | .barrier_q_mutex = __MUTEX_INITIALIZER(rt_name.barrier_q_mutex), \ | 129 | .barrier_q_mutex = __MUTEX_INITIALIZER(rt_name.barrier_q_mutex), \ |
| @@ -216,6 +216,7 @@ static void cblist_init_generic(struct rcu_tasks *rtp) · 86 unmodified lines | |||
| 216 | int cpu; | 216 | int cpu; |
| 217 | unsigned long flags; | 217 | unsigned long flags; |
| 218 | int lim; | 218 | int lim; |
| 219 | int shift; | ||
| 219 | 220 | ||
| 220 | raw_spin_lock_irqsave(&rtp->cbs_gbl_lock, flags); | 221 | raw_spin_lock_irqsave(&rtp->cbs_gbl_lock, flags); |
| 221 | if (rcu_task_enqueue_lim < 0) { | 222 | if (rcu_task_enqueue_lim < 0) { |
| @@ -229,7 +230,10 @@ static void cblist_init_generic(struct rcu_tasks *rtp) · 7 unmodified lines | |||
| 229 | 230 | ||
| 230 | if (lim > nr_cpu_ids) | 231 | if (lim > nr_cpu_ids) |
| 231 | lim = nr_cpu_ids; | 232 | lim = nr_cpu_ids; |
| 232 | WRITE_ONCE(rtp->percpu_enqueue_shift, ilog2(nr_cpu_ids / lim)); | 233 | shift = ilog2(nr_cpu_ids / lim); |
| 234 | if (((nr_cpu_ids - 1) >> shift) >= lim) | ||
| 235 | shift++; | ||
| 236 | WRITE_ONCE(rtp->percpu_enqueue_shift, shift); | ||
| 233 | WRITE_ONCE(rtp->percpu_dequeue_lim, lim); | 237 | WRITE_ONCE(rtp->percpu_dequeue_lim, lim); |
| 234 | smp_store_release(&rtp->percpu_enqueue_lim, lim); | 238 | smp_store_release(&rtp->percpu_enqueue_lim, lim); |
| 235 | for_each_possible_cpu(cpu) { | 239 | for_each_possible_cpu(cpu) { |
| @@ -298,7 +302,7 @@ static void call_rcu_tasks_generic(struct rcu_head *rhp, rcu_callback_t func, · 62 unmodified lines | |||
| 298 | if (unlikely(needadjust)) { | 302 | if (unlikely(needadjust)) { |
| 299 | raw_spin_lock_irqsave(&rtp->cbs_gbl_lock, flags); | 303 | raw_spin_lock_irqsave(&rtp->cbs_gbl_lock, flags); |
| 300 | if (rtp->percpu_enqueue_lim != nr_cpu_ids) { | 304 | if (rtp->percpu_enqueue_lim != nr_cpu_ids) { |
| 301 | WRITE_ONCE(rtp->percpu_enqueue_shift, ilog2(nr_cpu_ids)); | 305 | WRITE_ONCE(rtp->percpu_enqueue_shift, ilog2(nr_cpu_ids) + 1); |
| 302 | WRITE_ONCE(rtp->percpu_dequeue_lim, nr_cpu_ids); | 306 | WRITE_ONCE(rtp->percpu_dequeue_lim, nr_cpu_ids); |
| 303 | smp_store_release(&rtp->percpu_enqueue_lim, nr_cpu_ids); | 307 | smp_store_release(&rtp->percpu_enqueue_lim, nr_cpu_ids); |
| 304 | pr_info("Switching %s to per-CPU callback queuing.\n", rtp->name); | 308 | pr_info("Switching %s to per-CPU callback queuing.\n", rtp->name); |
| @@ -413,7 +417,7 @@ static int rcu_tasks_need_gpcb(struct rcu_tasks *rtp) · 108 unmodified lines | |||
| 413 | if (rcu_task_cb_adjust && ncbs <= rcu_task_collapse_lim) { | 417 | if (rcu_task_cb_adjust && ncbs <= rcu_task_collapse_lim) { |
| 414 | raw_spin_lock_irqsave(&rtp->cbs_gbl_lock, flags); | 418 | raw_spin_lock_irqsave(&rtp->cbs_gbl_lock, flags); |
| 415 | if (rtp->percpu_enqueue_lim > 1) { | 419 | if (rtp->percpu_enqueue_lim > 1) { |
| 416 | WRITE_ONCE(rtp->percpu_enqueue_shift, ilog2(nr_cpu_ids)); | 420 | WRITE_ONCE(rtp->percpu_enqueue_shift, ilog2(nr_cpu_ids) + 1); |
| 417 | smp_store_release(&rtp->percpu_enqueue_lim, 1); | 421 | smp_store_release(&rtp->percpu_enqueue_lim, 1); |
| 418 | rtp->percpu_dequeue_gpseq = get_state_synchronize_rcu(); | 422 | rtp->percpu_dequeue_gpseq = get_state_synchronize_rcu(); |
| 419 | pr_info("Starting switch %s to CPU-0 callback queuing.\n", rtp->name); | 423 | pr_info("Starting switch %s to CPU-0 callback queuing.\n", rtp->name); |
| @@ -147,11 +147,11 @@ · 146 unmodified lines | |||
| 147 | #endif | 147 | #endif |
| 148 | 148 | ||
| 149 | #ifdef CONFIG_RSEQ | 149 | #ifdef CONFIG_RSEQ |
| 150 | #define MEMBARRIER_CMD_PRIVATE_EXPEDITED_RSEQ_BITMASK \ | 150 | #define MEMBARRIER_PRIVATE_EXPEDITED_RSEQ_BITMASK \ |
| 151 | (MEMBARRIER_CMD_PRIVATE_EXPEDITED_RSEQ \ | 151 | (MEMBARRIER_CMD_PRIVATE_EXPEDITED_RSEQ \ |
| 152 | | MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED_RSEQ_BITMASK) | 152 | | MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED_RSEQ) |
| 153 | #else | 153 | #else |
| 154 | #define MEMBARRIER_CMD_PRIVATE_EXPEDITED_RSEQ_BITMASK 0 | 154 | #define MEMBARRIER_PRIVATE_EXPEDITED_RSEQ_BITMASK 0 |
| 155 | #endif | 155 | #endif |
| 156 | 156 | ||
| 157 | #define MEMBARRIER_CMD_BITMASK \ | 157 | #define MEMBARRIER_CMD_BITMASK \ |
| @@ -159,7 +159,8 @@ · 1 unmodified line | |||
| 159 | | MEMBARRIER_CMD_REGISTER_GLOBAL_EXPEDITED \ | 159 | | MEMBARRIER_CMD_REGISTER_GLOBAL_EXPEDITED \ |
| 160 | | MEMBARRIER_CMD_PRIVATE_EXPEDITED \ | 160 | | MEMBARRIER_CMD_PRIVATE_EXPEDITED \ |
| 161 | | MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED \ | 161 | | MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED \ |
| 162 | | MEMBARRIER_PRIVATE_EXPEDITED_SYNC_CORE_BITMASK) | 162 | | MEMBARRIER_PRIVATE_EXPEDITED_SYNC_CORE_BITMASK \ |
| 163 | | MEMBARRIER_PRIVATE_EXPEDITED_RSEQ_BITMASK) | ||
| 163 | 164 | ||
| 164 | static void ipi_mb(void *info) | 165 | static void ipi_mb(void *info) |
| 165 | { | 166 | { |
| @@ -1082,44 +1082,6 @@ int psi_show(struct seq_file *m, struct psi_group *group, enum psi_res res) · 1081 unmodified lines | |||
| 1082 | return 0; | 1082 | return 0; |
| 1083 | } | 1083 | } |
| 1084 | 1084 | ||
| 1085 | static int psi_io_show(struct seq_file *m, void *v) | ||
| 1086 | { | ||
| 1087 | return psi_show(m, &psi_system, PSI_IO); | ||
| 1088 | } | ||
| 1089 | |||
| 1090 | static int psi_memory_show(struct seq_file *m, void *v) | ||
| 1091 | { | ||
| 1092 | return psi_show(m, &psi_system, PSI_MEM); | ||
| 1093 | } | ||
| 1094 | |||
| 1095 | static int psi_cpu_show(struct seq_file *m, void *v) | ||
| 1096 | { | ||
| 1097 | return psi_show(m, &psi_system, PSI_CPU); | ||
| 1098 | } | ||
| 1099 | |||
| 1100 | static int psi_open(struct file *file, int (*psi_show)(struct seq_file *, void *)) | ||
| 1101 | { | ||
| 1102 | if (file->f_mode & FMODE_WRITE && !capable(CAP_SYS_RESOURCE)) | ||
| 1103 | return -EPERM; | ||
| 1104 | |||
| 1105 | return single_open(file, psi_show, NULL); | ||
| 1106 | } | ||
| 1107 | |||
| 1108 | static int psi_io_open(struct inode *inode, struct file *file) | ||
| 1109 | { | ||
| 1110 | return psi_open(file, psi_io_show); | ||
| 1111 | } | ||
| 1112 | |||
| 1113 | static int psi_memory_open(struct inode *inode, struct file *file) | ||
| 1114 | { | ||
| 1115 | return psi_open(file, psi_memory_show); | ||
| 1116 | } | ||
| 1117 | |||
| 1118 | static int psi_cpu_open(struct inode *inode, struct file *file) | ||
| 1119 | { | ||
| 1120 | return psi_open(file, psi_cpu_show); | ||
| 1121 | } | ||
| 1122 | |||
| 1123 | struct psi_trigger *psi_trigger_create(struct psi_group *group, | 1085 | struct psi_trigger *psi_trigger_create(struct psi_group *group, |
| 1124 | char *buf, size_t nbytes, enum psi_res res) | 1086 | char *buf, size_t nbytes, enum psi_res res) |
| 1125 | { | 1087 | { |
| @@ -1278,6 +1240,45 @@ __poll_t psi_trigger_poll(void **trigger_ptr, · 152 unmodified lines | |||
| 1278 | return ret; | 1240 | return ret; |
| 1279 | } | 1241 | } |
| 1280 | 1242 | ||
| 1243 | #ifdef CONFIG_PROC_FS | ||
| 1244 | static int psi_io_show(struct seq_file *m, void *v) | ||
| 1245 | { | ||
| 1246 | return psi_show(m, &psi_system, PSI_IO); | ||
| 1247 | } | ||
| 1248 | |||
| 1249 | static int psi_memory_show(struct seq_file *m, void *v) | ||
| 1250 | { | ||
| 1251 | return psi_show(m, &psi_system, PSI_MEM); | ||
| 1252 | } | ||
| 1253 | |||
| 1254 | static int psi_cpu_show(struct seq_file *m, void *v) | ||
| 1255 | { | ||
| 1256 | return psi_show(m, &psi_system, PSI_CPU); | ||
| 1257 | } | ||
| 1258 | |||
| 1259 | static int psi_open(struct file *file, int (*psi_show)(struct seq_file *, void *)) | ||
| 1260 | { | ||
| 1261 | if (file->f_mode & FMODE_WRITE && !capable(CAP_SYS_RESOURCE)) | ||
| 1262 | return -EPERM; | ||
| 1263 | |||
| 1264 | return single_open(file, psi_show, NULL); | ||
| 1265 | } | ||
| 1266 | |||
| 1267 | static int psi_io_open(struct inode *inode, struct file *file) | ||
| 1268 | { | ||
| 1269 | return psi_open(file, psi_io_show); | ||
| 1270 | } | ||
| 1271 | |||
| 1272 | static int psi_memory_open(struct inode *inode, struct file *file) | ||
| 1273 | { | ||
| 1274 | return psi_open(file, psi_memory_show); | ||
| 1275 | } | ||
| 1276 | |||
| 1277 | static int psi_cpu_open(struct inode *inode, struct file *file) | ||
| 1278 | { | ||
| 1279 | return psi_open(file, psi_cpu_show); | ||
| 1280 | } | ||
| 1281 | |||
| 1281 | static ssize_t psi_write(struct file *file, const char __user *user_buf, | 1282 | static ssize_t psi_write(struct file *file, const char __user *user_buf, |
| 1282 | size_t nbytes, enum psi_res res) | 1283 | size_t nbytes, enum psi_res res) |
| 1283 | { | 1284 | { |
| @@ -1392,3 +1393,5 @@ static int __init psi_proc_init(void) · 108 unmodified lines | |||
| 1392 | return 0; | 1393 | return 0; |
| 1393 | } | 1394 | } |
| 1394 | module_init(psi_proc_init); | 1395 | module_init(psi_proc_init); |
| 1396 | |||
| 1397 | #endif /* CONFIG_PROC_FS */ | ||
| @@ -70,7 +70,7 @@ late_initcall(stackleak_sysctls_init); · 69 unmodified lines | |||
| 70 | #define skip_erasing() false | 70 | #define skip_erasing() false |
| 71 | #endif /* CONFIG_STACKLEAK_RUNTIME_DISABLE */ | 71 | #endif /* CONFIG_STACKLEAK_RUNTIME_DISABLE */ |
| 72 | 72 | ||
| 73 | asmlinkage void notrace stackleak_erase(void) | 73 | asmlinkage void noinstr stackleak_erase(void) |
| 74 | { | 74 | { |
| 75 | /* It would be nice not to have 'kstack_ptr' and 'boundary' on stack */ | 75 | /* It would be nice not to have 'kstack_ptr' and 'boundary' on stack */ |
| 76 | unsigned long kstack_ptr = current->lowest_stack; | 76 | unsigned long kstack_ptr = current->lowest_stack; |
| @@ -124,9 +124,8 @@ asmlinkage void notrace stackleak_erase(void) · 47 unmodified lines | |||
| 124 | /* Reset the 'lowest_stack' value for the next syscall */ | 124 | /* Reset the 'lowest_stack' value for the next syscall */ |
| 125 | current->lowest_stack = current_top_of_stack() - THREAD_SIZE/64; | 125 | current->lowest_stack = current_top_of_stack() - THREAD_SIZE/64; |
| 126 | } | 126 | } |
| 127 | NOKPROBE_SYMBOL(stackleak_erase); | ||
| 128 | 127 | ||
| 129 | void __used __no_caller_saved_registers notrace stackleak_track_stack(void) | 128 | void __used __no_caller_saved_registers noinstr stackleak_track_stack(void) |
| 130 | { | 129 | { |
| 131 | unsigned long sp = current_stack_pointer; | 130 | unsigned long sp = current_stack_pointer; |
| 132 | 131 | ||
| @@ -70,10 +70,16 @@ config HAVE_C_RECORDMCOUNT · 69 unmodified lines | |||
| 70 | help | 70 | help |
| 71 | C version of recordmcount available? | 71 | C version of recordmcount available? |
| 72 | 72 | ||
| 73 | config HAVE_BUILDTIME_MCOUNT_SORT | ||
| 74 | bool | ||
| 75 | help | ||
| 76 | An architecture selects this if it sorts the mcount_loc section | ||
| 77 | at build time. | ||
| 78 | |||
| 73 | config BUILDTIME_MCOUNT_SORT | 79 | config BUILDTIME_MCOUNT_SORT |
| 74 | bool | 80 | bool |
| 75 | default y | 81 | default y |
| 76 | depends on BUILDTIME_TABLE_SORT && !S390 | 82 | depends on HAVE_BUILDTIME_MCOUNT_SORT && DYNAMIC_FTRACE |
| 77 | help | 83 | help |
| 78 | Sort the mcount_loc section at build time. | 84 | Sort the mcount_loc section at build time. |
| 79 | 85 | ||
| @@ -7740,7 +7740,8 @@ static struct tracing_log_err *get_tracing_log_err(struct trace_array *tr) · 7739 unmodified lines | |||
| 7740 | err = kzalloc(sizeof(*err), GFP_KERNEL); | 7740 | err = kzalloc(sizeof(*err), GFP_KERNEL); |
| 7741 | if (!err) | 7741 | if (!err) |
| 7742 | err = ERR_PTR(-ENOMEM); | 7742 | err = ERR_PTR(-ENOMEM); |
| 7743 | tr->n_err_log_entries++; | 7743 | else |
| 7744 | tr->n_err_log_entries++; | ||
| 7744 | 7745 | ||
| 7745 | return err; | 7746 | return err; |
| 7746 | } | 7747 | } |
| @@ -2503,6 +2503,8 @@ static struct hist_field *parse_unary(struct hist_trigger_data *hist_data, · 2502 unmodified lines | |||
| 2503 | (HIST_FIELD_FL_TIMESTAMP | HIST_FIELD_FL_TIMESTAMP_USECS); | 2503 | (HIST_FIELD_FL_TIMESTAMP | HIST_FIELD_FL_TIMESTAMP_USECS); |
| 2504 | expr->fn = hist_field_unary_minus; | 2504 | expr->fn = hist_field_unary_minus; |
| 2505 | expr->operands[0] = operand1; | 2505 | expr->operands[0] = operand1; |
| 2506 | expr->size = operand1->size; | ||
| 2507 | expr->is_signed = operand1->is_signed; | ||
| 2506 | expr->operator = FIELD_OP_UNARY_MINUS; | 2508 | expr->operator = FIELD_OP_UNARY_MINUS; |
| 2507 | expr->name = expr_str(expr, 0); | 2509 | expr->name = expr_str(expr, 0); |
| 2508 | expr->type = kstrdup_const(operand1->type, GFP_KERNEL); | 2510 | expr->type = kstrdup_const(operand1->type, GFP_KERNEL); |
| @@ -2719,6 +2721,7 @@ static struct hist_field *parse_expr(struct hist_trigger_data *hist_data, · 210 unmodified lines | |||
| 2719 | 2721 | ||
| 2720 | /* The operand sizes should be the same, so just pick one */ | 2722 | /* The operand sizes should be the same, so just pick one */ |
| 2721 | expr->size = operand1->size; | 2723 | expr->size = operand1->size; |
| 2724 | expr->is_signed = operand1->is_signed; | ||
| 2722 | 2725 | ||
| 2723 | expr->operator = field_op; | 2726 | expr->operator = field_op; |
| 2724 | expr->type = kstrdup_const(operand1->type, GFP_KERNEL); | 2727 | expr->type = kstrdup_const(operand1->type, GFP_KERNEL); |
| @@ -3935,6 +3938,7 @@ static int trace_action_create(struct hist_trigger_data *hist_data, · 1210 unmodified lines | |||
| 3935 | 3938 | ||
| 3936 | var_ref_idx = find_var_ref_idx(hist_data, var_ref); | 3939 | var_ref_idx = find_var_ref_idx(hist_data, var_ref); |
| 3937 | if (WARN_ON(var_ref_idx < 0)) { | 3940 | if (WARN_ON(var_ref_idx < 0)) { |
| 3941 | kfree(p); | ||
| 3938 | ret = var_ref_idx; | 3942 | ret = var_ref_idx; |
| 3939 | goto err; | 3943 | goto err; |
| 3940 | } | 3944 | } |
| @@ -6163,7 +6167,9 @@ static int event_hist_trigger_parse(struct event_command *cmd_ops, · 2222 unmodified lines | |||
| 6163 | 6167 | ||
| 6164 | lockdep_assert_held(&event_mutex); | 6168 | lockdep_assert_held(&event_mutex); |
| 6165 | 6169 | ||
| 6166 | if (glob && strlen(glob)) { | 6170 | WARN_ON(!glob); |
| 6171 | |||
| 6172 | if (strlen(glob)) { | ||
| 6167 | hist_err_clear(); | 6173 | hist_err_clear(); |
| 6168 | last_cmd_set(file, param); | 6174 | last_cmd_set(file, param); |
| 6169 | } | 6175 | } |
| @@ -6196,7 +6202,7 @@ static int event_hist_trigger_parse(struct event_command *cmd_ops, · 26 unmodified lines | |||
| 6196 | continue; | 6202 | continue; |
| 6197 | } | 6203 | } |
| 6198 | break; | 6204 | break; |
| 6199 | } while (p); | 6205 | } while (1); |
| 6200 | 6206 | ||
| 6201 | if (!p) | 6207 | if (!p) |
| 6202 | param = NULL; | 6208 | param = NULL; |
| @@ -190,6 +190,7 @@ struct ucounts *alloc_ucounts(struct user_namespace *ns, kuid_t uid) · 189 unmodified lines | |||
| 190 | kfree(new); | 190 | kfree(new); |
| 191 | } else { | 191 | } else { |
| 192 | hlist_add_head(&new->node, hashent); | 192 | hlist_add_head(&new->node, hashent); |
| 193 | get_user_ns(new->ns); | ||
| 193 | spin_unlock_irq(&ucounts_lock); | 194 | spin_unlock_irq(&ucounts_lock); |
| 194 | return new; | 195 | return new; |
| 195 | } | 196 | } |
| @@ -210,6 +211,7 @@ void put_ucounts(struct ucounts *ucounts) · 14 unmodified lines | |||
| 210 | if (atomic_dec_and_lock_irqsave(&ucounts->count, &ucounts_lock, flags)) { | 211 | if (atomic_dec_and_lock_irqsave(&ucounts->count, &ucounts_lock, flags)) { |
| 211 | hlist_del_init(&ucounts->node); | 212 | hlist_del_init(&ucounts->node); |
| 212 | spin_unlock_irqrestore(&ucounts_lock, flags); | 213 | spin_unlock_irqrestore(&ucounts_lock, flags); |
| 214 | put_user_ns(ucounts->ns); | ||
| 213 | kfree(ucounts); | 215 | kfree(ucounts); |
| 214 | } | 216 | } |
| 215 | } | 217 | } |