Skip to content

Commit 8c8f97e

Browse files
authored
Merge pull request torvalds#83 from zandrey/5.4.x+fslc
Update 5.4.x+fslc to v5.4.45
2 parents bb56522 + c3895dd commit 8c8f97e

File tree

50 files changed

+460
-185
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+460
-185
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# SPDX-License-Identifier: GPL-2.0
22
VERSION = 5
33
PATCHLEVEL = 4
4-
SUBLEVEL = 44
4+
SUBLEVEL = 45
55
EXTRAVERSION =
66
NAME = Kleptomaniac Octopus
77

arch/arc/kernel/setup.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include <linux/clocksource.h>
1313
#include <linux/console.h>
1414
#include <linux/module.h>
15+
#include <linux/sizes.h>
1516
#include <linux/cpu.h>
1617
#include <linux/of_fdt.h>
1718
#include <linux/of.h>
@@ -409,12 +410,12 @@ static void arc_chk_core_config(void)
409410
if ((unsigned int)__arc_dccm_base != cpu->dccm.base_addr)
410411
panic("Linux built with incorrect DCCM Base address\n");
411412

412-
if (CONFIG_ARC_DCCM_SZ != cpu->dccm.sz)
413+
if (CONFIG_ARC_DCCM_SZ * SZ_1K != cpu->dccm.sz)
413414
panic("Linux built with incorrect DCCM Size\n");
414415
#endif
415416

416417
#ifdef CONFIG_ARC_HAS_ICCM
417-
if (CONFIG_ARC_ICCM_SZ != cpu->iccm.sz)
418+
if (CONFIG_ARC_ICCM_SZ * SZ_1K != cpu->iccm.sz)
418419
panic("Linux built with incorrect ICCM Size\n");
419420
#endif
420421

arch/arc/plat-eznps/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
menuconfig ARC_PLAT_EZNPS
88
bool "\"EZchip\" ARC dev platform"
9+
depends on ISA_ARCOMPACT
910
select CPU_BIG_ENDIAN
1011
select CLKSRC_NPS if !PHYS_ADDR_T_64BIT
1112
select EZNPS_GIC

arch/powerpc/platforms/powernv/opal-imc.c

Lines changed: 16 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,6 @@ static void export_imc_mode_and_cmd(struct device_node *node,
5959

6060
imc_debugfs_parent = debugfs_create_dir("imc", powerpc_debugfs_root);
6161

62-
/*
63-
* Return here, either because 'imc' directory already exists,
64-
* Or failed to create a new one.
65-
*/
6662
if (!imc_debugfs_parent)
6763
return;
6864

@@ -135,7 +131,6 @@ static int imc_get_mem_addr_nest(struct device_node *node,
135131
}
136132

137133
pmu_ptr->imc_counter_mmaped = true;
138-
export_imc_mode_and_cmd(node, pmu_ptr);
139134
kfree(base_addr_arr);
140135
kfree(chipid_arr);
141136
return 0;
@@ -151,35 +146,31 @@ static int imc_get_mem_addr_nest(struct device_node *node,
151146
* and domain as the inputs.
152147
* Allocates memory for the struct imc_pmu, sets up its domain, size and offsets
153148
*/
154-
static int imc_pmu_create(struct device_node *parent, int pmu_index, int domain)
149+
static struct imc_pmu *imc_pmu_create(struct device_node *parent, int pmu_index, int domain)
155150
{
156151
int ret = 0;
157152
struct imc_pmu *pmu_ptr;
158153
u32 offset;
159154

160155
/* Return for unknown domain */
161156
if (domain < 0)
162-
return -EINVAL;
157+
return NULL;
163158

164159
/* memory for pmu */
165160
pmu_ptr = kzalloc(sizeof(*pmu_ptr), GFP_KERNEL);
166161
if (!pmu_ptr)
167-
return -ENOMEM;
162+
return NULL;
168163

169164
/* Set the domain */
170165
pmu_ptr->domain = domain;
171166

172167
ret = of_property_read_u32(parent, "size", &pmu_ptr->counter_mem_size);
173-
if (ret) {
174-
ret = -EINVAL;
168+
if (ret)
175169
goto free_pmu;
176-
}
177170

178171
if (!of_property_read_u32(parent, "offset", &offset)) {
179-
if (imc_get_mem_addr_nest(parent, pmu_ptr, offset)) {
180-
ret = -EINVAL;
172+
if (imc_get_mem_addr_nest(parent, pmu_ptr, offset))
181173
goto free_pmu;
182-
}
183174
}
184175

185176
/* Function to register IMC pmu */
@@ -190,14 +181,14 @@ static int imc_pmu_create(struct device_node *parent, int pmu_index, int domain)
190181
if (pmu_ptr->domain == IMC_DOMAIN_NEST)
191182
kfree(pmu_ptr->mem_info);
192183
kfree(pmu_ptr);
193-
return ret;
184+
return NULL;
194185
}
195186

196-
return 0;
187+
return pmu_ptr;
197188

198189
free_pmu:
199190
kfree(pmu_ptr);
200-
return ret;
191+
return NULL;
201192
}
202193

203194
static void disable_nest_pmu_counters(void)
@@ -254,6 +245,7 @@ int get_max_nest_dev(void)
254245
static int opal_imc_counters_probe(struct platform_device *pdev)
255246
{
256247
struct device_node *imc_dev = pdev->dev.of_node;
248+
struct imc_pmu *pmu;
257249
int pmu_count = 0, domain;
258250
bool core_imc_reg = false, thread_imc_reg = false;
259251
u32 type;
@@ -269,6 +261,7 @@ static int opal_imc_counters_probe(struct platform_device *pdev)
269261
}
270262

271263
for_each_compatible_node(imc_dev, NULL, IMC_DTB_UNIT_COMPAT) {
264+
pmu = NULL;
272265
if (of_property_read_u32(imc_dev, "type", &type)) {
273266
pr_warn("IMC Device without type property\n");
274267
continue;
@@ -300,20 +293,20 @@ static int opal_imc_counters_probe(struct platform_device *pdev)
300293
break;
301294
}
302295

303-
if (!imc_pmu_create(imc_dev, pmu_count, domain)) {
304-
if (domain == IMC_DOMAIN_NEST)
296+
pmu = imc_pmu_create(imc_dev, pmu_count, domain);
297+
if (pmu != NULL) {
298+
if (domain == IMC_DOMAIN_NEST) {
299+
if (!imc_debugfs_parent)
300+
export_imc_mode_and_cmd(imc_dev, pmu);
305301
pmu_count++;
302+
}
306303
if (domain == IMC_DOMAIN_CORE)
307304
core_imc_reg = true;
308305
if (domain == IMC_DOMAIN_THREAD)
309306
thread_imc_reg = true;
310307
}
311308
}
312309

313-
/* If none of the nest units are registered, remove debugfs interface */
314-
if (pmu_count == 0)
315-
debugfs_remove_recursive(imc_debugfs_parent);
316-
317310
/* If core imc is not registered, unregister thread-imc */
318311
if (!core_imc_reg && thread_imc_reg)
319312
unregister_thread_imc();

arch/powerpc/xmon/xmon.c

Lines changed: 82 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include <linux/nmi.h>
2626
#include <linux/ctype.h>
2727
#include <linux/highmem.h>
28+
#include <linux/security.h>
2829

2930
#include <asm/debugfs.h>
3031
#include <asm/ptrace.h>
@@ -187,6 +188,8 @@ static void dump_tlb_44x(void);
187188
static void dump_tlb_book3e(void);
188189
#endif
189190

191+
static void clear_all_bpt(void);
192+
190193
#ifdef CONFIG_PPC64
191194
#define REG "%.16lx"
192195
#else
@@ -283,10 +286,38 @@ Commands:\n\
283286
" U show uptime information\n"
284287
" ? help\n"
285288
" # n limit output to n lines per page (for dp, dpa, dl)\n"
286-
" zr reboot\n\
287-
zh halt\n"
289+
" zr reboot\n"
290+
" zh halt\n"
288291
;
289292

293+
#ifdef CONFIG_SECURITY
294+
static bool xmon_is_locked_down(void)
295+
{
296+
static bool lockdown;
297+
298+
if (!lockdown) {
299+
lockdown = !!security_locked_down(LOCKDOWN_XMON_RW);
300+
if (lockdown) {
301+
printf("xmon: Disabled due to kernel lockdown\n");
302+
xmon_is_ro = true;
303+
}
304+
}
305+
306+
if (!xmon_is_ro) {
307+
xmon_is_ro = !!security_locked_down(LOCKDOWN_XMON_WR);
308+
if (xmon_is_ro)
309+
printf("xmon: Read-only due to kernel lockdown\n");
310+
}
311+
312+
return lockdown;
313+
}
314+
#else /* CONFIG_SECURITY */
315+
static inline bool xmon_is_locked_down(void)
316+
{
317+
return false;
318+
}
319+
#endif
320+
290321
static struct pt_regs *xmon_regs;
291322

292323
static inline void sync(void)
@@ -438,7 +469,10 @@ static bool wait_for_other_cpus(int ncpus)
438469

439470
return false;
440471
}
441-
#endif /* CONFIG_SMP */
472+
#else /* CONFIG_SMP */
473+
static inline void get_output_lock(void) {}
474+
static inline void release_output_lock(void) {}
475+
#endif
442476

443477
static inline int unrecoverable_excp(struct pt_regs *regs)
444478
{
@@ -455,6 +489,7 @@ static int xmon_core(struct pt_regs *regs, int fromipi)
455489
int cmd = 0;
456490
struct bpt *bp;
457491
long recurse_jmp[JMP_BUF_LEN];
492+
bool locked_down;
458493
unsigned long offset;
459494
unsigned long flags;
460495
#ifdef CONFIG_SMP
@@ -465,6 +500,8 @@ static int xmon_core(struct pt_regs *regs, int fromipi)
465500
local_irq_save(flags);
466501
hard_irq_disable();
467502

503+
locked_down = xmon_is_locked_down();
504+
468505
if (!fromipi) {
469506
tracing_enabled = tracing_is_on();
470507
tracing_off();
@@ -518,7 +555,8 @@ static int xmon_core(struct pt_regs *regs, int fromipi)
518555

519556
if (!fromipi) {
520557
get_output_lock();
521-
excprint(regs);
558+
if (!locked_down)
559+
excprint(regs);
522560
if (bp) {
523561
printf("cpu 0x%x stopped at breakpoint 0x%tx (",
524562
cpu, BP_NUM(bp));
@@ -570,10 +608,14 @@ static int xmon_core(struct pt_regs *regs, int fromipi)
570608
}
571609
remove_bpts();
572610
disable_surveillance();
573-
/* for breakpoint or single step, print the current instr. */
574-
if (bp || TRAP(regs) == 0xd00)
575-
ppc_inst_dump(regs->nip, 1, 0);
576-
printf("enter ? for help\n");
611+
612+
if (!locked_down) {
613+
/* for breakpoint or single step, print curr insn */
614+
if (bp || TRAP(regs) == 0xd00)
615+
ppc_inst_dump(regs->nip, 1, 0);
616+
printf("enter ? for help\n");
617+
}
618+
577619
mb();
578620
xmon_gate = 1;
579621
barrier();
@@ -597,8 +639,9 @@ static int xmon_core(struct pt_regs *regs, int fromipi)
597639
spin_cpu_relax();
598640
touch_nmi_watchdog();
599641
} else {
600-
cmd = cmds(regs);
601-
if (cmd != 0) {
642+
if (!locked_down)
643+
cmd = cmds(regs);
644+
if (locked_down || cmd != 0) {
602645
/* exiting xmon */
603646
insert_bpts();
604647
xmon_gate = 0;
@@ -635,13 +678,16 @@ static int xmon_core(struct pt_regs *regs, int fromipi)
635678
"can't continue\n");
636679
remove_bpts();
637680
disable_surveillance();
638-
/* for breakpoint or single step, print the current instr. */
639-
if (bp || TRAP(regs) == 0xd00)
640-
ppc_inst_dump(regs->nip, 1, 0);
641-
printf("enter ? for help\n");
681+
if (!locked_down) {
682+
/* for breakpoint or single step, print current insn */
683+
if (bp || TRAP(regs) == 0xd00)
684+
ppc_inst_dump(regs->nip, 1, 0);
685+
printf("enter ? for help\n");
686+
}
642687
}
643688

644-
cmd = cmds(regs);
689+
if (!locked_down)
690+
cmd = cmds(regs);
645691

646692
insert_bpts();
647693
in_xmon = 0;
@@ -670,7 +716,10 @@ static int xmon_core(struct pt_regs *regs, int fromipi)
670716
}
671717
}
672718
#endif
673-
insert_cpu_bpts();
719+
if (locked_down)
720+
clear_all_bpt();
721+
else
722+
insert_cpu_bpts();
674723

675724
touch_nmi_watchdog();
676725
local_irq_restore(flags);
@@ -3761,6 +3810,11 @@ static void xmon_init(int enable)
37613810
#ifdef CONFIG_MAGIC_SYSRQ
37623811
static void sysrq_handle_xmon(int key)
37633812
{
3813+
if (xmon_is_locked_down()) {
3814+
clear_all_bpt();
3815+
xmon_init(0);
3816+
return;
3817+
}
37643818
/* ensure xmon is enabled */
37653819
xmon_init(1);
37663820
debugger(get_irq_regs());
@@ -3782,7 +3836,6 @@ static int __init setup_xmon_sysrq(void)
37823836
device_initcall(setup_xmon_sysrq);
37833837
#endif /* CONFIG_MAGIC_SYSRQ */
37843838

3785-
#ifdef CONFIG_DEBUG_FS
37863839
static void clear_all_bpt(void)
37873840
{
37883841
int i;
@@ -3800,18 +3853,22 @@ static void clear_all_bpt(void)
38003853
iabr = NULL;
38013854
dabr.enabled = 0;
38023855
}
3803-
3804-
printf("xmon: All breakpoints cleared\n");
38053856
}
38063857

3858+
#ifdef CONFIG_DEBUG_FS
38073859
static int xmon_dbgfs_set(void *data, u64 val)
38083860
{
38093861
xmon_on = !!val;
38103862
xmon_init(xmon_on);
38113863

38123864
/* make sure all breakpoints removed when disabling */
3813-
if (!xmon_on)
3865+
if (!xmon_on) {
38143866
clear_all_bpt();
3867+
get_output_lock();
3868+
printf("xmon: All breakpoints cleared\n");
3869+
release_output_lock();
3870+
}
3871+
38153872
return 0;
38163873
}
38173874

@@ -3837,7 +3894,11 @@ static int xmon_early __initdata;
38373894

38383895
static int __init early_parse_xmon(char *p)
38393896
{
3840-
if (!p || strncmp(p, "early", 5) == 0) {
3897+
if (xmon_is_locked_down()) {
3898+
xmon_init(0);
3899+
xmon_early = 0;
3900+
xmon_on = 0;
3901+
} else if (!p || strncmp(p, "early", 5) == 0) {
38413902
/* just "xmon" is equivalent to "xmon=early" */
38423903
xmon_init(1);
38433904
xmon_early = 1;

arch/s390/kernel/mcount.S

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ EXPORT_SYMBOL(_mcount)
4141
ENTRY(ftrace_caller)
4242
.globl ftrace_regs_caller
4343
.set ftrace_regs_caller,ftrace_caller
44+
stg %r14,(__SF_GPRS+8*8)(%r15) # save traced function caller
4445
lgr %r1,%r15
4546
#if !(defined(CC_USING_HOTPATCH) || defined(CC_USING_NOP_MCOUNT))
4647
aghi %r0,MCOUNT_RETURN_FIXUP

0 commit comments

Comments
 (0)