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

Sync up with android11-5.4 for the following commits:

58e01352ee ANDROID: GKI: Update abi_gki_aarch64_exynos
e675b8a59a ANDROID: kbuild: disable GCOV with CFI
39133635c5 ANDROID: GKI: add built-in PCIE_DW_PLAT_EP
cea56b5c10 ANDROID: PCI: dwc: export symbols for ep driver
2f397d4f68 ANDROID: recordmcount: avoid STT_FILE as base for mcount offset relocation
3f0fb2fde0 ANDROID: iommu: Enable CONFIG_IOMMU_IO_PGTABLE_ARMV7S
0245f11b47 BACKPORT: FROMLIST: iommu/io-pgtable-arm-v7s: Quad lvl1 pgtable for MediaTek
fbf0ae523d BACKPORT: FROMLIST: iommu/io-pgtable-arm-v7s: Add cfg as a param in some macros
8b6f18592d BACKPORT: FROMLIST: iommu/io-pgtable-arm-v7s: Extend PA34 for MediaTek
ba7883760a BACKPORT: FROMLIST: iommu/io-pgtable-arm-v7s: Use ias to check the valid iova in unmap
95bd9e26f2 ANDROID: ABI: Update allowed list for QCOM
ba2f977129 ANDROID: modules: fix suspicious rcu usage
e17d9fc531 ANDROID: GKI: Enable CONFIG_X86_X2APIC
f1ff4a4678 ANDROID: GKI: update xiaomi symbol list
db96212bde ANDROID: GKI: fix ABI breakage in module.h
35b560985b UPSTREAM: modules: inherit TAINT_PROPRIETARY_MODULE
f39710f356 UPSTREAM: modules: return licensing information from find_symbol
35601d5015 UPSTREAM: modules: rename the licence field in struct symsearch to license
684d5eaf06 UPSTREAM: modules: unexport __module_address
68d5cd1dcb UPSTREAM: modules: unexport __module_text_address
6cd6da665d UPSTREAM: modules: mark each_symbol_section static
2951ba186e UPSTREAM: modules: mark find_symbol static
ec46411eb4 UPSTREAM: modules: mark ref_module static
cbd55f8de6 ANDROID: GKI: Update abi_gki_aarch64_exynos
205650744e ANDROID: ABI: update allowed list for QCOM
8d3d29f072 UPSTREAM: binder: fix UAF when releasing todo list

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: Ief2c3ebe2d90dc51c6e8740b87518c7c230bc38b
This commit is contained in:
Greg Kroah-Hartman 2020-10-24 10:45:41 +02:00
commit f74895ce44
14 changed files with 1622 additions and 837 deletions

File diff suppressed because it is too large Load diff

View file

@ -3,6 +3,7 @@
add_timer_on
add_uevent_var
add_wait_queue
add_wait_queue_exclusive
adjust_managed_page_count
alarm_cancel
alarm_init
@ -18,6 +19,7 @@
amba_driver_register
amba_driver_unregister
anon_inode_getfd
__arch_clear_user
__arch_copy_from_user
__arch_copy_in_user
__arch_copy_to_user
@ -34,6 +36,7 @@
_bcd2bin
bcmp
_bin2bcd
bin2hex
bio_crypt_should_process
__bitmap_clear
__bitmap_parse
@ -56,6 +59,7 @@
bpf_trace_run6
bpf_trace_run7
bpf_trace_run9
__break_lease
build_skb
bus_find_device
bus_for_each_dev
@ -78,9 +82,11 @@
__cfg80211_alloc_event_skb
__cfg80211_alloc_reply_skb
cfg80211_chandef_create
cfg80211_chandef_valid
cfg80211_ch_switch_notify
cfg80211_classify8021d
cfg80211_connect_done
cfg80211_conn_failed
cfg80211_del_sta_sinfo
cfg80211_disconnected
cfg80211_external_auth_request
@ -93,6 +99,7 @@
cfg80211_new_sta
cfg80211_put_bss
cfg80211_ready_on_channel
cfg80211_ref_bss
cfg80211_remain_on_channel_expired
cfg80211_roamed
cfg80211_rx_mgmt
@ -106,9 +113,13 @@
__class_create
class_create_file_ns
class_destroy
class_dev_iter_exit
class_dev_iter_init
class_dev_iter_next
class_find_device
__class_register
class_unregister
clear_inode
clear_page
clk_bulk_disable
clk_bulk_enable
@ -155,6 +166,7 @@
config_ep_by_speed
config_group_init_type_name
console_lock
console_stop
console_trylock
console_unlock
__const_udelay
@ -206,14 +218,18 @@
csum_partial
csum_tcpudp_nofold
_ctype
d_add
dapm_pinctrl_event
dapm_regulator_event
datagram_poll
d_drop
deactivate_locked_super
default_llseek
default_wake_function
delayed_work_timer_fn
del_timer
del_timer_sync
dentry_open
destroy_workqueue
dev_alloc_name
_dev_crit
@ -311,6 +327,7 @@
devm_request_threaded_irq
devm_reset_control_array_get
__devm_reset_control_get
devm_rtc_allocate_device
devm_rtc_device_register
devm_snd_dmaengine_pcm_register
devm_snd_soc_register_card
@ -341,7 +358,10 @@
devres_release
dev_set_mac_address
dev_set_name
dev_vprintk_emit
_dev_warn
dget_parent
d_instantiate
disable_irq
disable_irq_nosync
disable_percpu_irq
@ -394,6 +414,7 @@
dma_free_attrs
dma_get_slave_caps
dma_get_slave_channel
d_make_root
dmam_alloc_attrs
dma_mmap_attrs
dma_pool_alloc
@ -414,6 +435,7 @@
down_trylock
down_write
d_path
dput
driver_find
driver_find_device
driver_register
@ -465,10 +487,19 @@
freq_qos_add_request
freq_qos_remove_request
freq_qos_update_request
fs_kobj
fsstack_copy_attr_all
fwnode_property_present
fwnode_property_read_u16_array
generic_file_llseek
generic_file_mmap
generic_file_read_iter
generic_file_splice_read
generic_handle_irq
generic_read_dir
generic_shutdown_super
genl_family_attrbuf
genlmsg_multicast_allns
genlmsg_put
genl_register_family
genl_unregister_family
@ -542,6 +573,7 @@
i2c_del_driver
i2c_for_each_dev
i2c_get_adapter
i2c_new_device
i2c_new_dummy
i2c_put_adapter
i2c_register_driver
@ -564,13 +596,17 @@
ieee80211_channel_to_freq_khz
ieee80211_freq_khz_to_channel
ieee80211_get_channel_khz
iget5_locked
ignore_console_lock_warning
ihold
iio_channel_get
iio_channel_release
iio_convert_raw_to_processed
iio_device_alloc
iio_device_free
__iio_device_register
iio_device_unregister
iio_get_channel_type
iio_read_channel_processed
iio_read_channel_raw
in4_pton
@ -582,6 +618,8 @@
init_timer_key
init_wait_entry
__init_waitqueue_head
inode_init_once
inode_init_owner
input_allocate_device
input_event
input_free_device
@ -639,6 +677,7 @@
iounmap
__iowrite32_copy
ip_send_check
iput
__irq_alloc_descs
irq_create_mapping
__irq_domain_add
@ -664,6 +703,7 @@
irq_to_desc
irq_work_queue
is_console_locked
iterate_dir
jiffies
jiffies_64
jiffies_64_to_clock_t
@ -673,7 +713,9 @@
kasprintf
kernel_kobj
kernel_read
kernel_restart
kernel_write
kern_path
keyslot_manager_create_passthrough
keyslot_manager_private
__kfifo_alloc
@ -752,10 +794,16 @@
llist_add_batch
__local_bh_enable_ip
__lock_buffer
lockref_get
lock_rename
lock_sock_nested
lookup_one_len
loops_per_jiffy
LZ4_decompress_safe
map_vm_area
match_int
match_string
match_token
media_create_intf_link
media_create_pad_link
media_device_register_entity
@ -841,6 +889,7 @@
no_llseek
nonseekable_open
noop_llseek
notify_change
nr_cpu_ids
nr_irqs
nsecs_to_jiffies
@ -916,6 +965,7 @@
of_usb_get_phy_mode
of_usb_host_tpl_support
oops_in_progress
pagecache_get_page
panic
panic_notifier_list
param_array_ops
@ -929,6 +979,8 @@
param_ops_ullong
param_ops_ulong
param_set_uint
path_get
path_put
pci_alloc_irq_vectors_affinity
pci_bus_type
pci_d3cold_disable
@ -1121,6 +1173,7 @@
register_chrdev_region
register_console
register_die_notifier
register_filesystem
register_inet6addr_notifier
register_inetaddr_notifier
register_netdev
@ -1177,13 +1230,17 @@
reset_control_reset
return_address
rfkill_alloc
rfkill_blocked
rfkill_destroy
rfkill_register
rfkill_unregister
rps_needed
rtc_add_group
rtc_class_close
rtc_class_open
rtc_read_time
__rtc_register_device
rtc_set_time
rtc_time64_to_tm
rtc_tm_to_time64
rtc_update_irq
@ -1211,6 +1268,7 @@
seq_printf
seq_puts
seq_read
set_anon_super
set_cpus_allowed_ptr
set_normalized_timespec64
set_page_dirty_lock
@ -1218,6 +1276,7 @@
sg_alloc_table
sg_alloc_table_from_pages
sg_copy_to_buffer
sget
sg_free_table
sg_init_one
sg_init_table
@ -1230,8 +1289,11 @@
__sg_page_iter_start
sg_pcopy_from_buffer
sg_pcopy_to_buffer
simple_getattr
simple_open
simple_read_from_buffer
simple_setattr
simple_statfs
simple_strtol
simple_strtoul
simple_write_to_buffer
@ -1301,6 +1363,7 @@
snd_soc_dai_set_fmt
snd_soc_dai_set_sysclk
snd_soc_dai_set_tdm_slot
snd_soc_dai_set_tristate
snd_soc_dapm_add_routes
snd_soc_dapm_disable_pin
snd_soc_dapm_enable_pin
@ -1369,6 +1432,8 @@
sock_no_shutdown
sock_no_socketpair
sock_queue_rcv_skb
__sock_recv_timestamp
__sock_recv_wifi_status
sock_register
sock_unregister
softnet_data
@ -1412,11 +1477,13 @@
strncat
strncmp
strncpy
strndup_user
strnlen
strnstr
strpbrk
strrchr
strsep
strspn
strstr
submit_bh
subsys_system_register
@ -1425,6 +1492,7 @@
__sync_dirty_buffer
sync_file_create
sync_file_get_fence
sync_filesystem
synchronize_irq
synchronize_rcu
syscon_regmap_lookup_by_phandle
@ -1481,6 +1549,7 @@
__tracepoint_android_vh_is_fpsimd_save
__tracepoint_device_pm_callback_end
__tracepoint_device_pm_callback_start
__tracepoint_gpu_mem_total
__tracepoint_pelt_cfs_tp
tracepoint_probe_register
__tracepoint_suspend_resume
@ -1490,6 +1559,7 @@
__trace_puts
trace_raw_output_prep
trace_seq_printf
truncate_inode_pages
try_module_get
__tty_alloc_driver
tty_flip_buffer_push
@ -1529,14 +1599,19 @@
ufshcd_dme_get_attr
ufshcd_dme_set_attr
ufshcd_pltfrm_init
ufshcd_query_descriptor_retry
ufshcd_remove
ufshcd_shutdown
ufshcd_system_resume
ufshcd_system_suspend
ufshcd_wb_ctrl
unlock_new_inode
unlock_page
unlock_rename
unmap_mapping_range
__unregister_chrdev
unregister_chrdev_region
unregister_filesystem
unregister_inet6addr_notifier
unregister_inetaddr_notifier
unregister_netdev
@ -1642,6 +1717,7 @@
usb_unregister_notify
usb_wakeup_notification
__usecs_to_jiffies
user_path_at_empty
usleep_range
v4l2_ctrl_handler_free
v4l2_ctrl_handler_init_class
@ -1692,9 +1768,20 @@
vb2_streamon
vb2_wait_for_all_buffers
vfree
vfs_create
vfs_fallocate
vfs_fsync
vfs_getattr
vfs_getxattr
vfs_link
vfs_listxattr
vfs_llseek
vfs_mkdir
vfs_rename
vfs_rmdir
vfs_setxattr
vfs_statx
vfs_unlink
video_devdata
video_device_alloc
video_device_release
@ -1703,6 +1790,7 @@
video_unregister_device
vmalloc
vmalloc_to_page
vmalloc_to_pfn
vmalloc_user
vmap
vmemmap
@ -1712,6 +1800,7 @@
vm_map_pages
vm_map_ram
vm_unmap_ram
vprintk_emit
vscnprintf
vsnprintf
vsprintf
@ -1724,12 +1813,14 @@
wait_for_completion_timeout
__wait_on_buffer
__wake_up
__wake_up_locked_key
wake_up_process
wakeup_source_add
wakeup_source_create
wakeup_source_destroy
wakeup_source_register
wakeup_source_unregister
__wake_up_sync
__warn_printk
watchdog_init_timeout
watchdog_register_device

View file

@ -21,6 +21,8 @@
alloc_skb_with_frags
alloc_workqueue
amba_bustype
amba_driver_register
amba_driver_unregister
anon_inode_getfile
arch_bpf_jit_check_func
__arch_clear_user
@ -870,6 +872,7 @@
find_next_zero_bit
find_snd_usb_substream
find_vma
find_vpid
finish_wait
firmware_request_nowarn
flow_keys_basic_dissector
@ -1665,6 +1668,7 @@
phy_start
phy_stop
physvirt_offset
pid_task
pinconf_generic_dt_node_to_map
pinctrl_dev_get_drvdata
pinctrl_force_default
@ -1975,6 +1979,7 @@
sched_clock
sched_setattr
sched_setscheduler
sched_setscheduler_nocheck
schedule
schedule_timeout
schedule_timeout_interruptible

View file

@ -16,6 +16,10 @@
regcache_drop_region
snd_soc_dapm_del_routes
# required by tfa98xx_dlkm.ko
device_remove_bin_file
snd_pcm_hw_constraint_mask64
# required by q6_dlkm.ko
down_interruptible
__kfifo_alloc

View file

@ -605,6 +605,7 @@ endchoice
config CFI_CLANG
bool "Use Clang's Control Flow Integrity (CFI)"
depends on LTO_CLANG && KALLSYMS
depends on !GCOV_KERNEL
help
This option enables Clang's Control Flow Integrity (CFI), which adds
runtime checking for indirect function calls.

View file

@ -230,8 +230,10 @@ CONFIG_PCI=y
CONFIG_PCIEPORTBUS=y
# CONFIG_PCIEAER is not set
CONFIG_PCI_HOST_GENERIC=y
CONFIG_PCIE_DW_PLAT_EP=y
CONFIG_PCIE_QCOM=y
CONFIG_PCIE_KIRIN=y
CONFIG_PCI_ENDPOINT=y
CONFIG_FW_LOADER_USER_HELPER=y
CONFIG_FW_LOADER_USER_HELPER_FALLBACK=y
# CONFIG_FW_CACHE is not set
@ -443,6 +445,7 @@ CONFIG_HWSPINLOCK=y
CONFIG_MTK_TIMER=y
CONFIG_MAILBOX=y
CONFIG_IOMMU_LIMIT_IOVA_ALIGNMENT=y
CONFIG_IOMMU_IO_PGTABLE_ARMV7S=y
CONFIG_REMOTEPROC=y
CONFIG_RPMSG_CHAR=y
CONFIG_DEVFREQ_GOV_PERFORMANCE=y

View file

@ -48,6 +48,7 @@ CONFIG_SLAB_FREELIST_HARDENED=y
CONFIG_SHUFFLE_PAGE_ALLOCATOR=y
CONFIG_PROFILING=y
CONFIG_SMP=y
CONFIG_X86_X2APIC=y
CONFIG_HYPERVISOR_GUEST=y
CONFIG_PARAVIRT=y
CONFIG_NR_CPUS=32
@ -204,6 +205,8 @@ CONFIG_PCI=y
CONFIG_PCIEPORTBUS=y
# CONFIG_PCIEAER is not set
CONFIG_PCI_MSI=y
CONFIG_PCIE_DW_PLAT_EP=y
CONFIG_PCI_ENDPOINT=y
CONFIG_FW_LOADER_USER_HELPER=y
CONFIG_FW_LOADER_USER_HELPER_FALLBACK=y
# CONFIG_FW_CACHE is not set

View file

@ -230,7 +230,7 @@ static struct binder_transaction_log_entry *binder_transaction_log_add(
struct binder_work {
struct list_head entry;
enum {
enum binder_work_type {
BINDER_WORK_TRANSACTION = 1,
BINDER_WORK_TRANSACTION_COMPLETE,
BINDER_WORK_RETURN_ERROR,
@ -917,27 +917,6 @@ static struct binder_work *binder_dequeue_work_head_ilocked(
return w;
}
/**
* binder_dequeue_work_head() - Dequeues the item at head of list
* @proc: binder_proc associated with list
* @list: list to dequeue head
*
* Removes the head of the list if there are items on the list
*
* Return: pointer dequeued binder_work, NULL if list was empty
*/
static struct binder_work *binder_dequeue_work_head(
struct binder_proc *proc,
struct list_head *list)
{
struct binder_work *w;
binder_inner_proc_lock(proc);
w = binder_dequeue_work_head_ilocked(list);
binder_inner_proc_unlock(proc);
return w;
}
static void
binder_defer_work(struct binder_proc *proc, enum binder_deferred_state defer);
static void binder_free_thread(struct binder_thread *thread);
@ -4753,13 +4732,17 @@ static void binder_release_work(struct binder_proc *proc,
struct list_head *list)
{
struct binder_work *w;
enum binder_work_type wtype;
while (1) {
w = binder_dequeue_work_head(proc, list);
binder_inner_proc_lock(proc);
w = binder_dequeue_work_head_ilocked(list);
wtype = w ? w->type : 0;
binder_inner_proc_unlock(proc);
if (!w)
return;
switch (w->type) {
switch (wtype) {
case BINDER_WORK_TRANSACTION: {
struct binder_transaction *t;
@ -4793,9 +4776,11 @@ static void binder_release_work(struct binder_proc *proc,
kfree(death);
binder_stats_deleted(BINDER_STAT_DEATH);
} break;
case BINDER_WORK_NODE:
break;
default:
pr_err("unexpected work type, %d, not freed\n",
w->type);
wtype);
break;
}
}

View file

@ -50,20 +50,26 @@
*/
#define ARM_V7S_ADDR_BITS 32
#define _ARM_V7S_LVL_BITS(lvl) (16 - (lvl) * 4)
/* MediaTek: totally 34bits, 14bits at lvl1 and 8bits at lvl2. */
#define _ARM_V7S_LVL_BITS_MTK(lvl) (20 - (lvl) * 6)
#define ARM_V7S_LVL_SHIFT(lvl) (ARM_V7S_ADDR_BITS - (4 + 8 * (lvl)))
#define ARM_V7S_TABLE_SHIFT 10
#define ARM_V7S_PTES_PER_LVL(lvl) (1 << _ARM_V7S_LVL_BITS(lvl))
#define ARM_V7S_TABLE_SIZE(lvl) \
(ARM_V7S_PTES_PER_LVL(lvl) * sizeof(arm_v7s_iopte))
#define ARM_V7S_PTES_PER_LVL(lvl, cfg) ({ \
!arm_v7s_is_mtk_enabled(cfg) ? \
(1 << _ARM_V7S_LVL_BITS(lvl)) : (1 << _ARM_V7S_LVL_BITS_MTK(lvl));\
})
#define ARM_V7S_TABLE_SIZE(lvl, cfg) \
(ARM_V7S_PTES_PER_LVL(lvl, cfg) * sizeof(arm_v7s_iopte))
#define ARM_V7S_BLOCK_SIZE(lvl) (1UL << ARM_V7S_LVL_SHIFT(lvl))
#define ARM_V7S_LVL_MASK(lvl) ((u32)(~0U << ARM_V7S_LVL_SHIFT(lvl)))
#define ARM_V7S_TABLE_MASK ((u32)(~0U << ARM_V7S_TABLE_SHIFT))
#define _ARM_V7S_IDX_MASK(lvl) (ARM_V7S_PTES_PER_LVL(lvl) - 1)
#define ARM_V7S_LVL_IDX(addr, lvl) ({ \
#define _ARM_V7S_IDX_MASK(lvl, cfg) (ARM_V7S_PTES_PER_LVL(lvl, cfg) - 1)
#define ARM_V7S_LVL_IDX(addr, lvl, cfg) ({ \
int _l = lvl; \
((u32)(addr) >> ARM_V7S_LVL_SHIFT(_l)) & _ARM_V7S_IDX_MASK(_l); \
((addr) >> ARM_V7S_LVL_SHIFT(_l)) & _ARM_V7S_IDX_MASK(_l, cfg); \
})
/*
@ -112,9 +118,10 @@
#define ARM_V7S_TEX_MASK 0x7
#define ARM_V7S_ATTR_TEX(val) (((val) & ARM_V7S_TEX_MASK) << ARM_V7S_TEX_SHIFT)
/* MediaTek extend the two bits for PA 32bit/33bit */
/* MediaTek extend the bits below for PA 32bit/33bit/34bit */
#define ARM_V7S_ATTR_MTK_PA_BIT32 BIT(9)
#define ARM_V7S_ATTR_MTK_PA_BIT33 BIT(4)
#define ARM_V7S_ATTR_MTK_PA_BIT34 BIT(5)
/* *well, except for TEX on level 2 large pages, of course :( */
#define ARM_V7S_CONT_PAGE_TEX_SHIFT 6
@ -196,6 +203,8 @@ static arm_v7s_iopte paddr_to_iopte(phys_addr_t paddr, int lvl,
pte |= ARM_V7S_ATTR_MTK_PA_BIT32;
if (paddr & BIT_ULL(33))
pte |= ARM_V7S_ATTR_MTK_PA_BIT33;
if (paddr & BIT_ULL(34))
pte |= ARM_V7S_ATTR_MTK_PA_BIT34;
return pte;
}
@ -220,6 +229,8 @@ static phys_addr_t iopte_to_paddr(arm_v7s_iopte pte, int lvl,
paddr |= BIT_ULL(32);
if (pte & ARM_V7S_ATTR_MTK_PA_BIT33)
paddr |= BIT_ULL(33);
if (pte & ARM_V7S_ATTR_MTK_PA_BIT34)
paddr |= BIT_ULL(34);
return paddr;
}
@ -236,7 +247,7 @@ static void *__arm_v7s_alloc_table(int lvl, gfp_t gfp,
struct device *dev = cfg->iommu_dev;
phys_addr_t phys;
dma_addr_t dma;
size_t size = ARM_V7S_TABLE_SIZE(lvl);
size_t size = ARM_V7S_TABLE_SIZE(lvl, cfg);
void *table = NULL;
if (lvl == 1)
@ -282,7 +293,7 @@ static void __arm_v7s_free_table(void *table, int lvl,
{
struct io_pgtable_cfg *cfg = &data->iop.cfg;
struct device *dev = cfg->iommu_dev;
size_t size = ARM_V7S_TABLE_SIZE(lvl);
size_t size = ARM_V7S_TABLE_SIZE(lvl, cfg);
if (!cfg->coherent_walk)
dma_unmap_single(dev, __arm_v7s_dma_addr(table), size,
@ -426,7 +437,7 @@ static int arm_v7s_init_pte(struct arm_v7s_io_pgtable *data,
arm_v7s_iopte *tblp;
size_t sz = ARM_V7S_BLOCK_SIZE(lvl);
tblp = ptep - ARM_V7S_LVL_IDX(iova, lvl);
tblp = ptep - ARM_V7S_LVL_IDX(iova, lvl, cfg);
if (WARN_ON(__arm_v7s_unmap(data, NULL, iova + i * sz,
sz, lvl, tblp) != sz))
return -EINVAL;
@ -479,7 +490,7 @@ static int __arm_v7s_map(struct arm_v7s_io_pgtable *data, unsigned long iova,
int num_entries = size >> ARM_V7S_LVL_SHIFT(lvl);
/* Find our entry at the current level */
ptep += ARM_V7S_LVL_IDX(iova, lvl);
ptep += ARM_V7S_LVL_IDX(iova, lvl, cfg);
/* If we can install a leaf entry at this level, then do so */
if (num_entries)
@ -552,7 +563,7 @@ static void arm_v7s_free_pgtable(struct io_pgtable *iop)
struct arm_v7s_io_pgtable *data = io_pgtable_to_data(iop);
int i;
for (i = 0; i < ARM_V7S_PTES_PER_LVL(1); i++) {
for (i = 0; i < ARM_V7S_PTES_PER_LVL(1, &data->iop.cfg); i++) {
arm_v7s_iopte pte = data->pgd[i];
if (ARM_V7S_PTE_IS_TABLE(pte, 1))
@ -604,9 +615,9 @@ static size_t arm_v7s_split_blk_unmap(struct arm_v7s_io_pgtable *data,
if (!tablep)
return 0; /* Bytes unmapped */
num_ptes = ARM_V7S_PTES_PER_LVL(2);
num_ptes = ARM_V7S_PTES_PER_LVL(2, cfg);
num_entries = size >> ARM_V7S_LVL_SHIFT(2);
unmap_idx = ARM_V7S_LVL_IDX(iova, 2);
unmap_idx = ARM_V7S_LVL_IDX(iova, 2, cfg);
pte = arm_v7s_prot_to_pte(arm_v7s_pte_to_prot(blk_pte, 1), 2, cfg);
if (num_entries > 1)
@ -648,7 +659,7 @@ static size_t __arm_v7s_unmap(struct arm_v7s_io_pgtable *data,
if (WARN_ON(lvl > 2))
return 0;
idx = ARM_V7S_LVL_IDX(iova, lvl);
idx = ARM_V7S_LVL_IDX(iova, lvl, &iop->cfg);
ptep += idx;
do {
pte[i] = READ_ONCE(ptep[i]);
@ -719,7 +730,7 @@ static size_t arm_v7s_unmap(struct io_pgtable_ops *ops, unsigned long iova,
{
struct arm_v7s_io_pgtable *data = io_pgtable_ops_to_data(ops);
if (WARN_ON(upper_32_bits(iova)))
if (WARN_ON(iova >= (1ULL << data->iop.cfg.ias)))
return 0;
return __arm_v7s_unmap(data, gather, iova, size, 1, data->pgd);
@ -734,7 +745,7 @@ static phys_addr_t arm_v7s_iova_to_phys(struct io_pgtable_ops *ops,
u32 mask;
do {
ptep += ARM_V7S_LVL_IDX(iova, ++lvl);
ptep += ARM_V7S_LVL_IDX(iova, ++lvl, &data->iop.cfg);
pte = READ_ONCE(*ptep);
ptep = iopte_deref(pte, lvl, data);
} while (ARM_V7S_PTE_IS_TABLE(pte, lvl));
@ -753,10 +764,10 @@ static struct io_pgtable *arm_v7s_alloc_pgtable(struct io_pgtable_cfg *cfg,
{
struct arm_v7s_io_pgtable *data;
if (cfg->ias > ARM_V7S_ADDR_BITS)
if (cfg->ias > (arm_v7s_is_mtk_enabled(cfg) ? 34 : ARM_V7S_ADDR_BITS))
return NULL;
if (cfg->oas > (arm_v7s_is_mtk_enabled(cfg) ? 34 : ARM_V7S_ADDR_BITS))
if (cfg->oas > (arm_v7s_is_mtk_enabled(cfg) ? 35 : ARM_V7S_ADDR_BITS))
return NULL;
if (cfg->quirks & ~(IO_PGTABLE_QUIRK_ARM_NS |
@ -777,8 +788,8 @@ static struct io_pgtable *arm_v7s_alloc_pgtable(struct io_pgtable_cfg *cfg,
spin_lock_init(&data->split_lock);
data->l2_tables = kmem_cache_create("io-pgtable_armv7s_l2",
ARM_V7S_TABLE_SIZE(2),
ARM_V7S_TABLE_SIZE(2),
ARM_V7S_TABLE_SIZE(2, cfg),
ARM_V7S_TABLE_SIZE(2, cfg),
ARM_V7S_TABLE_SLAB_FLAGS, NULL);
if (!data->l2_tables)
goto out_free_data;

View file

@ -18,6 +18,7 @@ void dw_pcie_ep_linkup(struct dw_pcie_ep *ep)
pci_epc_linkup(epc);
}
EXPORT_SYMBOL_GPL(dw_pcie_ep_linkup);
static void __dw_pcie_ep_reset_bar(struct dw_pcie *pci, enum pci_barno bar,
int flags)
@ -607,3 +608,4 @@ int dw_pcie_ep_init(struct dw_pcie_ep *ep)
return 0;
}
EXPORT_SYMBOL_GPL(dw_pcie_ep_init);

View file

@ -92,8 +92,8 @@ struct io_pgtable_cfg {
* TLB maintenance when mapping as well as when unmapping.
*
* IO_PGTABLE_QUIRK_ARM_MTK_EXT: (ARM v7s format) MediaTek IOMMUs extend
* to support up to 34 bits PA where the bit32 and bit33 are
* encoded in the bit9 and bit4 of the PTE respectively.
* to support up to 35 bits PA where the bit32, bit33 and bit34 are
* encoded in the bit9, bit4 and bit5 of the PTE respectively.
*
* IO_PGTABLE_QUIRK_NON_STRICT: Skip issuing synchronous leaf TLBIs
* on unmap, for DMA domains using the flush queue mechanism for

View file

@ -346,6 +346,11 @@ struct klp_modinfo {
};
#endif
struct module_kabi_preserve_1 {
u64 using_gplonly_symbols:1;
u64 free:63;
};
struct module {
enum module_state state;
@ -515,7 +520,7 @@ struct module {
struct error_injection_entry *ei_funcs;
unsigned int num_ei_funcs;
#endif
ANDROID_KABI_RESERVE(1);
ANDROID_KABI_USE(1, struct module_kabi_preserve_1 m1);
ANDROID_KABI_RESERVE(2);
ANDROID_KABI_RESERVE(3);
ANDROID_KABI_RESERVE(4);
@ -573,34 +578,14 @@ struct module *find_module(const char *name);
struct symsearch {
const struct kernel_symbol *start, *stop;
const s32 *crcs;
enum {
enum mod_license {
NOT_GPL_ONLY,
GPL_ONLY,
WILL_BE_GPL_ONLY,
} licence;
} license;
bool unused;
};
/*
* Search for an exported symbol by name.
*
* Must be called with module_mutex held or preemption disabled.
*/
const struct kernel_symbol *find_symbol(const char *name,
struct module **owner,
const s32 **crc,
bool gplok,
bool warn);
/*
* Walk the exported symbol table
*
* Must be called with module_mutex held or preemption disabled.
*/
bool each_symbol_section(bool (*fn)(const struct symsearch *arr,
struct module *owner,
void *data), void *data);
/* Returns 0 and fills in value, defined and namebuf, or -ERANGE if
symnum out of range. */
int module_get_kallsym(unsigned int symnum, unsigned long *value, char *type,
@ -648,7 +633,6 @@ static inline void __module_get(struct module *module)
#define symbol_put_addr(p) do { } while (0)
#endif /* CONFIG_MODULE_UNLOAD */
int ref_module(struct module *a, struct module *b);
/* This is a #define so the string doesn't get put in every .o file */
#define module_name(mod) \

View file

@ -419,7 +419,7 @@ static bool each_symbol_in_section(const struct symsearch *arr,
}
/* Returns true as soon as fn returns true, otherwise false. */
bool each_symbol_section(bool (*fn)(const struct symsearch *arr,
static bool each_symbol_section(bool (*fn)(const struct symsearch *arr,
struct module *owner,
void *data),
void *data)
@ -481,7 +481,6 @@ bool each_symbol_section(bool (*fn)(const struct symsearch *arr,
}
return false;
}
EXPORT_SYMBOL_GPL(each_symbol_section);
struct find_symbol_arg {
/* Input */
@ -493,6 +492,7 @@ struct find_symbol_arg {
struct module *owner;
const s32 *crc;
const struct kernel_symbol *sym;
enum mod_license license;
};
static bool check_exported_symbol(const struct symsearch *syms,
@ -502,9 +502,9 @@ static bool check_exported_symbol(const struct symsearch *syms,
struct find_symbol_arg *fsa = data;
if (!fsa->gplok) {
if (syms->licence == GPL_ONLY)
if (syms->license == GPL_ONLY)
return false;
if (syms->licence == WILL_BE_GPL_ONLY && fsa->warn) {
if (syms->license == WILL_BE_GPL_ONLY && fsa->warn) {
pr_warn("Symbol %s is being used by a non-GPL module, "
"which will not be allowed in the future\n",
fsa->name);
@ -526,6 +526,7 @@ static bool check_exported_symbol(const struct symsearch *syms,
fsa->owner = owner;
fsa->crc = symversion(syms->crcs, symnum);
fsa->sym = &syms->start[symnum];
fsa->license = syms->license;
return true;
}
@ -582,9 +583,10 @@ static bool find_exported_symbol_in_section(const struct symsearch *syms,
/* Find an exported symbol and return it, along with, (optional) crc and
* (optional) module which owns it. Needs preempt disabled or module_mutex. */
const struct kernel_symbol *find_symbol(const char *name,
static const struct kernel_symbol *find_symbol(const char *name,
struct module **owner,
const s32 **crc,
enum mod_license *license,
bool gplok,
bool warn)
{
@ -599,13 +601,14 @@ const struct kernel_symbol *find_symbol(const char *name,
*owner = fsa.owner;
if (crc)
*crc = fsa.crc;
if (license)
*license = fsa.license;
return fsa.sym;
}
pr_debug("Failed to find symbol %s\n", name);
return NULL;
}
EXPORT_SYMBOL_GPL(find_symbol);
/*
* Search for module by name: must hold module_mutex (or preempt disabled
@ -866,7 +869,7 @@ static int add_module_usage(struct module *a, struct module *b)
}
/* Module a uses b: caller needs module_mutex() */
int ref_module(struct module *a, struct module *b)
static int ref_module(struct module *a, struct module *b)
{
int err;
@ -885,7 +888,6 @@ int ref_module(struct module *a, struct module *b)
}
return 0;
}
EXPORT_SYMBOL_GPL(ref_module);
/* Clear the unload stuff of the module. */
static void module_unload_free(struct module *mod)
@ -1074,7 +1076,7 @@ void __symbol_put(const char *symbol)
struct module *owner;
preempt_disable();
if (!find_symbol(symbol, &owner, NULL, true, false))
if (!find_symbol(symbol, &owner, NULL, NULL, true, false))
BUG();
module_put(owner);
preempt_enable();
@ -1165,11 +1167,10 @@ static inline void module_unload_free(struct module *mod)
{
}
int ref_module(struct module *a, struct module *b)
static int ref_module(struct module *a, struct module *b)
{
return strong_try_module_get(b);
}
EXPORT_SYMBOL_GPL(ref_module);
static inline int module_unload_init(struct module *mod)
{
@ -1352,7 +1353,7 @@ static inline int check_modstruct_version(const struct load_info *info,
* locking is necessary -- use preempt_disable() to placate lockdep.
*/
preempt_disable();
if (!find_symbol("module_layout", NULL, &crc, true, false)) {
if (!find_symbol("module_layout", NULL, &crc, NULL, true, false)) {
preempt_enable();
BUG();
}
@ -1426,6 +1427,24 @@ static int verify_namespace_is_imported(const struct load_info *info,
return 0;
}
static bool inherit_taint(struct module *mod, struct module *owner)
{
if (!owner || !test_bit(TAINT_PROPRIETARY_MODULE, &owner->taints))
return true;
if (mod->m1.using_gplonly_symbols) {
pr_err("%s: module using GPL-only symbols uses symbols from proprietary module %s.\n",
mod->name, owner->name);
return false;
}
if (!test_bit(TAINT_PROPRIETARY_MODULE, &mod->taints)) {
pr_warn("%s: module uses symbols from proprietary module %s, inheriting taint.\n",
mod->name, owner->name);
set_bit(TAINT_PROPRIETARY_MODULE, &mod->taints);
}
return true;
}
/* Resolve a symbol for this module. I.e. if we find one, record usage. */
static const struct kernel_symbol *resolve_symbol(struct module *mod,
@ -1436,6 +1455,7 @@ static const struct kernel_symbol *resolve_symbol(struct module *mod,
struct module *owner;
const struct kernel_symbol *sym;
const s32 *crc;
enum mod_license license;
int err;
/*
@ -1445,11 +1465,19 @@ static const struct kernel_symbol *resolve_symbol(struct module *mod,
*/
sched_annotate_sleep();
mutex_lock(&module_mutex);
sym = find_symbol(name, &owner, &crc,
sym = find_symbol(name, &owner, &crc, &license,
!(mod->taints & (1 << TAINT_PROPRIETARY_MODULE)), true);
if (!sym)
goto unlock;
if (license == GPL_ONLY)
mod->m1.using_gplonly_symbols = true;
if (!inherit_taint(mod, owner)) {
sym = NULL;
goto getname;
}
if (!check_version(info, name, mod, crc)) {
sym = ERR_PTR(-EINVAL);
goto getname;
@ -2267,7 +2295,7 @@ void *__symbol_get(const char *symbol)
const struct kernel_symbol *sym;
preempt_disable();
sym = find_symbol(symbol, &owner, NULL, true, true);
sym = find_symbol(symbol, &owner, NULL, NULL, true, true);
if (sym && strong_try_module_get(owner))
sym = NULL;
preempt_enable();
@ -2302,7 +2330,7 @@ static int verify_exported_symbols(struct module *mod)
for (i = 0; i < ARRAY_SIZE(arr); i++) {
for (s = arr[i].sym; s < arr[i].sym + arr[i].num; s++) {
if (find_symbol(kernel_symbol_name(s), &owner, NULL,
true, false)) {
NULL, true, false)) {
pr_err("%s: exports duplicate symbol %s"
" (owned by %s)\n",
mod->name, kernel_symbol_name(s),
@ -4320,10 +4348,10 @@ int module_kallsyms_on_each_symbol(int (*fn)(void *, const char *,
static void cfi_init(struct module *mod)
{
#ifdef CONFIG_CFI_CLANG
rcu_read_lock();
rcu_read_lock_sched();
mod->cfi_check = (cfi_check_fn)find_kallsyms_symbol_value(mod,
CFI_CHECK_FN_NAME);
rcu_read_unlock();
rcu_read_unlock_sched();
cfi_module_add(mod, module_addr_min, module_addr_max);
#endif
}
@ -4526,7 +4554,6 @@ struct module *__module_address(unsigned long addr)
}
return mod;
}
EXPORT_SYMBOL_GPL(__module_address);
/*
* is_module_text_address - is this address inside module code?
@ -4565,7 +4592,6 @@ struct module *__module_text_address(unsigned long addr)
}
return mod;
}
EXPORT_SYMBOL_GPL(__module_text_address);
/* Don't grab lock, we're oopsing. */
void print_modules(void)

View file

@ -529,6 +529,9 @@ static int find_secsym_ndx(unsigned const txtndx,
if (txtndx == get_symindex(symp, symtab, symtab_shndx)
/* avoid STB_WEAK */
&& (STB_LOCAL == st_bind || STB_GLOBAL == st_bind)) {
/* avoid file symbols */
if (ELF_ST_TYPE(symp->st_info) == STT_FILE)
continue;
/* function symbols on ARM have quirks, avoid them */
if (w2(ehdr->e_machine) == EM_ARM
&& ELF_ST_TYPE(symp->st_info) == STT_FUNC)