diff --git a/android/abi_gki_aarch64.xml b/android/abi_gki_aarch64.xml index 0cde5a0ddf9e..a284b5f8c010 100755 --- a/android/abi_gki_aarch64.xml +++ b/android/abi_gki_aarch64.xml @@ -391,6 +391,9 @@ + + + @@ -468,6 +471,7 @@ + @@ -526,6 +530,15 @@ + + + + + + + + + @@ -561,6 +574,7 @@ + @@ -1282,6 +1296,7 @@ + @@ -2413,6 +2428,7 @@ + @@ -3074,16 +3090,19 @@ + + + @@ -5777,6 +5796,9 @@ + + + @@ -5866,6 +5888,7 @@ + @@ -5930,6 +5953,15 @@ + + + + + + + + + @@ -5965,6 +5997,7 @@ + @@ -80705,54 +80738,54 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -104620,66 +104653,66 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -113175,10 +113208,10 @@ - - - - + + + + @@ -114596,10 +114629,10 @@ - - - - + + + + @@ -114612,14 +114645,14 @@ - - - + + + - - - + + + @@ -115077,18 +115110,18 @@ - - - - + + + + - - - - - - + + + + + + @@ -115265,6 +115298,27 @@ + + + + + + + + + + + + + + + + + + + + + @@ -115356,10 +115410,10 @@ - - - - + + + + @@ -115741,6 +115795,12 @@ + + + + + + @@ -115831,11 +115891,11 @@ - - - - - + + + + + @@ -116106,6 +116166,63 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -116313,6 +116430,13 @@ + + + + + + + @@ -116439,11 +116563,11 @@ - + - - + + @@ -116519,8 +116643,8 @@ - - + + @@ -116548,12 +116672,15 @@ + + + - + @@ -116563,7 +116690,7 @@ - + @@ -116637,6 +116764,7 @@ + @@ -116653,7 +116781,7 @@ - + @@ -116701,6 +116829,15 @@ + + + + + + + + + @@ -116736,6 +116873,7 @@ + @@ -117777,8 +117915,8 @@ - - + + @@ -117788,8 +117926,8 @@ - - + + @@ -117807,27 +117945,27 @@ - - + + - - + + - - - - + + + + - - - + + + @@ -118034,12 +118172,12 @@ - - + + - - + + @@ -118067,19 +118205,19 @@ - - - + + + - - - + + + - - - + + + @@ -118205,28 +118343,28 @@ - - + + - - + + - - + + - - + + @@ -118234,10 +118372,10 @@ - - - - + + + + @@ -119501,9 +119639,9 @@ - - - + + + @@ -119511,13 +119649,13 @@ - - - - + + + + - + @@ -119556,45 +119694,45 @@ - - + + - - + + - + - - - + + + - - + + - - + + - - + + - - + + - - + + - - - + + + @@ -119611,25 +119749,25 @@ - - + + - - + + - - - + + + - - + + - - + + @@ -120512,6 +120650,12 @@ + + + + + + @@ -122156,16 +122300,16 @@ - - - - + + + + - - - - + + + + @@ -126499,6 +126643,10 @@ + + + + @@ -129856,6 +130004,11 @@ + + + + + @@ -129890,6 +130043,11 @@ + + + + + @@ -129913,6 +130071,11 @@ + + + + + @@ -131980,16 +132143,16 @@ - - - - + + + + - - - - + + + + @@ -133005,9 +133168,9 @@ - - - + + + @@ -134198,8 +134361,8 @@ - - + + @@ -135267,8 +135430,8 @@ - - + + @@ -135505,38 +135668,38 @@ - - + + - - + + - - - - + + + + - - + + - - + + - - + + - - + + - - + + @@ -138481,8 +138644,8 @@ - - + + @@ -138572,7 +138735,7 @@ - + @@ -138713,9 +138876,9 @@ - - - + + + diff --git a/android/abi_gki_aarch64_mtk b/android/abi_gki_aarch64_mtk index 9dd6a627f4ab..43ed832528e8 100644 --- a/android/abi_gki_aarch64_mtk +++ b/android/abi_gki_aarch64_mtk @@ -292,6 +292,7 @@ destroy_workqueue dev_alloc_name dev_base_lock + dev_change_flags dev_change_net_namespace dev_close dev_driver_string diff --git a/android/abi_gki_aarch64_oplus b/android/abi_gki_aarch64_oplus index 793058c27644..bb62b99da69a 100644 --- a/android/abi_gki_aarch64_oplus +++ b/android/abi_gki_aarch64_oplus @@ -974,6 +974,7 @@ get_user_pages get_user_pages_remote get_vaddr_frames + get_wchan get_zeroed_page gic_nonsecure_priorities gov_attr_set_get @@ -1112,8 +1113,8 @@ init_uts_ns init_wait_entry __init_waitqueue_head - inode_permission inode_owner_or_capable + inode_permission input_alloc_absinfo input_allocate_device input_close_device @@ -2604,6 +2605,9 @@ __traceiter_android_vh_clear_reserved_fmt_fields __traceiter_android_vh_commit_creds __traceiter_android_vh_cpufreq_acct_update_power + __traceiter_android_vh_cpufreq_fast_switch + __traceiter_android_vh_cpufreq_resolve_freq + __traceiter_android_vh_cpufreq_target __traceiter_android_vh_cpu_idle_enter __traceiter_android_vh_cpu_idle_exit __traceiter_android_vh_cpu_up @@ -2651,6 +2655,7 @@ __traceiter_android_vh_rwsem_write_finished __traceiter_android_vh_save_track_hash __traceiter_android_vh_save_vmalloc_stack + __traceiter_android_vh_sched_stat_runtime_rt __traceiter_android_vh_scheduler_tick __traceiter_android_vh_selinux_avc_insert __traceiter_android_vh_selinux_avc_lookup @@ -2694,6 +2699,7 @@ __traceiter_sched_overutilized_tp __traceiter_sched_stat_blocked __traceiter_sched_stat_iowait + __traceiter_sched_stat_runtime __traceiter_sched_stat_sleep __traceiter_sched_stat_wait __traceiter_sched_switch @@ -2790,6 +2796,9 @@ __tracepoint_android_vh_clear_reserved_fmt_fields __tracepoint_android_vh_commit_creds __tracepoint_android_vh_cpufreq_acct_update_power + __tracepoint_android_vh_cpufreq_fast_switch + __tracepoint_android_vh_cpufreq_resolve_freq + __tracepoint_android_vh_cpufreq_target __tracepoint_android_vh_cpu_idle_enter __tracepoint_android_vh_cpu_idle_exit __tracepoint_android_vh_cpu_up @@ -2837,6 +2846,7 @@ __tracepoint_android_vh_rwsem_write_finished __tracepoint_android_vh_save_track_hash __tracepoint_android_vh_save_vmalloc_stack + __tracepoint_android_vh_sched_stat_runtime_rt __tracepoint_android_vh_scheduler_tick __tracepoint_android_vh_selinux_avc_insert __tracepoint_android_vh_selinux_avc_lookup @@ -2883,6 +2893,7 @@ __tracepoint_sched_overutilized_tp __tracepoint_sched_stat_blocked __tracepoint_sched_stat_iowait + __tracepoint_sched_stat_runtime __tracepoint_sched_stat_sleep __tracepoint_sched_stat_wait __tracepoint_sched_switch diff --git a/android/abi_gki_aarch64_qcom b/android/abi_gki_aarch64_qcom index be9112998f23..c2a299356d27 100644 --- a/android/abi_gki_aarch64_qcom +++ b/android/abi_gki_aarch64_qcom @@ -2251,6 +2251,7 @@ smp_call_function smp_call_function_any smp_call_function_single + smp_call_function_single_async snd_card_free snd_card_new snd_card_register diff --git a/android/abi_gki_aarch64_vivo b/android/abi_gki_aarch64_vivo index f464cbad7f17..5ff5cad3dc1c 100644 --- a/android/abi_gki_aarch64_vivo +++ b/android/abi_gki_aarch64_vivo @@ -1749,6 +1749,15 @@ __traceiter_android_vh_ufs_send_command __traceiter_android_vh_ufs_update_sdev __traceiter_binder_transaction_received + __traceiter_block_bio_complete + __traceiter_block_bio_queue + __traceiter_block_getrq + __traceiter_block_rq_complete + __traceiter_block_rq_insert + __traceiter_block_rq_issue + __traceiter_block_rq_merge + __traceiter_block_rq_requeue + __traceiter_block_split __traceiter_cpu_frequency_limits __traceiter_cpu_idle __traceiter_dwc3_complete_trb @@ -1852,6 +1861,15 @@ __tracepoint_android_vh_ufs_update_sdev __tracepoint_android_vh_vmpressure __tracepoint_binder_transaction_received + __tracepoint_block_bio_complete + __tracepoint_block_bio_queue + __tracepoint_block_getrq + __tracepoint_block_rq_complete + __tracepoint_block_rq_insert + __tracepoint_block_rq_issue + __tracepoint_block_rq_merge + __tracepoint_block_rq_requeue + __tracepoint_block_split __tracepoint_cpu_frequency_limits __tracepoint_cpu_idle __tracepoint_dwc3_complete_trb diff --git a/android/abi_gki_aarch64_xiaomi b/android/abi_gki_aarch64_xiaomi index ff95f2ae9959..b6b8934aa985 100644 --- a/android/abi_gki_aarch64_xiaomi +++ b/android/abi_gki_aarch64_xiaomi @@ -40,6 +40,7 @@ scsi_print_command scsi_dma_map scsi_host_alloc + scsi_normalize_sense sg_copy_from_buffer sg_copy_to_buffer ufshcd_alloc_host @@ -58,6 +59,9 @@ blk_queue_update_dma_alignment blk_queue_update_dma_pad blk_ksm_get_slot_idx + mempool_resize + mempool_alloc_pages + mempool_free_pages #required by cs35l41 module regmap_raw_write_async diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c index 8cd9ef7bdf60..e11298294491 100644 --- a/arch/arm64/kernel/process.c +++ b/arch/arm64/kernel/process.c @@ -625,6 +625,7 @@ out: put_task_stack(p); return ret; } +EXPORT_SYMBOL_GPL(get_wchan); unsigned long arch_align_stack(unsigned long sp) { diff --git a/block/blk-core.c b/block/blk-core.c index 0e66579c299f..ac17d70157d6 100644 --- a/block/blk-core.c +++ b/block/blk-core.c @@ -58,6 +58,13 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(block_rq_remap); EXPORT_TRACEPOINT_SYMBOL_GPL(block_bio_complete); EXPORT_TRACEPOINT_SYMBOL_GPL(block_split); EXPORT_TRACEPOINT_SYMBOL_GPL(block_unplug); +EXPORT_TRACEPOINT_SYMBOL_GPL(block_bio_queue); +EXPORT_TRACEPOINT_SYMBOL_GPL(block_getrq); +EXPORT_TRACEPOINT_SYMBOL_GPL(block_rq_insert); +EXPORT_TRACEPOINT_SYMBOL_GPL(block_rq_issue); +EXPORT_TRACEPOINT_SYMBOL_GPL(block_rq_merge); +EXPORT_TRACEPOINT_SYMBOL_GPL(block_rq_requeue); +EXPORT_TRACEPOINT_SYMBOL_GPL(block_rq_complete); DEFINE_IDA(blk_queue_ida); diff --git a/crypto/fips140-module.h b/crypto/fips140-module.h index ff99d5b2ab4a..b83547726a0f 100644 --- a/crypto/fips140-module.h +++ b/crypto/fips140-module.h @@ -8,17 +8,17 @@ #include #include +#include #undef pr_fmt #define pr_fmt(fmt) "fips140: " fmt /* * This is the name and version number of the module that are shown on the FIPS - * certificate. These don't necessarily have any relation to the filename of - * the .ko file, or to the git branch or commit ID. + * certificate. */ #define FIPS140_MODULE_NAME "Android Kernel Cryptographic Module" -#define FIPS140_MODULE_VERSION "v1.0" +#define FIPS140_MODULE_VERSION UTS_RELEASE #ifdef CONFIG_CRYPTO_FIPS140_MOD_ERROR_INJECTION extern char *fips140_broken_alg; diff --git a/drivers/android/binder.c b/drivers/android/binder.c index 25f4afbe6d60..1e1d2dfd9d3f 100644 --- a/drivers/android/binder.c +++ b/drivers/android/binder.c @@ -2180,7 +2180,8 @@ static int binder_translate_binder(struct flat_binder_object *fp, ret = -EINVAL; goto done; } - if (security_binder_transfer_binder(proc->tsk, target_proc->tsk)) { + if (security_binder_transfer_binder(binder_get_cred(proc), + binder_get_cred(target_proc))) { ret = -EPERM; goto done; } @@ -2226,7 +2227,8 @@ static int binder_translate_handle(struct flat_binder_object *fp, proc->pid, thread->pid, fp->handle); return -EINVAL; } - if (security_binder_transfer_binder(proc->tsk, target_proc->tsk)) { + if (security_binder_transfer_binder(binder_get_cred(proc), + binder_get_cred(target_proc))) { ret = -EPERM; goto done; } @@ -2314,7 +2316,8 @@ static int binder_translate_fd(u32 fd, binder_size_t fd_offset, ret = -EBADF; goto err_fget; } - ret = security_binder_transfer_file(proc->tsk, target_proc->tsk, file); + ret = security_binder_transfer_file(binder_get_cred(proc), + binder_get_cred(target_proc), file); if (ret < 0) { ret = -EPERM; goto err_security; @@ -2724,8 +2727,8 @@ static void binder_transaction(struct binder_proc *proc, } e->to_node = target_node->debug_id; trace_android_vh_binder_trans(target_proc, proc, thread, tr); - if (security_binder_transaction(proc->tsk, - target_proc->tsk) < 0) { + if (security_binder_transaction(binder_get_cred(proc), + binder_get_cred(target_proc)) < 0) { return_error = BR_FAILED_REPLY; return_error_param = -EPERM; return_error_line = __LINE__; @@ -2793,6 +2796,7 @@ static void binder_transaction(struct binder_proc *proc, if (target_thread) e->to_thread = target_thread->pid; e->to_proc = target_proc->pid; + trace_android_rvh_binder_transaction(target_proc, proc, thread, tr); /* TODO: reuse incoming transaction for reply */ t = kzalloc(sizeof(*t), GFP_KERNEL); @@ -2861,7 +2865,7 @@ static void binder_transaction(struct binder_proc *proc, size_t added_size; int max_retries = 100; - security_task_getsecid(proc->tsk, &secid); + security_cred_getsecid(binder_get_cred(proc), &secid); retry_alloc: ret = security_secid_to_secctx(secid, &secctx, &secctx_sz); if (ret == -ENOMEM && max_retries-- > 0) { @@ -4486,6 +4490,8 @@ static struct binder_thread *binder_get_thread(struct binder_proc *proc) static void binder_free_proc(struct binder_proc *proc) { struct binder_device *device; + struct binder_proc_ext *eproc = + container_of(proc, struct binder_proc_ext, proc); BUG_ON(!list_empty(&proc->todo)); BUG_ON(!list_empty(&proc->delivered_death)); @@ -4499,8 +4505,9 @@ static void binder_free_proc(struct binder_proc *proc) } binder_alloc_deferred_release(&proc->alloc); put_task_struct(proc->tsk); + put_cred(eproc->cred); binder_stats_deleted(BINDER_STAT_PROC); - kfree(proc); + kfree(eproc); } static void binder_free_thread(struct binder_thread *thread) @@ -4711,7 +4718,7 @@ static int binder_ioctl_set_ctx_mgr(struct file *filp, ret = -EBUSY; goto out; } - ret = security_binder_set_context_mgr(proc->tsk); + ret = security_binder_set_context_mgr(binder_get_cred(proc)); if (ret < 0) goto out; if (uid_valid(context->binder_context_mgr_uid)) { @@ -5187,6 +5194,7 @@ static int binder_mmap(struct file *filp, struct vm_area_struct *vma) static int binder_open(struct inode *nodp, struct file *filp) { struct binder_proc *proc, *itr; + struct binder_proc_ext *eproc; struct binder_device *binder_dev; struct binderfs_info *info; struct dentry *binder_binderfs_dir_entry_proc = NULL; @@ -5195,13 +5203,15 @@ static int binder_open(struct inode *nodp, struct file *filp) binder_debug(BINDER_DEBUG_OPEN_CLOSE, "%s: %d:%d\n", __func__, current->group_leader->pid, current->pid); - proc = kzalloc(sizeof(*proc), GFP_KERNEL); + eproc = kzalloc(sizeof(*eproc), GFP_KERNEL); + proc = &eproc->proc; if (proc == NULL) return -ENOMEM; spin_lock_init(&proc->inner_lock); spin_lock_init(&proc->outer_lock); get_task_struct(current->group_leader); proc->tsk = current->group_leader; + eproc->cred = get_cred(filp->f_cred); INIT_LIST_HEAD(&proc->todo); init_waitqueue_head(&proc->freeze_wait); if (binder_supported_policy(current->policy)) { diff --git a/drivers/android/binder_internal.h b/drivers/android/binder_internal.h index 8508a7e45865..93f02395b0d7 100644 --- a/drivers/android/binder_internal.h +++ b/drivers/android/binder_internal.h @@ -473,6 +473,29 @@ struct binder_proc { bool oneway_spam_detection_enabled; }; +/** + * struct binder_proc_ext - binder process bookkeeping + * @proc: element for binder_procs list + * @cred struct cred associated with the `struct file` + * in binder_open() + * (invariant after initialized) + * + * Extended binder_proc -- needed to add the "cred" field without + * changing the KMI for binder_proc. + */ +struct binder_proc_ext { + struct binder_proc proc; + const struct cred *cred; +}; + +static inline const struct cred *binder_get_cred(struct binder_proc *proc) +{ + struct binder_proc_ext *eproc; + + eproc = container_of(proc, struct binder_proc_ext, proc); + return eproc->cred; +} + /** * struct binder_thread - binder thread bookkeeping * @proc: binder process for this thread diff --git a/drivers/android/vendor_hooks.c b/drivers/android/vendor_hooks.c index 1f6ac9318411..9d2a765b164d 100644 --- a/drivers/android/vendor_hooks.c +++ b/drivers/android/vendor_hooks.c @@ -136,6 +136,9 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_show_suspend_epoch_val); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_show_resume_epoch_val); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_show_max_freq); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_freq_table_limits); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_cpufreq_resolve_freq); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_cpufreq_fast_switch); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_cpufreq_target); EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_sched_newidle_balance); EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_sched_nohz_balancer_kick); EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_sched_rebalance_domains); @@ -286,6 +289,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_timerfd_create); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_alloc_new_buf_locked); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_reply); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_trans); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_binder_transaction); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_preset); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_proc_transaction); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_new_ref); @@ -312,6 +316,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_dequeue_entity); EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_entity_tick); EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_enqueue_task_fair); EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_dequeue_task_fair); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_sched_stat_runtime_rt); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_prepare_update_load_avg_se); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_finish_update_load_avg_se); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_selinux_is_initialized); diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index f0ec98dbfc96..5ea258839bcc 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -543,7 +543,10 @@ EXPORT_SYMBOL_GPL(cpufreq_disable_fast_switch); unsigned int cpufreq_driver_resolve_freq(struct cpufreq_policy *policy, unsigned int target_freq) { + unsigned int old_target_freq = target_freq; + target_freq = clamp_val(target_freq, policy->min, policy->max); + trace_android_vh_cpufreq_resolve_freq(policy, target_freq, old_target_freq); policy->cached_target_freq = target_freq; if (cpufreq_driver->target_index) { @@ -2094,9 +2097,11 @@ unsigned int cpufreq_driver_fast_switch(struct cpufreq_policy *policy, unsigned int target_freq) { unsigned int freq; + unsigned int old_target_freq = target_freq; int cpu; target_freq = clamp_val(target_freq, policy->min, policy->max); + trace_android_vh_cpufreq_fast_switch(policy, target_freq, old_target_freq); freq = cpufreq_driver->fast_switch(policy, target_freq); if (!freq) @@ -2213,6 +2218,7 @@ int __cpufreq_driver_target(struct cpufreq_policy *policy, /* Make sure that target_freq is within supported range */ target_freq = clamp_val(target_freq, policy->min, policy->max); + trace_android_vh_cpufreq_target(policy, target_freq, old_target_freq); pr_debug("target for CPU %u: %u kHz, relation %u, requested %u kHz\n", policy->cpu, target_freq, relation, old_target_freq); diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c index 0ee38382ba17..e4fdefbfe107 100644 --- a/drivers/dma-buf/dma-buf.c +++ b/drivers/dma-buf/dma-buf.c @@ -1425,6 +1425,7 @@ static int dma_buf_debug_show(struct seq_file *s, void *unused) if (ret) goto error_unlock; + spin_lock(&buf_obj->name_lock); seq_printf(s, "%08zu\t%08x\t%08x\t%08ld\t%s\t%08lu\t%s\n", buf_obj->size, buf_obj->file->f_flags, buf_obj->file->f_mode, @@ -1432,6 +1433,7 @@ static int dma_buf_debug_show(struct seq_file *s, void *unused) buf_obj->exp_name, file_inode(buf_obj->file)->i_ino, buf_obj->name ?: ""); + spin_unlock(&buf_obj->name_lock); robj = buf_obj->resv; while (true) { diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index fd177426b46d..a090e3bf7c64 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -1873,8 +1873,9 @@ int f2fs_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, u64 logical = 0, phys = 0, size = 0; u32 flags = 0; int ret = 0; - bool compr_cluster = false; + bool compr_cluster = false, compr_appended; unsigned int cluster_size = F2FS_I(inode)->i_cluster_size; + unsigned int count_in_cluster = 0; loff_t maxbytes; if (fieinfo->fi_flags & FIEMAP_FLAG_CACHE) { @@ -1922,15 +1923,17 @@ next: map.m_next_pgofs = &next_pgofs; map.m_seg_type = NO_CHECK_TYPE; - if (compr_cluster) - map.m_len = cluster_size - 1; + if (compr_cluster) { + map.m_lblk += 1; + map.m_len = cluster_size - count_in_cluster; + } ret = f2fs_map_blocks(inode, &map, 0, F2FS_GET_BLOCK_FIEMAP); if (ret) goto out; /* HOLE */ - if (!(map.m_flags & F2FS_MAP_FLAGS)) { + if (!compr_cluster && !(map.m_flags & F2FS_MAP_FLAGS)) { start_blk = next_pgofs; if (blks_to_bytes(inode, start_blk) < blks_to_bytes(inode, @@ -1940,6 +1943,14 @@ next: flags |= FIEMAP_EXTENT_LAST; } + compr_appended = false; + /* In a case of compressed cluster, append this to the last extent */ + if (compr_cluster && ((map.m_flags & F2FS_MAP_UNWRITTEN) || + !(map.m_flags & F2FS_MAP_FLAGS))) { + compr_appended = true; + goto skip_fill; + } + if (size) { flags |= FIEMAP_EXTENT_MERGED; if (IS_ENCRYPTED(inode)) @@ -1956,39 +1967,37 @@ next: if (start_blk > last_blk) goto out; - if (compr_cluster) { - compr_cluster = false; - - - logical = blks_to_bytes(inode, start_blk - 1); - phys = blks_to_bytes(inode, map.m_pblk); - size = blks_to_bytes(inode, cluster_size); - - flags |= FIEMAP_EXTENT_ENCODED; - - start_blk += cluster_size - 1; - - if (start_blk > last_blk) - goto out; - - goto prep_next; - } - +skip_fill: if (map.m_pblk == COMPRESS_ADDR) { compr_cluster = true; - start_blk++; - goto prep_next; + count_in_cluster = 1; + } else if (compr_appended) { + unsigned int appended_blks = cluster_size - + count_in_cluster + 1; + size += blks_to_bytes(inode, appended_blks); + start_blk += appended_blks; + compr_cluster = false; + } else { + logical = blks_to_bytes(inode, start_blk); + phys = __is_valid_data_blkaddr(map.m_pblk) ? + blks_to_bytes(inode, map.m_pblk) : 0; + size = blks_to_bytes(inode, map.m_len); + flags = 0; + + if (compr_cluster) { + flags = FIEMAP_EXTENT_ENCODED; + count_in_cluster += map.m_len; + if (count_in_cluster == cluster_size) { + compr_cluster = false; + size += blks_to_bytes(inode, 1); + } + } else if (map.m_flags & F2FS_MAP_UNWRITTEN) { + flags = FIEMAP_EXTENT_UNWRITTEN; + } + + start_blk += bytes_to_blks(inode, size); } - logical = blks_to_bytes(inode, start_blk); - phys = blks_to_bytes(inode, map.m_pblk); - size = blks_to_bytes(inode, map.m_len); - flags = 0; - if (map.m_flags & F2FS_MAP_UNWRITTEN) - flags = FIEMAP_EXTENT_UNWRITTEN; - - start_blk += bytes_to_blks(inode, size); - prep_next: cond_resched(); if (fatal_signal_pending(current)) diff --git a/include/linux/lsm_hook_defs.h b/include/linux/lsm_hook_defs.h index 435a2e22ff95..37dc5594081d 100644 --- a/include/linux/lsm_hook_defs.h +++ b/include/linux/lsm_hook_defs.h @@ -26,13 +26,13 @@ * #undef LSM_HOOK * }; */ -LSM_HOOK(int, 0, binder_set_context_mgr, struct task_struct *mgr) -LSM_HOOK(int, 0, binder_transaction, struct task_struct *from, - struct task_struct *to) -LSM_HOOK(int, 0, binder_transfer_binder, struct task_struct *from, - struct task_struct *to) -LSM_HOOK(int, 0, binder_transfer_file, struct task_struct *from, - struct task_struct *to, struct file *file) +LSM_HOOK(int, 0, binder_set_context_mgr, const struct cred *mgr) +LSM_HOOK(int, 0, binder_transaction, const struct cred *from, + const struct cred *to) +LSM_HOOK(int, 0, binder_transfer_binder, const struct cred *from, + const struct cred *to) +LSM_HOOK(int, 0, binder_transfer_file, const struct cred *from, + const struct cred *to, struct file *file) LSM_HOOK(int, 0, ptrace_access_check, struct task_struct *child, unsigned int mode) LSM_HOOK(int, 0, ptrace_traceme, struct task_struct *parent) diff --git a/include/linux/lsm_hooks.h b/include/linux/lsm_hooks.h index 3af055b7ee1f..0ad8aa657914 100644 --- a/include/linux/lsm_hooks.h +++ b/include/linux/lsm_hooks.h @@ -1297,22 +1297,22 @@ * * @binder_set_context_mgr: * Check whether @mgr is allowed to be the binder context manager. - * @mgr contains the task_struct for the task being registered. + * @mgr contains the struct cred for the current binder process. * Return 0 if permission is granted. * @binder_transaction: * Check whether @from is allowed to invoke a binder transaction call * to @to. - * @from contains the task_struct for the sending task. - * @to contains the task_struct for the receiving task. + * @from contains the struct cred for the sending process. + * @to contains the struct cred for the receiving process. * @binder_transfer_binder: * Check whether @from is allowed to transfer a binder reference to @to. - * @from contains the task_struct for the sending task. - * @to contains the task_struct for the receiving task. + * @from contains the struct cred for the sending process. + * @to contains the struct cred for the receiving process. * @binder_transfer_file: * Check whether @from is allowed to transfer @file to @to. - * @from contains the task_struct for the sending task. + * @from contains the struct cred for the sending process. * @file contains the struct file being transferred. - * @to contains the task_struct for the receiving task. + * @to contains the struct cred for the receiving process. * * @ptrace_access_check: * Check permission before allowing the current process to trace the diff --git a/include/linux/security.h b/include/linux/security.h index 48c6ed9ba086..a87cbacab078 100644 --- a/include/linux/security.h +++ b/include/linux/security.h @@ -252,13 +252,13 @@ extern int security_init(void); extern int early_security_init(void); /* Security operations */ -int security_binder_set_context_mgr(struct task_struct *mgr); -int security_binder_transaction(struct task_struct *from, - struct task_struct *to); -int security_binder_transfer_binder(struct task_struct *from, - struct task_struct *to); -int security_binder_transfer_file(struct task_struct *from, - struct task_struct *to, struct file *file); +int security_binder_set_context_mgr(const struct cred *mgr); +int security_binder_transaction(const struct cred *from, + const struct cred *to); +int security_binder_transfer_binder(const struct cred *from, + const struct cred *to); +int security_binder_transfer_file(const struct cred *from, + const struct cred *to, struct file *file); int security_ptrace_access_check(struct task_struct *child, unsigned int mode); int security_ptrace_traceme(struct task_struct *parent); int security_capget(struct task_struct *target, @@ -494,25 +494,25 @@ static inline int early_security_init(void) return 0; } -static inline int security_binder_set_context_mgr(struct task_struct *mgr) +static inline int security_binder_set_context_mgr(const struct cred *mgr) { return 0; } -static inline int security_binder_transaction(struct task_struct *from, - struct task_struct *to) +static inline int security_binder_transaction(const struct cred *from, + const struct cred *to) { return 0; } -static inline int security_binder_transfer_binder(struct task_struct *from, - struct task_struct *to) +static inline int security_binder_transfer_binder(const struct cred *from, + const struct cred *to) { return 0; } -static inline int security_binder_transfer_file(struct task_struct *from, - struct task_struct *to, +static inline int security_binder_transfer_file(const struct cred *from, + const struct cred *to, struct file *file) { return 0; @@ -1011,6 +1011,11 @@ static inline void security_transfer_creds(struct cred *new, { } +static inline void security_cred_getsecid(const struct cred *c, u32 *secid) +{ + *secid = 0; +} + static inline int security_kernel_act_as(struct cred *cred, u32 secid) { return 0; diff --git a/include/trace/hooks/binder.h b/include/trace/hooks/binder.h index ffba8746e58b..36a70248f5cf 100644 --- a/include/trace/hooks/binder.h +++ b/include/trace/hooks/binder.h @@ -52,6 +52,10 @@ DECLARE_HOOK(android_vh_binder_trans, TP_PROTO(struct binder_proc *target_proc, struct binder_proc *proc, struct binder_thread *thread, struct binder_transaction_data *tr), TP_ARGS(target_proc, proc, thread, tr)); +DECLARE_RESTRICTED_HOOK(android_rvh_binder_transaction, + TP_PROTO(struct binder_proc *target_proc, struct binder_proc *proc, + struct binder_thread *thread, struct binder_transaction_data *tr), + TP_ARGS(target_proc, proc, thread, tr), 1); DECLARE_HOOK(android_vh_binder_preset, TP_PROTO(struct hlist_head *hhead, struct mutex *lock), TP_ARGS(hhead, lock)); diff --git a/include/trace/hooks/cpufreq.h b/include/trace/hooks/cpufreq.h index 500c96ac7776..5e20f7d00d3d 100644 --- a/include/trace/hooks/cpufreq.h +++ b/include/trace/hooks/cpufreq.h @@ -31,6 +31,21 @@ DECLARE_HOOK(android_vh_cpufreq_acct_update_power, DECLARE_RESTRICTED_HOOK(android_rvh_cpufreq_transition, TP_PROTO(struct cpufreq_policy *policy), TP_ARGS(policy), 1); + +DECLARE_HOOK(android_vh_cpufreq_resolve_freq, + TP_PROTO(struct cpufreq_policy *policy, unsigned int target_freq, + unsigned int old_target_freq), + TP_ARGS(policy, target_freq, old_target_freq)); + +DECLARE_HOOK(android_vh_cpufreq_fast_switch, + TP_PROTO(struct cpufreq_policy *policy, unsigned int target_freq, + unsigned int old_target_freq), + TP_ARGS(policy, target_freq, old_target_freq)); + +DECLARE_HOOK(android_vh_cpufreq_target, + TP_PROTO(struct cpufreq_policy *policy, unsigned int target_freq, + unsigned int old_target_freq), + TP_ARGS(policy, target_freq, old_target_freq)); /* macro versions of hooks are no longer required */ #endif /* _TRACE_HOOK_CPUFREQ_H */ diff --git a/include/trace/hooks/sched.h b/include/trace/hooks/sched.h index 3b7d022c4328..78f57b106e6c 100644 --- a/include/trace/hooks/sched.h +++ b/include/trace/hooks/sched.h @@ -354,6 +354,10 @@ DECLARE_HOOK(android_vh_prepare_update_load_avg_se, TP_PROTO(struct sched_entity *se, int flags), TP_ARGS(se, flags)); +DECLARE_HOOK(android_vh_sched_stat_runtime_rt, + TP_PROTO(struct task_struct *tsk, u64 delta), + TP_ARGS(tsk, delta)); + DECLARE_HOOK(android_vh_finish_update_load_avg_se, TP_PROTO(struct sched_entity *se, int flags), TP_ARGS(se, flags)); diff --git a/include/uapi/linux/virtio_ids.h b/include/uapi/linux/virtio_ids.h index b052355ac7a3..bc740d6d2259 100644 --- a/include/uapi/linux/virtio_ids.h +++ b/include/uapi/linux/virtio_ids.h @@ -45,6 +45,7 @@ #define VIRTIO_ID_CRYPTO 20 /* virtio crypto */ #define VIRTIO_ID_IOMMU 23 /* virtio IOMMU */ #define VIRTIO_ID_MEM 24 /* virtio mem */ +#define VIRTIO_ID_SOUND 25 /* virtio sound */ #define VIRTIO_ID_FS 26 /* virtio filesystem */ #define VIRTIO_ID_PMEM 27 /* virtio pmem */ #define VIRTIO_ID_MAC80211_HWSIM 29 /* virtio mac80211-hwsim */ diff --git a/kernel/locking/rwsem.c b/kernel/locking/rwsem.c index e0505b9b8a31..7b0d64f0d550 100644 --- a/kernel/locking/rwsem.c +++ b/kernel/locking/rwsem.c @@ -1287,7 +1287,7 @@ out_nolock: list_del(&waiter.list); if (unlikely(wstate == WRITER_HANDOFF)) - atomic_long_add(-RWSEM_FLAG_HANDOFF, &sem->count); + atomic_long_andnot(RWSEM_FLAG_HANDOFF, &sem->count); if (list_empty(&sem->wait_list)) atomic_long_andnot(RWSEM_FLAG_WAITERS, &sem->count); diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 74ee2d1d16ce..7d009aaccb72 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -24,6 +24,8 @@ #include +EXPORT_TRACEPOINT_SYMBOL_GPL(sched_stat_runtime); + /* * Targeted preemption latency for CPU-bound tasks: * @@ -3509,9 +3511,10 @@ update_tg_cfs_runnable(struct cfs_rq *cfs_rq, struct sched_entity *se, struct cf static inline void update_tg_cfs_load(struct cfs_rq *cfs_rq, struct sched_entity *se, struct cfs_rq *gcfs_rq) { - long delta, running_sum, runnable_sum = gcfs_rq->prop_runnable_sum; + long delta_avg, running_sum, runnable_sum = gcfs_rq->prop_runnable_sum; unsigned long load_avg; u64 load_sum = 0; + s64 delta_sum; u32 divider; if (!runnable_sum) @@ -3558,13 +3561,13 @@ update_tg_cfs_load(struct cfs_rq *cfs_rq, struct sched_entity *se, struct cfs_rq load_sum = (s64)se_weight(se) * runnable_sum; load_avg = div_s64(load_sum, divider); - delta = load_avg - se->avg.load_avg; + delta_sum = load_sum - (s64)se_weight(se) * se->avg.load_sum; + delta_avg = load_avg - se->avg.load_avg; se->avg.load_sum = runnable_sum; se->avg.load_avg = load_avg; - - add_positive(&cfs_rq->avg.load_avg, delta); - cfs_rq->avg.load_sum = cfs_rq->avg.load_avg * divider; + add_positive(&cfs_rq->avg.load_avg, delta_avg); + add_positive(&cfs_rq->avg.load_sum, delta_sum); } static inline void add_tg_cfs_propagate(struct cfs_rq *cfs_rq, long runnable_sum) @@ -3680,15 +3683,15 @@ update_cfs_rq_load_avg(u64 now, struct cfs_rq *cfs_rq) r = removed_load; sub_positive(&sa->load_avg, r); - sa->load_sum = sa->load_avg * divider; + sub_positive(&sa->load_sum, r * divider); r = removed_util; sub_positive(&sa->util_avg, r); - sa->util_sum = sa->util_avg * divider; + sub_positive(&sa->util_sum, r * divider); r = removed_runnable; sub_positive(&sa->runnable_avg, r); - sa->runnable_sum = sa->runnable_avg * divider; + sub_positive(&sa->runnable_sum, r * divider); /* * removed_runnable is the unweighted version of removed_load so we @@ -3775,17 +3778,11 @@ static void attach_entity_load_avg(struct cfs_rq *cfs_rq, struct sched_entity *s */ static void detach_entity_load_avg(struct cfs_rq *cfs_rq, struct sched_entity *se) { - /* - * cfs_rq->avg.period_contrib can be used for both cfs_rq and se. - * See ___update_load_avg() for details. - */ - u32 divider = get_pelt_divider(&cfs_rq->avg); - dequeue_load_avg(cfs_rq, se); sub_positive(&cfs_rq->avg.util_avg, se->avg.util_avg); - cfs_rq->avg.util_sum = cfs_rq->avg.util_avg * divider; + sub_positive(&cfs_rq->avg.util_sum, se->avg.util_sum); sub_positive(&cfs_rq->avg.runnable_avg, se->avg.runnable_avg); - cfs_rq->avg.runnable_sum = cfs_rq->avg.runnable_avg * divider; + sub_positive(&cfs_rq->avg.runnable_sum, se->avg.runnable_sum); add_tg_cfs_propagate(cfs_rq, -se->avg.load_sum); diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c index da40e5f07a57..1c4b0b14777f 100644 --- a/kernel/sched/rt.c +++ b/kernel/sched/rt.c @@ -1026,6 +1026,8 @@ static void update_curr_rt(struct rq *rq) curr->se.exec_start = now; cgroup_account_cputime(curr, delta_exec); + trace_android_vh_sched_stat_runtime_rt(curr, delta_exec); + if (!rt_bandwidth_enabled()) return; diff --git a/scripts/setlocalversion b/scripts/setlocalversion index 3f8a8ee14b10..842936656b84 100755 --- a/scripts/setlocalversion +++ b/scripts/setlocalversion @@ -41,8 +41,6 @@ if test $# -gt 0; then kmi_generation=$1 [ $(expr $kmi_generation : '^[0-9]\+$') -eq 0 ] && usage shift - else - usage fi fi if test $# -gt 0 -o ! -d "$srctree"; then @@ -68,6 +66,8 @@ scm_version() if [ -n "$android_release" ] && [ -n "$kmi_generation" ]; then printf '%s' "-$android_release-$kmi_generation" + elif [ -n "$android_release" ]; then + printf '%s' "-$android_release" fi # If we are at a tagged commit (like "v2.6.30-rc6"), we ignore diff --git a/security/security.c b/security/security.c index cf8ddcae1c6b..1e0f79c665a3 100644 --- a/security/security.c +++ b/security/security.c @@ -689,25 +689,25 @@ static void __init lsm_early_task(struct task_struct *task) /* Security operations */ -int security_binder_set_context_mgr(struct task_struct *mgr) +int security_binder_set_context_mgr(const struct cred *mgr) { return call_int_hook(binder_set_context_mgr, 0, mgr); } -int security_binder_transaction(struct task_struct *from, - struct task_struct *to) +int security_binder_transaction(const struct cred *from, + const struct cred *to) { return call_int_hook(binder_transaction, 0, from, to); } -int security_binder_transfer_binder(struct task_struct *from, - struct task_struct *to) +int security_binder_transfer_binder(const struct cred *from, + const struct cred *to) { return call_int_hook(binder_transfer_binder, 0, from, to); } -int security_binder_transfer_file(struct task_struct *from, - struct task_struct *to, struct file *file) +int security_binder_transfer_file(const struct cred *from, + const struct cred *to, struct file *file) { return call_int_hook(binder_transfer_file, 0, from, to, file); } diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c index a490c8449cac..0a18cbc641e3 100644 --- a/security/selinux/hooks.c +++ b/security/selinux/hooks.c @@ -2007,22 +2007,19 @@ static inline u32 open_file_to_av(struct file *file) /* Hook functions begin here. */ -static int selinux_binder_set_context_mgr(struct task_struct *mgr) +static int selinux_binder_set_context_mgr(const struct cred *mgr) { - u32 mysid = current_sid(); - u32 mgrsid = task_sid(mgr); - return avc_has_perm(&selinux_state, - mysid, mgrsid, SECCLASS_BINDER, + current_sid(), cred_sid(mgr), SECCLASS_BINDER, BINDER__SET_CONTEXT_MGR, NULL); } -static int selinux_binder_transaction(struct task_struct *from, - struct task_struct *to) +static int selinux_binder_transaction(const struct cred *from, + const struct cred *to) { u32 mysid = current_sid(); - u32 fromsid = task_sid(from); - u32 tosid = task_sid(to); + u32 fromsid = cred_sid(from); + u32 tosid = cred_sid(to); int rc; if (mysid != fromsid) { @@ -2033,27 +2030,24 @@ static int selinux_binder_transaction(struct task_struct *from, return rc; } - return avc_has_perm(&selinux_state, - fromsid, tosid, SECCLASS_BINDER, BINDER__CALL, - NULL); + return avc_has_perm(&selinux_state, fromsid, tosid, + SECCLASS_BINDER, BINDER__CALL, NULL); } -static int selinux_binder_transfer_binder(struct task_struct *from, - struct task_struct *to) +static int selinux_binder_transfer_binder(const struct cred *from, + const struct cred *to) { - u32 fromsid = task_sid(from); - u32 tosid = task_sid(to); - return avc_has_perm(&selinux_state, - fromsid, tosid, SECCLASS_BINDER, BINDER__TRANSFER, + cred_sid(from), cred_sid(to), + SECCLASS_BINDER, BINDER__TRANSFER, NULL); } -static int selinux_binder_transfer_file(struct task_struct *from, - struct task_struct *to, +static int selinux_binder_transfer_file(const struct cred *from, + const struct cred *to, struct file *file) { - u32 sid = task_sid(to); + u32 sid = cred_sid(to); struct file_security_struct *fsec = selinux_file(file); struct dentry *dentry = file->f_path.dentry; struct inode_security_struct *isec;