Merge branch 'android11-5.4' into 'android11-5.4-lts'

Sync up with android11-5.4 for the following commits:

e83321764f ANDROID: KMI symbol lists: migrate section name
ba4ec0ee1b ANDROID: ABI: Update allowed list for GALAXY
f82716d6b7 ANDROID: hikey960_gki.fragment: Remove UFS and USB bits
5d5378d608 ANDROID: lkdtm/usercopy: Use __va_function to find proper vm_mmap address
a3cb7a0327 ANDROID: mm: add generic __va_function and __pa_function
802f342713 ANDROID: vendor_hooks: Add hooks for debugging exception context
40f057fb2d FROMGIT: mm, oom_adj: don't loop through tasks in __set_oom_adj when not necessary

Change-Id: Icccde6e1c6380b07df854f12472041f4b1b5612c
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
This commit is contained in:
Greg Kroah-Hartman 2020-09-18 13:24:45 +02:00
commit 33dffcb6ef
25 changed files with 662 additions and 529 deletions

File diff suppressed because it is too large Load diff

View file

@ -1,4 +1,4 @@
[abi_whitelist]
[abi_symbol_list]
# commonly used symbols
add_wait_queue
alloc_etherdev_mqs

View file

@ -1,4 +1,4 @@
[abi_whitelist]
[abi_symbol_list]
# commonly used symbols
__arch_copy_from_user
__arch_copy_to_user

View file

@ -1,4 +1,4 @@
[abi_whitelist]
[abi_symbol_list]
add_timer
add_timer_on
add_uevent_var

View file

@ -1,4 +1,4 @@
[abi_whitelist]
[abi_symbol_list]
___ratelimit
__alloc_disk_node
__alloc_pages_nodemask
@ -93,6 +93,7 @@
__mutex_init
__napi_alloc_skb
__napi_schedule
__napi_schedule_irqoff
__netdev_alloc_skb
__netlink_kernel_create
__nlmsg_put
@ -145,6 +146,8 @@
__tasklet_schedule
__trace_bprintk
__tracepoint_android_vh_is_fpsimd_save
__tracepoint_android_vh_kfree_skb
__tracepoint_android_vh_ptype_head
__tracepoint_device_pm_callback_end
__tracepoint_device_pm_callback_start
__tracepoint_pelt_cfs_tp
@ -415,6 +418,8 @@
cpufreq_table_index_unsorted
cpufreq_unregister_driver
cpuhp_tasks_frozen
cpuidle_pause_and_lock
cpuidle_resume_and_unlock
cpumask_next
cpumask_next_and
cpus_read_lock
@ -797,6 +802,7 @@
drm_dp_update_payload_part1
drm_dp_update_payload_part2
drm_edid_duplicate
drm_edid_get_monitor_name
drm_encoder_cleanup
drm_encoder_init
drm_err
@ -853,6 +859,7 @@
drm_mode_create
drm_mode_create_dp_colorspace_property
drm_mode_debug_printmodeline
drm_mode_destroy
drm_mode_duplicate
drm_mode_equal
drm_mode_object_find
@ -987,6 +994,7 @@
get_cpu_device
get_cpu_idle_time
get_device
get_options
get_pid_task
get_random_bytes
get_random_u32
@ -1041,6 +1049,8 @@
gpiod_set_value
gpiod_set_value_cansleep
gpiod_to_irq
gro_find_complete_by_type
gro_find_receive_by_type
gs_alloc_req
gs_free_req
gserial_alloc_line
@ -1131,6 +1141,7 @@
iio_read_channel_processed
iio_read_channel_raw
import_iovec
in_aton
in_egroup_p
init_dummy_netdev
init_net
@ -1289,6 +1300,7 @@
kfree_call_rcu
kfree_const
kfree_skb
kfree_skb_partial
kill_fasync
kimage_vaddr
kimage_voffset
@ -2022,6 +2034,7 @@
smp_call_function
smp_call_function_many
smp_call_function_single
smp_call_function_single_async
smp_call_on_cpu
snd_card_free
snd_card_new

View file

@ -1,4 +1,4 @@
[abi_whitelist]
[abi_symbol_list]
# commonly used symbols
__alloc_disk_node
alloc_etherdev_mqs

View file

@ -1,4 +1,4 @@
[abi_whitelist]
[abi_symbol_list]
# commonly used symbols
add_uevent_var
alloc_chrdev_region

View file

@ -1,4 +1,4 @@
[abi_whitelist]
[abi_symbol_list]
# commonly used symbols
add_timer
alloc_chrdev_region

View file

@ -1,4 +1,4 @@
[abi_whitelist]
[abi_symbol_list]
# commonly used symbols
alloc_workqueue
__arch_copy_from_user

View file

@ -1,4 +1,4 @@
[abi_whitelist]
[abi_symbol_list]
add_device_randomness
add_timer
add_timer_on

View file

@ -1,4 +1,4 @@
[abi_whitelist]
[abi_symbol_list]
# commonly used symbols
pinctrl_get
pinctrl_gpio_set_config

View file

@ -1,4 +1,4 @@
[abi_whitelist]
[abi_symbol_list]
# commonly used symbols
add_timer
add_uevent_var

View file

@ -1,4 +1,4 @@
[abi_whitelist]
[abi_symbol_list]
add_device_randomness
add_timer
add_uevent_var

View file

@ -1,3 +1,3 @@
[abi_whitelist]
[abi_symbol_list]
# b/167230325
ehci_handshake

View file

@ -4,7 +4,6 @@ CONFIG_CONNECTOR=m
CONFIG_BLK_DEV_NVME=m
CONFIG_NVME_TARGET=m
CONFIG_HISI_HIKEY_USB=m
CONFIG_SCSI_UFS_HISI=m
CONFIG_WLAN_VENDOR_TI=y
CONFIG_WL18XX=m
CONFIG_WLCORE_SDIO=m
@ -37,7 +36,6 @@ CONFIG_USB_OHCI_HCD=m
CONFIG_USB_OHCI_HCD_PLATFORM=m
CONFIG_USB_DWC3=m
CONFIG_USB_GADGETFS=m
CONFIG_TYPEC_TCPM=m
CONFIG_TYPEC_TCPCI=m
CONFIG_TYPEC_RT1711H=m
CONFIG_MMC_BLOCK=m

View file

@ -55,6 +55,7 @@
#include <asm/pointer_auth.h>
#include <asm/scs.h>
#include <asm/stacktrace.h>
#include <trace/hooks/minidump.h>
#if defined(CONFIG_STACKPROTECTOR) && !defined(CONFIG_STACKPROTECTOR_PER_TASK)
#include <linux/stackprotector.h>
@ -254,6 +255,7 @@ void __show_regs(struct pt_regs *regs)
top_reg = 29;
}
trace_android_vh_show_regs(regs);
show_regs_print_info(KERN_DEFAULT);
print_pstate(regs);

View file

@ -17,6 +17,7 @@
#include <trace/hooks/fpsimd.h>
#include <trace/hooks/topology.h>
#include <trace/hooks/debug.h>
#include <trace/hooks/minidump.h>
/*
* Export tracepoints that act as a bare tracehook (ie: have no trace event
@ -56,3 +57,4 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_alter_futex_plist_add);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_is_fpsimd_save);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_ipi_stop);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_printk_store);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_show_regs);

View file

@ -314,7 +314,7 @@ void lkdtm_USERCOPY_KERNEL(void)
pr_info("attempting bad copy_to_user from kernel text: %px\n",
vm_mmap);
if (copy_to_user((void __user *)user_addr, vm_mmap,
if (copy_to_user((void __user *)user_addr, __va_function(vm_mmap),
unconst + PAGE_SIZE)) {
pr_warn("copy_to_user failed, but lacked Oops\n");
goto free_user;

View file

@ -1037,7 +1037,6 @@ static ssize_t oom_adj_read(struct file *file, char __user *buf, size_t count,
static int __set_oom_adj(struct file *file, int oom_adj, bool legacy)
{
static DEFINE_MUTEX(oom_adj_mutex);
struct mm_struct *mm = NULL;
struct task_struct *task;
int err = 0;
@ -1077,7 +1076,7 @@ static int __set_oom_adj(struct file *file, int oom_adj, bool legacy)
struct task_struct *p = find_lock_task_mm(task);
if (p) {
if (atomic_read(&p->mm->mm_users) > 1) {
if (test_bit(MMF_MULTIPROCESS, &p->mm->flags)) {
mm = p->mm;
mmgrab(mm);
}

View file

@ -116,6 +116,14 @@ extern int mmap_rnd_compat_bits __read_mostly;
#define __pa_symbol(x) __pa(RELOC_HIDE((unsigned long)(x), 0))
#endif
#ifndef __va_function
#define __va_function(x) (x)
#endif
#ifndef __pa_function
#define __pa_function(x) __pa_symbol(x)
#endif
#ifndef page_to_virt
#define page_to_virt(x) __va(PFN_PHYS(page_to_pfn(x)))
#endif

View file

@ -55,6 +55,7 @@ struct oom_control {
};
extern struct mutex oom_lock;
extern struct mutex oom_adj_mutex;
static inline void set_current_oom_origin(void)
{

View file

@ -72,6 +72,7 @@ static inline int get_dumpable(struct mm_struct *mm)
#define MMF_DISABLE_THP 24 /* disable THP for all VMAs */
#define MMF_OOM_VICTIM 25 /* mm is the oom victim */
#define MMF_OOM_REAP_QUEUED 26 /* mm was queued for oom_reaper */
#define MMF_MULTIPROCESS 27 /* mm is shared between processes */
#define MMF_DISABLE_THP_MASK (1 << MMF_DISABLE_THP)
#define MMF_INIT_MASK (MMF_DUMPABLE_MASK | MMF_DUMP_FILTER_MASK |\

View file

@ -0,0 +1,24 @@
/* SPDX-License-Identifier: GPL-2.0 */
#undef TRACE_SYSTEM
#define TRACE_SYSTEM minidump
#define TRACE_INCLUDE_PATH trace/hooks
#if !defined(_TRACE_HOOK_MINIDUMP_H) || defined(TRACE_HEADER_MULTI_READ)
#define _TRACE_HOOK_MINIDUMP_H
#include <linux/tracepoint.h>
#include <trace/hooks/vendor_hooks.h>
#if defined(CONFIG_TRACEPOINTS) && defined(CONFIG_ANDROID_VENDOR_HOOKS)
struct pt_regs;
DECLARE_HOOK(android_vh_show_regs,
TP_PROTO(struct pt_regs *regs),
TP_ARGS(regs));
#else
#define trace_android_vh_show_regs(regs)
#endif
#endif /* _TRACE_HOOK_MINIDUMP_H */
/* This part must be outside protection */
#include <trace/define_trace.h>

View file

@ -1760,6 +1760,25 @@ static __always_inline void delayed_free_task(struct task_struct *tsk)
free_task(tsk);
}
static void copy_oom_score_adj(u64 clone_flags, struct task_struct *tsk)
{
/* Skip if kernel thread */
if (!tsk->mm)
return;
/* Skip if spawning a thread or using vfork */
if ((clone_flags & (CLONE_VM | CLONE_THREAD | CLONE_VFORK)) != CLONE_VM)
return;
/* We need to synchronize with __set_oom_adj */
mutex_lock(&oom_adj_mutex);
set_bit(MMF_MULTIPROCESS, &tsk->mm->flags);
/* Update the values in case they were changed after copy_signal */
tsk->signal->oom_score_adj = current->signal->oom_score_adj;
tsk->signal->oom_score_adj_min = current->signal->oom_score_adj_min;
mutex_unlock(&oom_adj_mutex);
}
/*
* This creates a new process as a copy of the old one,
* but does not actually start it yet.
@ -2234,6 +2253,8 @@ static __latent_entropy struct task_struct *copy_process(
trace_task_newtask(p, clone_flags);
uprobe_copy_process(p, clone_flags);
copy_oom_score_adj(clone_flags, p);
return p;
bad_fork_cancel_cgroup:

View file

@ -63,6 +63,8 @@ int sysctl_oom_dump_tasks = 1;
* and mark_oom_victim
*/
DEFINE_MUTEX(oom_lock);
/* Serializes oom_score_adj and oom_score_adj_min updates */
DEFINE_MUTEX(oom_adj_mutex);
static inline bool is_memcg_oom(struct oom_control *oc)
{