Skip to contentSkip to conversation

core/urgent for 5.3-rc1

GIT PULL Merged Thomas Gleixner 2 participants 8 messages Jul 11, 2019

Subsystems (9)
lore
Share & tools
lore
#0 lore raw

Linus,

please pull the latest core-urgent-for-linus git tree from:

git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git core-urgent-for-linus

up to: 7e8e6816c649: stacktrace: Use PF_KTHREAD to check for kernel threads

Fix yet another instance of kernel thread check which ignores that kernel threads can call use_mm().

Thanks,

tglx

------------------>
Thomas Gleixner (1):
stacktrace: Use PF_KTHREAD to check for kernel threads

 kernel/stacktrace.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/stacktrace.c +1 -1
index 36139de0a3c4..c8d0f05721a1 100644
@@ -228,7 +228,7 @@ unsigned int stack_trace_save_user(unsigned long *store, unsigned int size)
 	};
 
 	/* Trace user stack if not a kernel thread */
-	if (!current->mm)
+	if (current->flags & PF_KTHREAD)
 		return 0;
 
 	arch_stack_walk_user(consume_entry, &c, task_pt_regs(current));
#1 lore raw

[GIT pull] irq/urgent for 5.3-rc1

Linus,

please pull the latest irq-urgent-for-linus git tree from:

git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git irq-urgent-for-linus

up to: 20faba848752: irqchip/gic-v3-its: Fix misuse of GENMASK macro

Two small fixes for interrupt chip drivers:

- Prevent UAF in the new RZA1 chip driver

- Fix the wrong argument order of the GENMASK macro in the GIC code

Thanks,

tglx

------------------>
Joe Perches (1):
irqchip/gic-v3-its: Fix misuse of GENMASK macro

Wen Yang (1):
irqchip/renesas-rza1: Prevent use-after-free in rza1_irqc_probe()

 drivers/irqchip/irq-gic-v3-its.c   |  2 +-
 drivers/irqchip/irq-renesas-rza1.c | 15 ++++++++-------
 2 files changed, 9 insertions(+), 8 deletions(-)
drivers/irqchip/irq-gic-v3-its.c +1 -1
index 35500801dc2b..730fbe0e2a9d 100644
@@ -185,7 +185,7 @@ static struct its_collection *dev_event_to_col(struct its_device *its_dev,
 
 static struct its_collection *valid_col(struct its_collection *col)
 {
-	if (WARN_ON_ONCE(col->target_address & GENMASK_ULL(0, 15)))
+	if (WARN_ON_ONCE(col->target_address & GENMASK_ULL(15, 0)))
 		return NULL;
 
 	return col;
drivers/irqchip/irq-renesas-rza1.c +8 -7
index b1f19b210190..b0d46ac42b89 100644
@@ -208,20 +208,19 @@ static int rza1_irqc_probe(struct platform_device *pdev)
 		return PTR_ERR(priv->base);
 
 	gic_node = of_irq_find_parent(np);
-	if (gic_node) {
+	if (gic_node)
 		parent = irq_find_host(gic_node);
-		of_node_put(gic_node);
-	}
 
 	if (!parent) {
 		dev_err(dev, "cannot find parent domain\n");
-		return -ENODEV;
+		ret = -ENODEV;
+		goto out_put_node;
 	}
 
 	ret = rza1_irqc_parse_map(priv, gic_node);
 	if (ret) {
 		dev_err(dev, "cannot parse %s: %d\n", "interrupt-map", ret);
-		return ret;
+		goto out_put_node;
 	}
 
 	priv->chip.name = "rza1-irqc",
@@ -237,10 +236,12 @@ static int rza1_irqc_probe(struct platform_device *pdev)
 						    priv);
 	if (!priv->irq_domain) {
 		dev_err(dev, "cannot initialize irq domain\n");
-		return -ENOMEM;
+		ret = -ENOMEM;
 	}
 
-	return 0;
+out_put_node:
+	of_node_put(gic_node);
+	return ret;
 }
 
 static int rza1_irqc_remove(struct platform_device *pdev)
merge bot Merged
#2 lore raw

Re: [GIT pull] irq/urgent for 5.3-rc1

The pull request you sent on Thu, 11 Jul 2019 20:02:36 -0000:

The pull request you sent on Thu, 11 Jul 2019 20:02:36 -0000:

Quoted 1 line

git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git irq-urgent-for-linus

has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/3a83f575a33b960b7b1d582dc17f154d887c9b8d

Thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.wiki.kernel.org/userdoc/prtracker
#3 lore raw

[GIT pull] x86/urgent for 5.3-rc1

In reply to Thomas Gleixner

Linus,

please pull the latest x86-urgent-for-linus git tree from:

git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86-urgent-for-linus

up to: cbf5b73d162b: x86/stacktrace: Prevent infinite loop in arch_stack_walk_user()

A collection of assorted fixes:

- Fix for the pinned cr0/4 fallout which escaped all testing efforts because the kvm-intel module was never loaded when the kernel was compiled with CONFIG_PARAVIRT=n. The cr0/4 accessors are moved out of line and static key is now solely used in the core code and therefore can stay in the RO after init section. So the kvm-intel and other modules do not longer reference the (read only) static key which the module loader tried to update.

- Prevent an infinite loop in arch_stack_walk_user() by breaking out of the loop once the return address is detected to be 0.

- Prevent the int3_emulate_call() selftest from corrupting the stack when KASAN is enabled. KASASN clobbers more registers than covered by the emulated call implementation. Convert the int3_magic() selftest to a ASM function so the compiler cannot KASANify it.

- Unbreak the build with old GCC versions and with the Gold linker by reverting the 'Move of _etext to the actual end of .text'. In both cases the build fails with 'Invalid absolute R_X86_64_32S relocation: _etext'

- Initialize the context lock for init_mm, which was never an issue until the alternatives code started to use a temporary mm for patching.

- Fix a build warning vs. the LOWMEM_PAGES constant where clang complains rightfully about a signed integer overflow in the shift operation by converting the operand to an ULL.

- Adjust the misnomed ENDPROC() of common_spurious in the 32bit entry code.

Thanks,

tglx

------------------>
Arnd Bergmann (1):
x86/pgtable/32: Fix LOWMEM_PAGES constant

Eiichi Tsukata (1):
x86/stacktrace: Prevent infinite loop in arch_stack_walk_user()

Jiri Slaby (1):
x86/entry/32: Fix ENDPROC of common_spurious

Peter Zijlstra (1):
x86/alternatives: Fix int3_emulate_call() selftest stack corruption

Ross Zwisler (1):
Revert "x86/build: Move _etext to actual end of .text"

Sebastian Andrzej Siewior (1):
x86/ldt: Initialize the context lock for init_mm

Thomas Gleixner (1):
x86/asm: Move native_write_cr0/4() out of line

 arch/x86/entry/entry_32.S            |  2 +-
 arch/x86/include/asm/mmu.h           |  1 +
 arch/x86/include/asm/pgtable_32.h    |  2 +-
 arch/x86/include/asm/processor.h     |  1 +
 arch/x86/include/asm/special_insns.h | 41 +-------------------
 arch/x86/kernel/alternative.c        | 25 ++++++++++---
 arch/x86/kernel/cpu/common.c         | 72 ++++++++++++++++++++++++++++--------
 arch/x86/kernel/smpboot.c            | 14 +------
 arch/x86/kernel/stacktrace.c         |  8 ++--
 arch/x86/kernel/vmlinux.lds.S        |  6 +--
 arch/x86/xen/smp_pv.c                |  1 +
 11 files changed, 90 insertions(+), 83 deletions(-)
arch/x86/entry/entry_32.S +1 -1
index 1285e5abf669..90b473297299 100644
@@ -1189,7 +1189,7 @@ common_spurious:
 	movl	%esp, %eax
 	call	smp_spurious_interrupt
 	jmp	ret_from_intr
-ENDPROC(common_interrupt)
+ENDPROC(common_spurious)
 #endif
 
 /*
arch/x86/include/asm/mmu.h +1 -0
index 5ff3e8af2c20..e78c7db87801 100644
@@ -59,6 +59,7 @@ typedef struct {
 #define INIT_MM_CONTEXT(mm)						\
 	.context = {							\
 		.ctx_id = 1,						\
+		.lock = __MUTEX_INITIALIZER(mm.context.lock),		\
 	}
 
 void leave_mm(int cpu);
arch/x86/include/asm/pgtable_32.h +1 -1
index 4fe9e7fc74d3..c78da8eda8f2 100644
@@ -106,6 +106,6 @@ do {						\
  * with only a host target support using a 32-bit type for internal
  * representation.
  */
-#define LOWMEM_PAGES ((((2<<31) - __PAGE_OFFSET) >> PAGE_SHIFT))
+#define LOWMEM_PAGES ((((_ULL(2)<<31) - __PAGE_OFFSET) >> PAGE_SHIFT))
 
 #endif /* _ASM_X86_PGTABLE_32_H */
arch/x86/include/asm/processor.h +1 -0
index 3eab6ece52b4..6e0a3b43d027 100644
@@ -741,6 +741,7 @@ extern void load_direct_gdt(int);
 extern void load_fixmap_gdt(int);
 extern void load_percpu_segment(int);
 extern void cpu_init(void);
+extern void cr4_init(void);
 
 static inline unsigned long get_debugctlmsr(void)
 {
arch/x86/include/asm/special_insns.h +2 -39

59 lines not on this page · raw message

arch/x86/kernel/alternative.c +20 -5
index 99ef8b6f9a1a..ccd32013c47a 100644
@@ -625,10 +625,23 @@ extern struct paravirt_patch_site __start_parainstructions[],
  *
  * See entry_{32,64}.S for more details.
  */
-static void __init int3_magic(unsigned int *ptr)
-{
-	*ptr = 1;
-}
+
+/*
+ * We define the int3_magic() function in assembly to control the calling
+ * convention such that we can 'call' it from assembly.
+ */
+
+extern void int3_magic(unsigned int *ptr); /* defined in asm */
+
+asm (
+"	.pushsection	.init.text, \"ax\", @progbits\n"
+"	.type		int3_magic, @function\n"
+"int3_magic:\n"
+"	movl	$1, (%" _ASM_ARG1 ")\n"
+"	ret\n"
+"	.size		int3_magic, .-int3_magic\n"
+"	.popsection\n"
+);
 
 extern __initdata unsigned long int3_selftest_ip; /* defined in asm below */
 
@@ -676,7 +689,9 @@ static void __init int3_selftest(void)
 		      "int3_selftest_ip:\n\t"
 		      __ASM_SEL(.long, .quad) " 1b\n\t"
 		      ".popsection\n\t"
-		      : : __ASM_SEL_RAW(a, D) (&val) : "memory");
+		      : ASM_CALL_CONSTRAINT
+		      : __ASM_SEL_RAW(a, D) (&val)
+		      : "memory");
 
 	BUG_ON(val != 1);
 
arch/x86/kernel/cpu/common.c +56 -16

90 lines not on this page · raw message

arch/x86/kernel/smpboot.c +1 -13
index f78801114ee1..259d1d2be076 100644
@@ -210,28 +210,16 @@ static int enable_start_cpu0;
  */
 static void notrace start_secondary(void *unused)
 {
-	unsigned long cr4 = __read_cr4();
-
 	/*
 	 * Don't put *anything* except direct CPU state initialization
 	 * before cpu_init(), SMP booting is too fragile that we want to
 	 * limit the things done here to the most necessary things.
 	 */
-	if (boot_cpu_has(X86_FEATURE_PCID))
-		cr4 |= X86_CR4_PCIDE;
-	if (static_branch_likely(&cr_pinning))
-		cr4 |= cr4_pinned_bits;
-
-	__write_cr4(cr4);
+	cr4_init();
 
 #ifdef CONFIG_X86_32
 	/* switch away from the initial page table */
 	load_cr3(swapper_pg_dir);
-	/*
-	 * Initialize the CR4 shadow before doing anything that could
-	 * try to read it.
-	 */
-	cr4_init_shadow();
 	__flush_tlb_all();
 #endif
 	load_current_idt();
arch/x86/kernel/stacktrace.c +3 -5
index 2abf27d7df6b..4f36d3241faf 100644
@@ -129,11 +129,9 @@ void arch_stack_walk_user(stack_trace_consume_fn consume_entry, void *cookie,
 			break;
 		if ((unsigned long)fp < regs->sp)
 			break;
-		if (frame.ret_addr) {
-			if (!consume_entry(cookie, frame.ret_addr, false))
-				return;
-		}
-		if (fp == frame.next_fp)
+		if (!frame.ret_addr)
+			break;
+		if (!consume_entry(cookie, frame.ret_addr, false))
 			break;
 		fp = frame.next_fp;
 	}
arch/x86/kernel/vmlinux.lds.S +3 -3
index 0850b5149345..4d1517022a14 100644
@@ -141,10 +141,10 @@ SECTIONS
 		*(.text.__x86.indirect_thunk)
 		__indirect_thunk_end = .;
 #endif
-	} :text = 0x9090
 
-	/* End of text section */
-	_etext = .;
+		/* End of text section */
+		_etext = .;
+	} :text = 0x9090
 
 	NOTES :text :note
 
arch/x86/xen/smp_pv.c +1 -0
index 77d81c1a63e9..802ee5bba66c 100644
@@ -58,6 +58,7 @@ static void cpu_bringup(void)
 {
 	int cpu;
 
+	cr4_init();
 	cpu_init();
 	touch_softlockup_watchdog();
 	preempt_disable();
merge bot Merged
#4 lore raw

Re: [GIT pull] x86/urgent for 5.3-rc1

The pull request you sent on Thu, 11 Jul 2019 20:02:36 -0000:

The pull request you sent on Thu, 11 Jul 2019 20:02:36 -0000:

Quoted 1 line

git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86-urgent-for-linus

has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/753c8d9b7d81206bb5d011b28abe829d364b028e

Thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.wiki.kernel.org/userdoc/prtracker
#5 lore raw

[GIT pull] timers/urgent for 5.3-rc1

In reply to Thomas Gleixner

Linus,

please pull the latest timers-urgent-for-linus git tree from:

git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git timers-urgent-for-linus

up to: 0df1c9868c3a: timekeeping/vsyscall: Use __iter_div_u64_rem()

Two small fixes from the timer departement:

- Prevent the compiler from converting the nanoseconds adjustment loop in the VDSO update function to a division (__udivdi3) by using the __iter_div_u64_rem() inline function which exists to prevent exactly that problem.

- Fix the wrong argument order of the GENMASK macro in the NPCM timer driver

Thanks,

tglx

------------------>
Arnd Bergmann (1):
timekeeping/vsyscall: Use __iter_div_u64_rem()

Joe Perches (1):
clocksource/drivers/npcm: Fix misuse of GENMASK macro

 drivers/clocksource/timer-npcm7xx.c | 2 +-
 kernel/time/vsyscall.c              | 6 +-----
 2 files changed, 2 insertions(+), 6 deletions(-)
drivers/clocksource/timer-npcm7xx.c +1 -1
index 7a9bb5532d99..8a30da7f083b 100644
@@ -32,7 +32,7 @@
 #define NPCM7XX_Tx_INTEN		BIT(29)
 #define NPCM7XX_Tx_COUNTEN		BIT(30)
 #define NPCM7XX_Tx_ONESHOT		0x0
-#define NPCM7XX_Tx_OPER			GENMASK(3, 27)
+#define NPCM7XX_Tx_OPER			GENMASK(27, 3)
 #define NPCM7XX_Tx_MIN_PRESCALE		0x1
 #define NPCM7XX_Tx_TDR_MASK_BITS	24
 #define NPCM7XX_Tx_MAX_CNT		0xFFFFFF
kernel/time/vsyscall.c +1 -5
index a80893180826..8cf3596a4ce6 100644
@@ -104,11 +104,7 @@ void update_vsyscall(struct timekeeper *tk)
 	vdso_ts->sec	= tk->xtime_sec + tk->wall_to_monotonic.tv_sec;
 	nsec		= tk->tkr_mono.xtime_nsec >> tk->tkr_mono.shift;
 	nsec		= nsec + tk->wall_to_monotonic.tv_nsec;
-	while (nsec >= NSEC_PER_SEC) {
-		nsec = nsec - NSEC_PER_SEC;
-		vdso_ts->sec++;
-	}
-	vdso_ts->nsec	= nsec;
+	vdso_ts->sec	+= __iter_div_u64_rem(nsec, NSEC_PER_SEC, &vdso_ts->nsec);
 
 	if (__arch_use_vsyscall(vdata))
 		update_vdso_data(vdata, tk);
merge bot Merged
#6 lore raw

Re: [GIT pull] timers/urgent for 5.3-rc1

The pull request you sent on Thu, 11 Jul 2019 20:02:36 -0000:

The pull request you sent on Thu, 11 Jul 2019 20:02:36 -0000:

Quoted 1 line

git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git timers-urgent-for-linus

has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/d7fe42a64a19a4140fb94bcf996035319cd3e6b9

Thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.wiki.kernel.org/userdoc/prtracker
merge bot Merged
#7 lore raw
In reply to Thomas Gleixner
The pull request you sent on Thu, 11 Jul 2019 20:02:36 -0000:

The pull request you sent on Thu, 11 Jul 2019 20:02:36 -0000:

Quoted 1 line

git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git core-urgent-for-linus

has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/02150fab6ae9924ef03e21a15f2d5f7415a9cdf7

Thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.wiki.kernel.org/userdoc/prtracker