Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[EOL]: Update 5.4-2.3.x-imx up to v5.4.149 #458

Merged
merged 51 commits into from
Sep 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
2fcb7b7
PCI: pci-bridge-emul: Fix big-endian support
jaszczyk-grzegorz Jul 16, 2019
296895c
PCI: aardvark: Indicate error in 'val' when config read fails
pali Jun 1, 2020
3f0e275
PCI: pci-bridge-emul: Add PCIe Root Capabilities Register
pali Jul 22, 2021
ec29e33
PCI: aardvark: Fix reporting CRS value
pali Jul 22, 2021
5163578
PCI/ACPI: Add Ampere Altra SOC MCFG quirk
Aug 6, 2020
b0c813f
KVM: remember position in kvm->vcpus array
rkrcmar Nov 7, 2019
bd292c6
console: consume APC, DM, DCS
dankamongmen Aug 30, 2021
6bfdc30
s390/pci_mmio: fully validate the VMA before calling follow_pte()
davidhildenbrand Sep 9, 2021
f23763a
ARM: Qualify enabling of swiotlb_init()
ffainelli Mar 19, 2021
278df06
apparmor: remove duplicate macro list_entry_is_head()
andy-shev Dec 16, 2020
490be34
ARM: 9077/1: PLT: Move struct plt_entries definition to header
asverdlin Sep 22, 2021
1b27a03
ARM: 9078/1: Add warn suppress parameter to arm_gen_branch_link()
asverdlin Sep 22, 2021
2f7974c
ARM: 9079/1: ftrace: Add MODULE_PLTS support
asverdlin Sep 22, 2021
6a12918
ARM: 9098/1: ftrace: MODULE_PLT: Fix build problem without DYNAMIC_FT…
asverdlin Sep 22, 2021
cbd10b1
sctp: validate chunk size in __rcv_asconf_lookup
marceloleitner Jun 28, 2021
2f4b67b
sctp: add param size validation for SCTP_PARAM_SET_PRIMARY
marceloleitner Jun 28, 2021
4cd05e3
staging: rtl8192u: Fix bitwise vs logical operator in TranslateRxSign…
nathanchance Aug 14, 2021
93f8a98
um: virtio_uml: fix memory leak on init failures
jmberg-intel Jun 25, 2021
e106080
dmaengine: acpi: Avoid comparison GSI with Linux vIRQ
andy-shev Jul 30, 2021
c3b45ea
thermal/drivers/exynos: Fix an error code in exynos_tmu_probe()
Aug 10, 2021
b403016
9p/trans_virtio: Remove sysfs file on probe failure
YongjiXie May 17, 2021
5607b1b
prctl: allow to setup brk for et_dyn executables
cyrillos Sep 8, 2021
7e98111
nilfs2: use refcount_dec_and_lock() to fix potential UAF
Sep 8, 2021
b94def8
profiling: fix shift-out-of-bounds bugs
pskrgag Sep 8, 2021
81e6b51
pwm: lpc32xx: Don't modify HW state in .probe() after the PWM chip wa…
Jul 7, 2021
729f9d5
phy: avoid unnecessary link-up delay in polling mode
orosp Feb 18, 2020
3c1d9b6
net: stmmac: reset Tx desc base address before restarting Tx
Dec 6, 2019
c7b9a86
Kconfig.debug: drop selecting non-existing HARDLOCKUP_DETECTOR_ARCH
bulwahn Sep 8, 2021
a12743d
thermal/core: Fix thermal_cooling_device_register() prototype
arndb Jul 22, 2021
2f7bfc0
drivers: base: cacheinfo: Get rid of DEFINE_SMP_CALL_CACHE_FUNCTION()
KAGA-KOKO Aug 31, 2021
445a337
parisc: Move pci_dev_is_behind_card_dino to where it is used
groeck Sep 8, 2021
644f1e8
dmaengine: sprd: Add missing MODULE_DEVICE_TABLE
SamuelZOU May 4, 2021
2f32061
dmaengine: ioat: depends on !UML
jmberg-intel Aug 9, 2021
2c89a85
dmaengine: xilinx_dma: Set DMA mask for coherent APIs
radheyxilinx Aug 19, 2021
3bbb112
ceph: request Fw caps before updating the mtime in ceph_write_iter
jtlayton Aug 11, 2021
3f2d5c1
ceph: lockdep annotations for try_nonblocking_invalidate
jtlayton Sep 2, 2021
fb4c7d2
btrfs: fix lockdep warning while mounting sprout fs
asj Aug 31, 2021
9c3ba40
nilfs2: fix memory leak in nilfs_sysfs_create_device_group
sunnanyong Sep 8, 2021
dc70f0c
nilfs2: fix NULL pointer in nilfs_##name##_attr_release
sunnanyong Sep 8, 2021
288c8b5
nilfs2: fix memory leak in nilfs_sysfs_create_##name##_group
sunnanyong Sep 8, 2021
237ca37
nilfs2: fix memory leak in nilfs_sysfs_delete_##name##_group
sunnanyong Sep 8, 2021
594addd
nilfs2: fix memory leak in nilfs_sysfs_create_snapshot_group
sunnanyong Sep 8, 2021
b16f4ac
nilfs2: fix memory leak in nilfs_sysfs_delete_snapshot_group
sunnanyong Sep 8, 2021
ed60d2d
pwm: img: Don't modify HW state in .remove() callback
Jul 7, 2021
8a29e68
pwm: rockchip: Don't modify HW state in .remove() callback
Jul 7, 2021
c37a34d
pwm: stm32-lp: Don't modify HW state in .remove() callback
Jul 7, 2021
43832bf
blk-throttle: fix UAF by deleteing timer in blk_throtl_exit()
Sep 7, 2021
409cb0b
rtc: rx8010: select REGMAP_I2C
Aug 30, 2021
3825263
drm/nouveau/nvkm: Replace -ENOSYS with -ENODEV
groeck Sep 8, 2021
e74e295
Linux 5.4.149
gregkh Sep 26, 2021
9138803
Merge tag 'v5.4.149' into 5.4-2.3.x-imx
zandrey Sep 27, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# SPDX-License-Identifier: GPL-2.0
VERSION = 5
PATCHLEVEL = 4
SUBLEVEL = 148
SUBLEVEL = 149
EXTRAVERSION =
NAME = Kleptomaniac Octopus

Expand Down
3 changes: 3 additions & 0 deletions arch/arm/include/asm/ftrace.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ extern void __gnu_mcount_nc(void);

#ifdef CONFIG_DYNAMIC_FTRACE
struct dyn_arch_ftrace {
#ifdef CONFIG_ARM_MODULE_PLTS
struct module *mod;
#endif
};

static inline unsigned long ftrace_call_adjust(unsigned long addr)
Expand Down
8 changes: 4 additions & 4 deletions arch/arm/include/asm/insn.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,18 @@ arm_gen_nop(void)
}

unsigned long
__arm_gen_branch(unsigned long pc, unsigned long addr, bool link);
__arm_gen_branch(unsigned long pc, unsigned long addr, bool link, bool warn);

static inline unsigned long
arm_gen_branch(unsigned long pc, unsigned long addr)
{
return __arm_gen_branch(pc, addr, false);
return __arm_gen_branch(pc, addr, false, true);
}

static inline unsigned long
arm_gen_branch_link(unsigned long pc, unsigned long addr)
arm_gen_branch_link(unsigned long pc, unsigned long addr, bool warn)
{
return __arm_gen_branch(pc, addr, true);
return __arm_gen_branch(pc, addr, true, warn);
}

#endif
10 changes: 10 additions & 0 deletions arch/arm/include/asm/module.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,18 @@ enum {
};
#endif

#define PLT_ENT_STRIDE L1_CACHE_BYTES
#define PLT_ENT_COUNT (PLT_ENT_STRIDE / sizeof(u32))
#define PLT_ENT_SIZE (sizeof(struct plt_entries) / PLT_ENT_COUNT)

struct plt_entries {
u32 ldr[PLT_ENT_COUNT];
u32 lit[PLT_ENT_COUNT];
};

struct mod_plt_sec {
struct elf32_shdr *plt;
struct plt_entries *plt_ent;
int plt_count;
};

Expand Down
46 changes: 38 additions & 8 deletions arch/arm/kernel/ftrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,10 @@ int ftrace_arch_code_modify_post_process(void)
return 0;
}

static unsigned long ftrace_call_replace(unsigned long pc, unsigned long addr)
static unsigned long ftrace_call_replace(unsigned long pc, unsigned long addr,
bool warn)
{
return arm_gen_branch_link(pc, addr);
return arm_gen_branch_link(pc, addr, warn);
}

static int ftrace_modify_code(unsigned long pc, unsigned long old,
Expand Down Expand Up @@ -112,14 +113,14 @@ int ftrace_update_ftrace_func(ftrace_func_t func)
int ret;

pc = (unsigned long)&ftrace_call;
new = ftrace_call_replace(pc, (unsigned long)func);
new = ftrace_call_replace(pc, (unsigned long)func, true);

ret = ftrace_modify_code(pc, 0, new, false);

#ifdef CONFIG_DYNAMIC_FTRACE_WITH_REGS
if (!ret) {
pc = (unsigned long)&ftrace_regs_call;
new = ftrace_call_replace(pc, (unsigned long)func);
new = ftrace_call_replace(pc, (unsigned long)func, true);

ret = ftrace_modify_code(pc, 0, new, false);
}
Expand All @@ -132,10 +133,22 @@ int ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr)
{
unsigned long new, old;
unsigned long ip = rec->ip;
unsigned long aaddr = adjust_address(rec, addr);
struct module *mod = NULL;

#ifdef CONFIG_ARM_MODULE_PLTS
mod = rec->arch.mod;
#endif

old = ftrace_nop_replace(rec);

new = ftrace_call_replace(ip, adjust_address(rec, addr));
new = ftrace_call_replace(ip, aaddr, !mod);
#ifdef CONFIG_ARM_MODULE_PLTS
if (!new && mod) {
aaddr = get_module_plt(mod, ip, aaddr);
new = ftrace_call_replace(ip, aaddr, true);
}
#endif

return ftrace_modify_code(rec->ip, old, new, true);
}
Expand All @@ -148,9 +161,9 @@ int ftrace_modify_call(struct dyn_ftrace *rec, unsigned long old_addr,
unsigned long new, old;
unsigned long ip = rec->ip;

old = ftrace_call_replace(ip, adjust_address(rec, old_addr));
old = ftrace_call_replace(ip, adjust_address(rec, old_addr), true);

new = ftrace_call_replace(ip, adjust_address(rec, addr));
new = ftrace_call_replace(ip, adjust_address(rec, addr), true);

return ftrace_modify_code(rec->ip, old, new, true);
}
Expand All @@ -160,12 +173,29 @@ int ftrace_modify_call(struct dyn_ftrace *rec, unsigned long old_addr,
int ftrace_make_nop(struct module *mod,
struct dyn_ftrace *rec, unsigned long addr)
{
unsigned long aaddr = adjust_address(rec, addr);
unsigned long ip = rec->ip;
unsigned long old;
unsigned long new;
int ret;

old = ftrace_call_replace(ip, adjust_address(rec, addr));
#ifdef CONFIG_ARM_MODULE_PLTS
/* mod is only supplied during module loading */
if (!mod)
mod = rec->arch.mod;
else
rec->arch.mod = mod;
#endif

old = ftrace_call_replace(ip, aaddr,
!IS_ENABLED(CONFIG_ARM_MODULE_PLTS) || !mod);
#ifdef CONFIG_ARM_MODULE_PLTS
if (!old && mod) {
aaddr = get_module_plt(mod, ip, aaddr);
old = ftrace_call_replace(ip, aaddr, true);
}
#endif

new = ftrace_nop_replace(rec);
ret = ftrace_modify_code(ip, old, new, true);

Expand Down
19 changes: 10 additions & 9 deletions arch/arm/kernel/insn.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,17 @@
#include <linux/kernel.h>
#include <asm/opcodes.h>

static unsigned long
__arm_gen_branch_thumb2(unsigned long pc, unsigned long addr, bool link)
static unsigned long __arm_gen_branch_thumb2(unsigned long pc,
unsigned long addr, bool link,
bool warn)
{
unsigned long s, j1, j2, i1, i2, imm10, imm11;
unsigned long first, second;
long offset;

offset = (long)addr - (long)(pc + 4);
if (offset < -16777216 || offset > 16777214) {
WARN_ON_ONCE(1);
WARN_ON_ONCE(warn);
return 0;
}

Expand All @@ -33,8 +34,8 @@ __arm_gen_branch_thumb2(unsigned long pc, unsigned long addr, bool link)
return __opcode_thumb32_compose(first, second);
}

static unsigned long
__arm_gen_branch_arm(unsigned long pc, unsigned long addr, bool link)
static unsigned long __arm_gen_branch_arm(unsigned long pc, unsigned long addr,
bool link, bool warn)
{
unsigned long opcode = 0xea000000;
long offset;
Expand All @@ -44,7 +45,7 @@ __arm_gen_branch_arm(unsigned long pc, unsigned long addr, bool link)

offset = (long)addr - (long)(pc + 8);
if (unlikely(offset < -33554432 || offset > 33554428)) {
WARN_ON_ONCE(1);
WARN_ON_ONCE(warn);
return 0;
}

Expand All @@ -54,10 +55,10 @@ __arm_gen_branch_arm(unsigned long pc, unsigned long addr, bool link)
}

unsigned long
__arm_gen_branch(unsigned long pc, unsigned long addr, bool link)
__arm_gen_branch(unsigned long pc, unsigned long addr, bool link, bool warn)
{
if (IS_ENABLED(CONFIG_THUMB2_KERNEL))
return __arm_gen_branch_thumb2(pc, addr, link);
return __arm_gen_branch_thumb2(pc, addr, link, warn);
else
return __arm_gen_branch_arm(pc, addr, link);
return __arm_gen_branch_arm(pc, addr, link, warn);
}
49 changes: 38 additions & 11 deletions arch/arm/kernel/module-plts.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,14 @@
*/

#include <linux/elf.h>
#include <linux/ftrace.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/sort.h>

#include <asm/cache.h>
#include <asm/opcodes.h>

#define PLT_ENT_STRIDE L1_CACHE_BYTES
#define PLT_ENT_COUNT (PLT_ENT_STRIDE / sizeof(u32))
#define PLT_ENT_SIZE (sizeof(struct plt_entries) / PLT_ENT_COUNT)

#ifdef CONFIG_THUMB2_KERNEL
#define PLT_ENT_LDR __opcode_to_mem_thumb32(0xf8dff000 | \
(PLT_ENT_STRIDE - 4))
Expand All @@ -23,24 +20,52 @@
(PLT_ENT_STRIDE - 8))
#endif

struct plt_entries {
u32 ldr[PLT_ENT_COUNT];
u32 lit[PLT_ENT_COUNT];
static const u32 fixed_plts[] = {
#ifdef CONFIG_DYNAMIC_FTRACE
FTRACE_ADDR,
MCOUNT_ADDR,
#endif
};

static bool in_init(const struct module *mod, unsigned long loc)
{
return loc - (u32)mod->init_layout.base < mod->init_layout.size;
}

static void prealloc_fixed(struct mod_plt_sec *pltsec, struct plt_entries *plt)
{
int i;

if (!ARRAY_SIZE(fixed_plts) || pltsec->plt_count)
return;
pltsec->plt_count = ARRAY_SIZE(fixed_plts);

for (i = 0; i < ARRAY_SIZE(plt->ldr); ++i)
plt->ldr[i] = PLT_ENT_LDR;

BUILD_BUG_ON(sizeof(fixed_plts) > sizeof(plt->lit));
memcpy(plt->lit, fixed_plts, sizeof(fixed_plts));
}

u32 get_module_plt(struct module *mod, unsigned long loc, Elf32_Addr val)
{
struct mod_plt_sec *pltsec = !in_init(mod, loc) ? &mod->arch.core :
&mod->arch.init;
struct plt_entries *plt;
int idx;

/* cache the address, ELF header is available only during module load */
if (!pltsec->plt_ent)
pltsec->plt_ent = (struct plt_entries *)pltsec->plt->sh_addr;
plt = pltsec->plt_ent;

struct plt_entries *plt = (struct plt_entries *)pltsec->plt->sh_addr;
int idx = 0;
prealloc_fixed(pltsec, plt);

for (idx = 0; idx < ARRAY_SIZE(fixed_plts); ++idx)
if (plt->lit[idx] == val)
return (u32)&plt->ldr[idx];

idx = 0;
/*
* Look for an existing entry pointing to 'val'. Given that the
* relocations are sorted, this will be the last entry we allocated.
Expand Down Expand Up @@ -188,8 +213,8 @@ static unsigned int count_plts(const Elf32_Sym *syms, Elf32_Addr base,
int module_frob_arch_sections(Elf_Ehdr *ehdr, Elf_Shdr *sechdrs,
char *secstrings, struct module *mod)
{
unsigned long core_plts = 0;
unsigned long init_plts = 0;
unsigned long core_plts = ARRAY_SIZE(fixed_plts);
unsigned long init_plts = ARRAY_SIZE(fixed_plts);
Elf32_Shdr *s, *sechdrs_end = sechdrs + ehdr->e_shnum;
Elf32_Sym *syms = NULL;

Expand Down Expand Up @@ -244,13 +269,15 @@ int module_frob_arch_sections(Elf_Ehdr *ehdr, Elf_Shdr *sechdrs,
mod->arch.core.plt->sh_size = round_up(core_plts * PLT_ENT_SIZE,
sizeof(struct plt_entries));
mod->arch.core.plt_count = 0;
mod->arch.core.plt_ent = NULL;

mod->arch.init.plt->sh_type = SHT_NOBITS;
mod->arch.init.plt->sh_flags = SHF_EXECINSTR | SHF_ALLOC;
mod->arch.init.plt->sh_addralign = L1_CACHE_BYTES;
mod->arch.init.plt->sh_size = round_up(init_plts * PLT_ENT_SIZE,
sizeof(struct plt_entries));
mod->arch.init.plt_count = 0;
mod->arch.init.plt_ent = NULL;

pr_debug("%s: plt=%x, init.plt=%x\n", __func__,
mod->arch.core.plt->sh_size, mod->arch.init.plt->sh_size);
Expand Down
6 changes: 5 additions & 1 deletion arch/arm/mm/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,11 @@ static void __init free_highpages(void)
void __init mem_init(void)
{
#ifdef CONFIG_ARM_LPAE
swiotlb_init(1);
if (swiotlb_force == SWIOTLB_FORCE ||
max_pfn > arm_dma_pfn_limit)
swiotlb_init(1);
else
swiotlb_force = SWIOTLB_NO_FORCE;
#endif

set_max_mapnr(pfn_to_page(max_pfn) - mem_map);
Expand Down
7 changes: 2 additions & 5 deletions arch/arm64/kernel/cacheinfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ static void ci_leaf_init(struct cacheinfo *this_leaf,
this_leaf->type = type;
}

static int __init_cache_level(unsigned int cpu)
int init_cache_level(unsigned int cpu)
{
unsigned int ctype, level, leaves, fw_level;
struct cpu_cacheinfo *this_cpu_ci = get_cpu_cacheinfo(cpu);
Expand Down Expand Up @@ -78,7 +78,7 @@ static int __init_cache_level(unsigned int cpu)
return 0;
}

static int __populate_cache_leaves(unsigned int cpu)
int populate_cache_leaves(unsigned int cpu)
{
unsigned int level, idx;
enum cache_type type;
Expand All @@ -97,6 +97,3 @@ static int __populate_cache_leaves(unsigned int cpu)
}
return 0;
}

DEFINE_SMP_CALL_CACHE_FUNCTION(init_cache_level)
DEFINE_SMP_CALL_CACHE_FUNCTION(populate_cache_leaves)
7 changes: 2 additions & 5 deletions arch/mips/kernel/cacheinfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ do { \
leaf++; \
} while (0)

static int __init_cache_level(unsigned int cpu)
int init_cache_level(unsigned int cpu)
{
struct cpuinfo_mips *c = &current_cpu_data;
struct cpu_cacheinfo *this_cpu_ci = get_cpu_cacheinfo(cpu);
Expand Down Expand Up @@ -69,7 +69,7 @@ static void fill_cpumask_cluster(int cpu, cpumask_t *cpu_map)
cpumask_set_cpu(cpu1, cpu_map);
}

static int __populate_cache_leaves(unsigned int cpu)
int populate_cache_leaves(unsigned int cpu)
{
struct cpuinfo_mips *c = &current_cpu_data;
struct cpu_cacheinfo *this_cpu_ci = get_cpu_cacheinfo(cpu);
Expand Down Expand Up @@ -98,6 +98,3 @@ static int __populate_cache_leaves(unsigned int cpu)

return 0;
}

DEFINE_SMP_CALL_CACHE_FUNCTION(init_cache_level)
DEFINE_SMP_CALL_CACHE_FUNCTION(populate_cache_leaves)
Loading