linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/20] objtool: UACCESS validation v3
@ 2019-03-07 11:45 Peter Zijlstra
  2019-03-07 11:45 ` [PATCH 01/20] x86/ia32: Fix ia32_restore_sigcontext AC leak Peter Zijlstra
                   ` (21 more replies)
  0 siblings, 22 replies; 100+ messages in thread
From: Peter Zijlstra @ 2019-03-07 11:45 UTC (permalink / raw)
  To: torvalds, tglx, hpa, julien.thierry, will.deacon, luto, mingo,
	catalin.marinas, james.morse, valentin.schneider, brgerst,
	jpoimboe, luto, bp, dvlasenk
  Cc: linux-kernel, peterz, dvyukov, rostedt

Teach objtool to validate the UACCESS (SMAP, PAN) rules with are currently
unenforced and (therefore obviously) violated.

UACCESS sections should be small; we want to limit the amount of code that can
touch userspace. Furthermore, UACCESS state isn't scheduled, this means that
anything that directly calls into the scheduler will result in random code
running with UACCESS enabled and possibly getting back into the UACCESS region
with UACCESS disabled and causing faults.

Forbid any CALL/RET while UACCESS is enabled; but provide a few exceptions.

This builds x86_64-allmodconfig clean, and I've only got a few randconfig
failures left (GCC-8) that I'm not quite understanding.

---
 arch/x86/ia32/ia32_signal.c                |  29 ++-
 arch/x86/include/asm/asm.h                 |  24 --
 arch/x86/include/asm/nospec-branch.h       |   4 +-
 arch/x86/include/asm/smap.h                |  20 ++
 arch/x86/include/asm/uaccess.h             |   5 +-
 arch/x86/include/asm/uaccess_64.h          |   3 -
 arch/x86/include/asm/xen/hypercall.h       |  26 +-
 arch/x86/kernel/signal.c                   |   2 +-
 arch/x86/lib/copy_user_64.S                |  48 ++++
 arch/x86/lib/memcpy_64.S                   |   3 +-
 arch/x86/lib/usercopy_64.c                 |  20 --
 drivers/gpu/drm/i915/i915_gem_execbuffer.c |   6 +-
 include/linux/uaccess.h                    |   2 +
 kernel/trace/trace_branch.c                |   4 +
 lib/Makefile                               |   1 +
 lib/ubsan.c                                |   4 +
 mm/kasan/Makefile                          |   3 +
 mm/kasan/common.c                          |  10 +
 mm/kasan/report.c                          |   3 +-
 scripts/Makefile.build                     |   3 +
 tools/objtool/Makefile                     |   2 +-
 tools/objtool/arch.h                       |   8 +-
 tools/objtool/arch/x86/decode.c            |  26 +-
 tools/objtool/builtin-check.c              |   4 +-
 tools/objtool/builtin.h                    |   2 +-
 tools/objtool/check.c                      | 382 ++++++++++++++++++++++-------
 tools/objtool/check.h                      |   4 +-
 tools/objtool/elf.c                        |  15 +-
 tools/objtool/elf.h                        |   3 +-
 tools/objtool/special.c                    |  10 +-
 tools/objtool/warn.h                       |   8 +
 31 files changed, 511 insertions(+), 173 deletions(-)


 


^ permalink raw reply	[flat|nested] 100+ messages in thread

* [PATCH 01/20] x86/ia32: Fix ia32_restore_sigcontext AC leak
  2019-03-07 11:45 [PATCH 00/20] objtool: UACCESS validation v3 Peter Zijlstra
@ 2019-03-07 11:45 ` Peter Zijlstra
  2019-03-07 11:45 ` [PATCH 02/20] i915,uaccess: Fix redundant CLAC Peter Zijlstra
                   ` (20 subsequent siblings)
  21 siblings, 0 replies; 100+ messages in thread
From: Peter Zijlstra @ 2019-03-07 11:45 UTC (permalink / raw)
  To: torvalds, tglx, hpa, julien.thierry, will.deacon, luto, mingo,
	catalin.marinas, james.morse, valentin.schneider, brgerst,
	jpoimboe, luto, bp, dvlasenk
  Cc: linux-kernel, peterz, dvyukov, rostedt

Objtool spotted that we call native_load_gs_index() with AC set.
Re-arrange the code to avoid that.

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
---
diff --git a/arch/x86/ia32/ia32_signal.c b/arch/x86/ia32/ia32_signal.c
index 321fe5f5d0e9..4d5fcd47ab75 100644
--- a/arch/x86/ia32/ia32_signal.c
+++ b/arch/x86/ia32/ia32_signal.c
@@ -61,9 +61,8 @@
 } while (0)
 
 #define RELOAD_SEG(seg)		{		\
-	unsigned int pre = GET_SEG(seg);	\
+	unsigned int pre = (seg) | 3;		\
 	unsigned int cur = get_user_seg(seg);	\
-	pre |= 3;				\
 	if (pre != cur)				\
 		set_user_seg(seg, pre);		\
 }
@@ -72,6 +71,7 @@ static int ia32_restore_sigcontext(struct pt_regs *regs,
 				   struct sigcontext_32 __user *sc)
 {
 	unsigned int tmpflags, err = 0;
+	u16 gs, fs, es, ds;
 	void __user *buf;
 	u32 tmp;
 
@@ -79,16 +79,10 @@ static int ia32_restore_sigcontext(struct pt_regs *regs,
 	current->restart_block.fn = do_no_restart_syscall;
 
 	get_user_try {
-		/*
-		 * Reload fs and gs if they have changed in the signal
-		 * handler.  This does not handle long fs/gs base changes in
-		 * the handler, but does not clobber them at least in the
-		 * normal case.
-		 */
-		RELOAD_SEG(gs);
-		RELOAD_SEG(fs);
-		RELOAD_SEG(ds);
-		RELOAD_SEG(es);
+		gs = GET_SEG(gs);
+		fs = GET_SEG(fs);
+		ds = GET_SEG(ds);
+		es = GET_SEG(es);
 
 		COPY(di); COPY(si); COPY(bp); COPY(sp); COPY(bx);
 		COPY(dx); COPY(cx); COPY(ip); COPY(ax);
@@ -106,6 +100,17 @@ static int ia32_restore_sigcontext(struct pt_regs *regs,
 		buf = compat_ptr(tmp);
 	} get_user_catch(err);
 
+	/*
+	 * Reload fs and gs if they have changed in the signal
+	 * handler.  This does not handle long fs/gs base changes in
+	 * the handler, but does not clobber them at least in the
+	 * normal case.
+	 */
+	RELOAD_SEG(gs);
+	RELOAD_SEG(fs);
+	RELOAD_SEG(ds);
+	RELOAD_SEG(es);
+
 	err |= fpu__restore_sig(buf, 1);
 
 	force_iret();



^ permalink raw reply related	[flat|nested] 100+ messages in thread

* [PATCH 02/20] i915,uaccess: Fix redundant CLAC
  2019-03-07 11:45 [PATCH 00/20] objtool: UACCESS validation v3 Peter Zijlstra
  2019-03-07 11:45 ` [PATCH 01/20] x86/ia32: Fix ia32_restore_sigcontext AC leak Peter Zijlstra
@ 2019-03-07 11:45 ` Peter Zijlstra
  2019-03-07 11:45 ` [PATCH 03/20] x86/uaccess: Move copy_user_handle_tail into asm Peter Zijlstra
                   ` (19 subsequent siblings)
  21 siblings, 0 replies; 100+ messages in thread
From: Peter Zijlstra @ 2019-03-07 11:45 UTC (permalink / raw)
  To: torvalds, tglx, hpa, julien.thierry, will.deacon, luto, mingo,
	catalin.marinas, james.morse, valentin.schneider, brgerst,
	jpoimboe, luto, bp, dvlasenk
  Cc: linux-kernel, peterz, dvyukov, rostedt, Chris Wilson

drivers/gpu/drm/i915/i915_gem_execbuffer.o: warning: objtool: .altinstr_replacement+0x3c: redundant UACCESS disable
drivers/gpu/drm/i915/i915_gem_execbuffer.o: warning: objtool: .altinstr_replacement+0x66: redundant UACCESS disable

AKA. you don't need user_access_end() if user_access_begin() fails.

Cc: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
---
 drivers/gpu/drm/i915/i915_gem_execbuffer.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

--- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c
+++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
@@ -1606,6 +1606,7 @@ static int eb_copy_relocations(const str
 					     len)) {
 end_user:
 				user_access_end();
+end:
 				kvfree(relocs);
 				err = -EFAULT;
 				goto err;
@@ -1625,7 +1626,7 @@ static int eb_copy_relocations(const str
 		 * relocations were valid.
 		 */
 		if (!user_access_begin(urelocs, size))
-			goto end_user;
+			goto end;
 
 		for (copied = 0; copied < nreloc; copied++)
 			unsafe_put_user(-1,
@@ -2616,7 +2617,7 @@ i915_gem_execbuffer2_ioctl(struct drm_de
 		 * when we did the "copy_from_user()" above.
 		 */
 		if (!user_access_begin(user_exec_list, count * sizeof(*user_exec_list)))
-			goto end_user;
+			goto end;
 
 		for (i = 0; i < args->buffer_count; i++) {
 			if (!(exec2_list[i].offset & UPDATE))
@@ -2630,6 +2631,7 @@ i915_gem_execbuffer2_ioctl(struct drm_de
 		}
 end_user:
 		user_access_end();
+end:;
 	}
 
 	args->flags &= ~__I915_EXEC_UNKNOWN_FLAGS;



^ permalink raw reply	[flat|nested] 100+ messages in thread

* [PATCH 03/20] x86/uaccess: Move copy_user_handle_tail into asm
  2019-03-07 11:45 [PATCH 00/20] objtool: UACCESS validation v3 Peter Zijlstra
  2019-03-07 11:45 ` [PATCH 01/20] x86/ia32: Fix ia32_restore_sigcontext AC leak Peter Zijlstra
  2019-03-07 11:45 ` [PATCH 02/20] i915,uaccess: Fix redundant CLAC Peter Zijlstra
@ 2019-03-07 11:45 ` Peter Zijlstra
  2019-03-08 18:53   ` Josh Poimboeuf
  2019-03-07 11:45 ` [PATCH 04/20] x86/uaccess: Fix up the fixup Peter Zijlstra
                   ` (18 subsequent siblings)
  21 siblings, 1 reply; 100+ messages in thread
From: Peter Zijlstra @ 2019-03-07 11:45 UTC (permalink / raw)
  To: torvalds, tglx, hpa, julien.thierry, will.deacon, luto, mingo,
	catalin.marinas, james.morse, valentin.schneider, brgerst,
	jpoimboe, luto, bp, dvlasenk
  Cc: linux-kernel, peterz, dvyukov, rostedt

By writing the function in asm we avoid cross object code flow and
objtool no longer gets confused about a 'stray' CLAC.

Also; the asm version is actually _simpler_.

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
---
 arch/x86/include/asm/asm.h        |   24 -------------------
 arch/x86/include/asm/uaccess_64.h |    3 --
 arch/x86/lib/copy_user_64.S       |   48 ++++++++++++++++++++++++++++++++++++++
 arch/x86/lib/usercopy_64.c        |   20 ---------------
 4 files changed, 48 insertions(+), 47 deletions(-)

--- a/arch/x86/include/asm/asm.h
+++ b/arch/x86/include/asm/asm.h
@@ -148,30 +148,6 @@
 	_ASM_PTR (entry);					\
 	.popsection
 
-.macro ALIGN_DESTINATION
-	/* check for bad alignment of destination */
-	movl %edi,%ecx
-	andl $7,%ecx
-	jz 102f				/* already aligned */
-	subl $8,%ecx
-	negl %ecx
-	subl %ecx,%edx
-100:	movb (%rsi),%al
-101:	movb %al,(%rdi)
-	incq %rsi
-	incq %rdi
-	decl %ecx
-	jnz 100b
-102:
-	.section .fixup,"ax"
-103:	addl %ecx,%edx			/* ecx is zerorest also */
-	jmp copy_user_handle_tail
-	.previous
-
-	_ASM_EXTABLE_UA(100b, 103b)
-	_ASM_EXTABLE_UA(101b, 103b)
-	.endm
-
 #else
 # define _EXPAND_EXTABLE_HANDLE(x) #x
 # define _ASM_EXTABLE_HANDLE(from, to, handler)			\
--- a/arch/x86/include/asm/uaccess_64.h
+++ b/arch/x86/include/asm/uaccess_64.h
@@ -208,9 +208,6 @@ __copy_from_user_flushcache(void *dst, c
 }
 
 unsigned long
-copy_user_handle_tail(char *to, char *from, unsigned len);
-
-unsigned long
 mcsafe_handle_tail(char *to, char *from, unsigned len);
 
 #endif /* _ASM_X86_UACCESS_64_H */
--- a/arch/x86/lib/copy_user_64.S
+++ b/arch/x86/lib/copy_user_64.S
@@ -16,6 +16,30 @@
 #include <asm/smap.h>
 #include <asm/export.h>
 
+.macro ALIGN_DESTINATION
+	/* check for bad alignment of destination */
+	movl %edi,%ecx
+	andl $7,%ecx
+	jz 102f				/* already aligned */
+	subl $8,%ecx
+	negl %ecx
+	subl %ecx,%edx
+100:	movb (%rsi),%al
+101:	movb %al,(%rdi)
+	incq %rsi
+	incq %rdi
+	decl %ecx
+	jnz 100b
+102:
+	.section .fixup,"ax"
+103:	addl %ecx,%edx			/* ecx is zerorest also */
+	jmp copy_user_handle_tail
+	.previous
+
+	_ASM_EXTABLE_UA(100b, 103b)
+	_ASM_EXTABLE_UA(101b, 103b)
+	.endm
+
 /*
  * copy_user_generic_unrolled - memory copy with exception handling.
  * This version is for CPUs like P4 that don't have efficient micro
@@ -194,6 +218,30 @@ ENDPROC(copy_user_enhanced_fast_string)
 EXPORT_SYMBOL(copy_user_enhanced_fast_string)
 
 /*
+ * Try to copy last bytes and clear the rest if needed.
+ * Since protection fault in copy_from/to_user is not a normal situation,
+ * it is not necessary to optimize tail handling.
+ *
+ * Input:
+ * rdi destination
+ * rsi source
+ * rdx count
+ *
+ * Output:
+ * eax uncopied bytes or 0 if successful.
+ */
+ALIGN;
+copy_user_handle_tail:
+	movl %edx,%ecx
+1:	rep movsb
+2:	mov %ecx,%eax
+	ASM_CLAC
+	ret
+
+	_ASM_EXTABLE_UA(1b, 2b)
+ENDPROC(copy_user_handle_tail)
+
+/*
  * copy_user_nocache - Uncached memory copy with exception handling
  * This will force destination out of cache for more performance.
  *
--- a/arch/x86/lib/usercopy_64.c
+++ b/arch/x86/lib/usercopy_64.c
@@ -55,26 +55,6 @@ unsigned long clear_user(void __user *to
 EXPORT_SYMBOL(clear_user);
 
 /*
- * Try to copy last bytes and clear the rest if needed.
- * Since protection fault in copy_from/to_user is not a normal situation,
- * it is not necessary to optimize tail handling.
- */
-__visible unsigned long
-copy_user_handle_tail(char *to, char *from, unsigned len)
-{
-	for (; len; --len, to++) {
-		char c;
-
-		if (__get_user_nocheck(c, from++, sizeof(char)))
-			break;
-		if (__put_user_nocheck(c, to, sizeof(char)))
-			break;
-	}
-	clac();
-	return len;
-}
-
-/*
  * Similar to copy_user_handle_tail, probe for the write fault point,
  * but reuse __memcpy_mcsafe in case a new read error is encountered.
  * clac() is handled in _copy_to_iter_mcsafe().



^ permalink raw reply	[flat|nested] 100+ messages in thread

* [PATCH 04/20] x86/uaccess: Fix up the fixup
  2019-03-07 11:45 [PATCH 00/20] objtool: UACCESS validation v3 Peter Zijlstra
                   ` (2 preceding siblings ...)
  2019-03-07 11:45 ` [PATCH 03/20] x86/uaccess: Move copy_user_handle_tail into asm Peter Zijlstra
@ 2019-03-07 11:45 ` Peter Zijlstra
  2019-03-07 11:45 ` [PATCH 05/20] x86/uaccess/xen: Suppress SMAP warnings Peter Zijlstra
                   ` (17 subsequent siblings)
  21 siblings, 0 replies; 100+ messages in thread
From: Peter Zijlstra @ 2019-03-07 11:45 UTC (permalink / raw)
  To: torvalds, tglx, hpa, julien.thierry, will.deacon, luto, mingo,
	catalin.marinas, james.morse, valentin.schneider, brgerst,
	jpoimboe, luto, bp, dvlasenk
  Cc: linux-kernel, peterz, dvyukov, rostedt

arch/x86/lib/memcpy_64.o: warning: objtool: .fixup+0x7: return with UACCESS enabled

While the code isn't wrong; it is tedious (if at all possible) to
figure out what function a particular chunk of .fixup belongs to.

This then confuses the objtool uaccess validation. Instead of
returning directly from the .fixup, jump back into the right function.

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
---
 arch/x86/lib/memcpy_64.S |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/arch/x86/lib/memcpy_64.S
+++ b/arch/x86/lib/memcpy_64.S
@@ -257,6 +257,7 @@ ENTRY(__memcpy_mcsafe)
 	/* Copy successful. Return zero */
 .L_done_memcpy_trap:
 	xorl %eax, %eax
+.L_done:
 	ret
 ENDPROC(__memcpy_mcsafe)
 EXPORT_SYMBOL_GPL(__memcpy_mcsafe)
@@ -273,7 +274,7 @@ EXPORT_SYMBOL_GPL(__memcpy_mcsafe)
 	addl	%edx, %ecx
 .E_trailing_bytes:
 	mov	%ecx, %eax
-	ret
+	jmp	.L_done
 
 	/*
 	 * For write fault handling, given the destination is unaligned,



^ permalink raw reply	[flat|nested] 100+ messages in thread

* [PATCH 05/20] x86/uaccess/xen: Suppress SMAP warnings
  2019-03-07 11:45 [PATCH 00/20] objtool: UACCESS validation v3 Peter Zijlstra
                   ` (3 preceding siblings ...)
  2019-03-07 11:45 ` [PATCH 04/20] x86/uaccess: Fix up the fixup Peter Zijlstra
@ 2019-03-07 11:45 ` Peter Zijlstra
  2019-03-07 12:22   ` Juergen Gross
  2019-03-08 19:00   ` Josh Poimboeuf
  2019-03-07 11:45 ` [PATCH 06/20] x86/uaccess: Always inline user_access_begin() Peter Zijlstra
                   ` (16 subsequent siblings)
  21 siblings, 2 replies; 100+ messages in thread
From: Peter Zijlstra @ 2019-03-07 11:45 UTC (permalink / raw)
  To: torvalds, tglx, hpa, julien.thierry, will.deacon, luto, mingo,
	catalin.marinas, james.morse, valentin.schneider, brgerst,
	jpoimboe, luto, bp, dvlasenk
  Cc: linux-kernel, peterz, dvyukov, rostedt, andrew.cooper3

drivers/xen/privcmd.o: warning: objtool: privcmd_ioctl()+0x1414: call to hypercall_page() with UACCESS enabled

Xen needs to do HV calls with AC=1 for hysterical raisins. Make the
warning go away.

XXX: arguably we should rename ANNOTATE_NOSPEC_ALTERNATIVE to
     ANNOTATE_IGNORE_ALTERNATIVE.

Cc: andrew.cooper3@citrix.com
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
---
 arch/x86/include/asm/xen/hypercall.h |   26 ++++++++++++++++++++++----
 1 file changed, 22 insertions(+), 4 deletions(-)

--- a/arch/x86/include/asm/xen/hypercall.h
+++ b/arch/x86/include/asm/xen/hypercall.h
@@ -214,6 +214,24 @@ xen_single_call(unsigned int call,
 	return (long)__res;
 }
 
+static __always_inline void __xen_stac(void)
+{
+	/*
+	 * This is just about as horrible as this interface; we abuse the
+	 * nospec alternative annotation to supress objtool seeing the
+	 * STAC/CLAC and getting confused about it calling random code with
+	 * AC=1.
+	 */
+	asm volatile(ANNOTATE_NOSPEC_ALTERNATIVE
+		     ASM_STAC ::: "memory", "flags");
+}
+
+static __always_inline void __xen_clac(void)
+{
+	asm volatile(ANNOTATE_NOSPEC_ALTERNATIVE
+		     ASM_CLAC ::: "memory", "flags");
+}
+
 static inline long
 privcmd_call(unsigned int call,
 	     unsigned long a1, unsigned long a2,
@@ -222,9 +240,9 @@ privcmd_call(unsigned int call,
 {
 	long res;
 
-	stac();
+	__xen_stac();
 	res = xen_single_call(call, a1, a2, a3, a4, a5);
-	clac();
+	__xen_clac();
 
 	return res;
 }
@@ -430,9 +448,9 @@ HYPERVISOR_dm_op(
 	domid_t dom, unsigned int nr_bufs, struct xen_dm_op_buf *bufs)
 {
 	int ret;
-	stac();
+	__xen_stac();
 	ret = _hypercall3(int, dm_op, dom, nr_bufs, bufs);
-	clac();
+	__xen_clac();
 	return ret;
 }
 



^ permalink raw reply	[flat|nested] 100+ messages in thread

* [PATCH 06/20] x86/uaccess: Always inline user_access_begin()
  2019-03-07 11:45 [PATCH 00/20] objtool: UACCESS validation v3 Peter Zijlstra
                   ` (4 preceding siblings ...)
  2019-03-07 11:45 ` [PATCH 05/20] x86/uaccess/xen: Suppress SMAP warnings Peter Zijlstra
@ 2019-03-07 11:45 ` Peter Zijlstra
  2019-03-07 11:45 ` [PATCH 07/20] x86/uaccess: Always inline force_valid_ss() Peter Zijlstra
                   ` (15 subsequent siblings)
  21 siblings, 0 replies; 100+ messages in thread
From: Peter Zijlstra @ 2019-03-07 11:45 UTC (permalink / raw)
  To: torvalds, tglx, hpa, julien.thierry, will.deacon, luto, mingo,
	catalin.marinas, james.morse, valentin.schneider, brgerst,
	jpoimboe, luto, bp, dvlasenk
  Cc: linux-kernel, peterz, dvyukov, rostedt

If GCC out-of-lines it, the STAC and CLAC are in different fuctions
and objtool gets upset.

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
---
 arch/x86/include/asm/uaccess.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/arch/x86/include/asm/uaccess.h
+++ b/arch/x86/include/asm/uaccess.h
@@ -706,7 +706,7 @@ extern struct movsl_mask {
  * checking before using them, but you have to surround them with the
  * user_access_begin/end() pair.
  */
-static __must_check inline bool user_access_begin(const void __user *ptr, size_t len)
+static __must_check __always_inline bool user_access_begin(const void __user *ptr, size_t len)
 {
 	if (unlikely(!access_ok(ptr,len)))
 		return 0;



^ permalink raw reply	[flat|nested] 100+ messages in thread

* [PATCH 07/20] x86/uaccess: Always inline force_valid_ss()
  2019-03-07 11:45 [PATCH 00/20] objtool: UACCESS validation v3 Peter Zijlstra
                   ` (5 preceding siblings ...)
  2019-03-07 11:45 ` [PATCH 06/20] x86/uaccess: Always inline user_access_begin() Peter Zijlstra
@ 2019-03-07 11:45 ` Peter Zijlstra
  2019-03-07 13:50   ` Peter Zijlstra
  2019-03-07 18:05   ` Andy Lutomirski
  2019-03-07 11:45 ` [PATCH 08/20] x86/uaccess: Introduce user_access_{save,restore}() Peter Zijlstra
                   ` (14 subsequent siblings)
  21 siblings, 2 replies; 100+ messages in thread
From: Peter Zijlstra @ 2019-03-07 11:45 UTC (permalink / raw)
  To: torvalds, tglx, hpa, julien.thierry, will.deacon, luto, mingo,
	catalin.marinas, james.morse, valentin.schneider, brgerst,
	jpoimboe, luto, bp, dvlasenk
  Cc: linux-kernel, peterz, dvyukov, rostedt

arch/x86/kernel/signal.o: warning: objtool: restore_sigcontext()+0x3cc: call to force_valid_ss.isra.5() with UACCESS enabled

XXX: move the callsite out of te AC=1 region instead?

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
---
 arch/x86/kernel/signal.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/arch/x86/kernel/signal.c
+++ b/arch/x86/kernel/signal.c
@@ -71,7 +71,7 @@
  * alone.  Using this generally makes no sense unless
  * user_64bit_mode(regs) would return true.
  */
-static void force_valid_ss(struct pt_regs *regs)
+static __always_inline void force_valid_ss(struct pt_regs *regs)
 {
 	u32 ar;
 	asm volatile ("lar %[old_ss], %[ar]\n\t"



^ permalink raw reply	[flat|nested] 100+ messages in thread

* [PATCH 08/20] x86/uaccess: Introduce user_access_{save,restore}()
  2019-03-07 11:45 [PATCH 00/20] objtool: UACCESS validation v3 Peter Zijlstra
                   ` (6 preceding siblings ...)
  2019-03-07 11:45 ` [PATCH 07/20] x86/uaccess: Always inline force_valid_ss() Peter Zijlstra
@ 2019-03-07 11:45 ` Peter Zijlstra
  2019-03-07 11:45 ` [PATCH 09/20] x86/uaccess,kasan: Fix KASAN vs SMAP Peter Zijlstra
                   ` (13 subsequent siblings)
  21 siblings, 0 replies; 100+ messages in thread
From: Peter Zijlstra @ 2019-03-07 11:45 UTC (permalink / raw)
  To: torvalds, tglx, hpa, julien.thierry, will.deacon, luto, mingo,
	catalin.marinas, james.morse, valentin.schneider, brgerst,
	jpoimboe, luto, bp, dvlasenk
  Cc: linux-kernel, peterz, dvyukov, rostedt

Introduce common helpers for when we need to safely suspend a
uaccess section; for instance to generate a {KA,UB}SAN report.

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
---
 arch/x86/include/asm/smap.h    |   20 ++++++++++++++++++++
 arch/x86/include/asm/uaccess.h |    3 +++
 include/linux/uaccess.h        |    2 ++
 3 files changed, 25 insertions(+)

--- a/arch/x86/include/asm/smap.h
+++ b/arch/x86/include/asm/smap.h
@@ -58,6 +58,23 @@ static __always_inline void stac(void)
 	alternative("", __stringify(__ASM_STAC), X86_FEATURE_SMAP);
 }
 
+static __always_inline unsigned long smap_save(void)
+{
+	unsigned long flags;
+
+	asm volatile (ALTERNATIVE("", "pushf; pop %0; " __stringify(__ASM_CLAC),
+				  X86_FEATURE_SMAP)
+		      : "=rm" (flags) : : "memory", "cc");
+
+	return flags;
+}
+
+static __always_inline void smap_restore(unsigned long flags)
+{
+	asm volatile (ALTERNATIVE("", "push %0; popf", X86_FEATURE_SMAP)
+		      : : "g" (flags) : "memory", "cc");
+}
+
 /* These macros can be used in asm() statements */
 #define ASM_CLAC \
 	ALTERNATIVE("", __stringify(__ASM_CLAC), X86_FEATURE_SMAP)
@@ -69,6 +86,9 @@ static __always_inline void stac(void)
 static inline void clac(void) { }
 static inline void stac(void) { }
 
+static inline unsigned long smap_save(void) { return 0; }
+static inline void smap_restore(unsigned long flags) { }
+
 #define ASM_CLAC
 #define ASM_STAC
 
--- a/arch/x86/include/asm/uaccess.h
+++ b/arch/x86/include/asm/uaccess.h
@@ -716,6 +716,9 @@ static __must_check __always_inline bool
 #define user_access_begin(a,b)	user_access_begin(a,b)
 #define user_access_end()	__uaccess_end()
 
+#define user_access_save()	smap_save()
+#define user_access_restore(x)	smap_restore(x)
+
 #define unsafe_put_user(x, ptr, label)	\
 	__put_user_size((__typeof__(*(ptr)))(x), (ptr), sizeof(*(ptr)), label)
 
--- a/include/linux/uaccess.h
+++ b/include/linux/uaccess.h
@@ -268,6 +268,8 @@ extern long strncpy_from_unsafe(char *ds
 #define user_access_end() do { } while (0)
 #define unsafe_get_user(x, ptr, err) do { if (unlikely(__get_user(x, ptr))) goto err; } while (0)
 #define unsafe_put_user(x, ptr, err) do { if (unlikely(__put_user(x, ptr))) goto err; } while (0)
+static inline unsigned long user_access_save(void) { return 0UL; }
+static void user_access_restore(unsigned long flags) { }
 #endif
 
 #ifdef CONFIG_HARDENED_USERCOPY



^ permalink raw reply	[flat|nested] 100+ messages in thread

* [PATCH 09/20] x86/uaccess,kasan: Fix KASAN vs SMAP
  2019-03-07 11:45 [PATCH 00/20] objtool: UACCESS validation v3 Peter Zijlstra
                   ` (7 preceding siblings ...)
  2019-03-07 11:45 ` [PATCH 08/20] x86/uaccess: Introduce user_access_{save,restore}() Peter Zijlstra
@ 2019-03-07 11:45 ` Peter Zijlstra
  2019-03-07 11:45 ` [PATCH 10/20] x86/uaccess,ubsan: Fix UBSAN " Peter Zijlstra
                   ` (12 subsequent siblings)
  21 siblings, 0 replies; 100+ messages in thread
From: Peter Zijlstra @ 2019-03-07 11:45 UTC (permalink / raw)
  To: torvalds, tglx, hpa, julien.thierry, will.deacon, luto, mingo,
	catalin.marinas, james.morse, valentin.schneider, brgerst,
	jpoimboe, luto, bp, dvlasenk
  Cc: linux-kernel, peterz, dvyukov, rostedt

KASAN inserts extra code for every LOAD/STORE emitted by te compiler.
Much of this code is simple and safe to run with AC=1, however the
kasan_report() function, called on error, is most certainly not safe
to call with AC=1.

Therefore wrap kasan_report() in user_access_{save,restore}; which for
x86 SMAP, saves/restores EFLAGS and clears AC before calling the real
function.

Also ensure all the functions are without __fentry__ hook. The
function tracer is also not safe.

Cc: Dmitry Vyukov <dvyukov@google.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
---
 mm/kasan/Makefile |    3 +++
 mm/kasan/common.c |   10 ++++++++++
 mm/kasan/report.c |    3 +--
 3 files changed, 14 insertions(+), 2 deletions(-)

--- a/mm/kasan/Makefile
+++ b/mm/kasan/Makefile
@@ -2,11 +2,13 @@
 KASAN_SANITIZE := n
 UBSAN_SANITIZE_common.o := n
 UBSAN_SANITIZE_generic.o := n
+UBSAN_SANITIZE_generic_report.o := n
 UBSAN_SANITIZE_tags.o := n
 KCOV_INSTRUMENT := n
 
 CFLAGS_REMOVE_common.o = -pg
 CFLAGS_REMOVE_generic.o = -pg
+CFLAGS_REMOVE_generic_report.o = -pg
 CFLAGS_REMOVE_tags.o = -pg
 
 # Function splitter causes unnecessary splits in __asan_load1/__asan_store1
@@ -14,6 +16,7 @@ CFLAGS_REMOVE_tags.o = -pg
 
 CFLAGS_common.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector)
 CFLAGS_generic.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector)
+CFLAGS_generic_report.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector)
 CFLAGS_tags.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector)
 
 obj-$(CONFIG_KASAN) := common.o init.o report.o
--- a/mm/kasan/common.c
+++ b/mm/kasan/common.c
@@ -34,6 +34,7 @@
 #include <linux/types.h>
 #include <linux/vmalloc.h>
 #include <linux/bug.h>
+#include <linux/uaccess.h>
 
 #include "kasan.h"
 #include "../slab.h"
@@ -612,6 +613,15 @@ void kasan_free_shadow(const struct vm_s
 		vfree(kasan_mem_to_shadow(vm->addr));
 }
 
+extern void __kasan_report(unsigned long addr, size_t size, bool is_write, unsigned long ip);
+
+void kasan_report(unsigned long addr, size_t size, bool is_write, unsigned long ip)
+{
+	unsigned long flags = user_access_save();
+	__kasan_report(addr, size, is_write, ip);
+	user_access_restore(flags);
+}
+
 #ifdef CONFIG_MEMORY_HOTPLUG
 static bool shadow_mapped(unsigned long addr)
 {
--- a/mm/kasan/report.c
+++ b/mm/kasan/report.c
@@ -281,8 +281,7 @@ void kasan_report_invalid_free(void *obj
 	end_report(&flags);
 }
 
-void kasan_report(unsigned long addr, size_t size,
-		bool is_write, unsigned long ip)
+void __kasan_report(unsigned long addr, size_t size, bool is_write, unsigned long ip)
 {
 	struct kasan_access_info info;
 	void *tagged_addr;



^ permalink raw reply	[flat|nested] 100+ messages in thread

* [PATCH 10/20] x86/uaccess,ubsan: Fix UBSAN vs SMAP
  2019-03-07 11:45 [PATCH 00/20] objtool: UACCESS validation v3 Peter Zijlstra
                   ` (8 preceding siblings ...)
  2019-03-07 11:45 ` [PATCH 09/20] x86/uaccess,kasan: Fix KASAN vs SMAP Peter Zijlstra
@ 2019-03-07 11:45 ` Peter Zijlstra
  2019-03-07 11:45 ` [PATCH 11/20] x86/uaccess,ftrace: Fix ftrace_likely_update() " Peter Zijlstra
                   ` (11 subsequent siblings)
  21 siblings, 0 replies; 100+ messages in thread
From: Peter Zijlstra @ 2019-03-07 11:45 UTC (permalink / raw)
  To: torvalds, tglx, hpa, julien.thierry, will.deacon, luto, mingo,
	catalin.marinas, james.morse, valentin.schneider, brgerst,
	jpoimboe, luto, bp, dvlasenk
  Cc: linux-kernel, peterz, dvyukov, rostedt

UBSAN can insert extra code in random locations; including AC=1
sections. Typically this code is not safe and needs wrapping.

So far, only __ubsan_handle_type_mismatch* have been observed in AC=1
sections and therefore only those are annotated.

Cc: Dmitry Vyukov <dvyukov@google.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
---
 lib/Makefile |    1 +
 lib/ubsan.c  |    4 ++++
 2 files changed, 5 insertions(+)

--- a/lib/Makefile
+++ b/lib/Makefile
@@ -263,6 +263,7 @@ obj-$(CONFIG_UCS2_STRING) += ucs2_string
 obj-$(CONFIG_UBSAN) += ubsan.o
 
 UBSAN_SANITIZE_ubsan.o := n
+CFLAGS_ubsan.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector)
 
 obj-$(CONFIG_SBITMAP) += sbitmap.o
 
--- a/lib/ubsan.c
+++ b/lib/ubsan.c
@@ -17,6 +17,7 @@
 #include <linux/kernel.h>
 #include <linux/types.h>
 #include <linux/sched.h>
+#include <linux/uaccess.h>
 
 #include "ubsan.h"
 
@@ -313,6 +314,7 @@ static void handle_object_size_mismatch(
 static void ubsan_type_mismatch_common(struct type_mismatch_data_common *data,
 				unsigned long ptr)
 {
+	unsigned long flags = user_access_save();
 
 	if (!ptr)
 		handle_null_ptr_deref(data);
@@ -320,6 +322,8 @@ static void ubsan_type_mismatch_common(s
 		handle_misaligned_access(data, ptr);
 	else
 		handle_object_size_mismatch(data, ptr);
+
+	user_access_restore(flags);
 }
 
 void __ubsan_handle_type_mismatch(struct type_mismatch_data *data,



^ permalink raw reply	[flat|nested] 100+ messages in thread

* [PATCH 11/20] x86/uaccess,ftrace: Fix ftrace_likely_update() vs SMAP
  2019-03-07 11:45 [PATCH 00/20] objtool: UACCESS validation v3 Peter Zijlstra
                   ` (9 preceding siblings ...)
  2019-03-07 11:45 ` [PATCH 10/20] x86/uaccess,ubsan: Fix UBSAN " Peter Zijlstra
@ 2019-03-07 11:45 ` Peter Zijlstra
  2019-03-07 11:45 ` [PATCH 12/20] objtool: Set insn->func for alternatives Peter Zijlstra
                   ` (10 subsequent siblings)
  21 siblings, 0 replies; 100+ messages in thread
From: Peter Zijlstra @ 2019-03-07 11:45 UTC (permalink / raw)
  To: torvalds, tglx, hpa, julien.thierry, will.deacon, luto, mingo,
	catalin.marinas, james.morse, valentin.schneider, brgerst,
	jpoimboe, luto, bp, dvlasenk
  Cc: linux-kernel, peterz, dvyukov, rostedt

For CONFIG_TRACE_BRANCH_PROFILING the likely/unlikely things get
overloaded and generate callouts to this code, and thus also when
AC=1.

Make it safe.

Cc: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
---
 kernel/trace/trace_branch.c |    4 ++++
 1 file changed, 4 insertions(+)

--- a/kernel/trace/trace_branch.c
+++ b/kernel/trace/trace_branch.c
@@ -205,6 +205,8 @@ void trace_likely_condition(struct ftrac
 void ftrace_likely_update(struct ftrace_likely_data *f, int val,
 			  int expect, int is_constant)
 {
+	unsigned long flags = user_access_save();
+
 	/* A constant is always correct */
 	if (is_constant) {
 		f->constant++;
@@ -223,6 +225,8 @@ void ftrace_likely_update(struct ftrace_
 		f->data.correct++;
 	else
 		f->data.incorrect++;
+
+	user_access_restore(flags);
 }
 EXPORT_SYMBOL(ftrace_likely_update);
 



^ permalink raw reply	[flat|nested] 100+ messages in thread

* [PATCH 12/20] objtool: Set insn->func for alternatives
  2019-03-07 11:45 [PATCH 00/20] objtool: UACCESS validation v3 Peter Zijlstra
                   ` (10 preceding siblings ...)
  2019-03-07 11:45 ` [PATCH 11/20] x86/uaccess,ftrace: Fix ftrace_likely_update() " Peter Zijlstra
@ 2019-03-07 11:45 ` Peter Zijlstra
  2019-03-08 19:16   ` Josh Poimboeuf
  2019-03-07 11:45 ` [PATCH 13/20] objtool: Hande function aliases Peter Zijlstra
                   ` (9 subsequent siblings)
  21 siblings, 1 reply; 100+ messages in thread
From: Peter Zijlstra @ 2019-03-07 11:45 UTC (permalink / raw)
  To: torvalds, tglx, hpa, julien.thierry, will.deacon, luto, mingo,
	catalin.marinas, james.morse, valentin.schneider, brgerst,
	jpoimboe, luto, bp, dvlasenk
  Cc: linux-kernel, peterz, dvyukov, rostedt

Make sure we set the function association for alternative instruction
sequences; they are after all still part of the function.

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
---
 tools/objtool/check.c |    1 +
 1 file changed, 1 insertion(+)

--- a/tools/objtool/check.c
+++ b/tools/objtool/check.c
@@ -695,6 +695,7 @@ static int handle_group_alt(struct objto
 		last_new_insn = insn;
 
 		insn->ignore = orig_insn->ignore_alts;
+		insn->func = orig_insn->func;
 
 		if (insn->type != INSN_JUMP_CONDITIONAL &&
 		    insn->type != INSN_JUMP_UNCONDITIONAL)



^ permalink raw reply	[flat|nested] 100+ messages in thread

* [PATCH 13/20] objtool: Hande function aliases
  2019-03-07 11:45 [PATCH 00/20] objtool: UACCESS validation v3 Peter Zijlstra
                   ` (11 preceding siblings ...)
  2019-03-07 11:45 ` [PATCH 12/20] objtool: Set insn->func for alternatives Peter Zijlstra
@ 2019-03-07 11:45 ` Peter Zijlstra
  2019-03-08 19:23   ` Josh Poimboeuf
  2019-03-07 11:45 ` [PATCH 14/20] objtool: Rewrite add_ignores() Peter Zijlstra
                   ` (8 subsequent siblings)
  21 siblings, 1 reply; 100+ messages in thread
From: Peter Zijlstra @ 2019-03-07 11:45 UTC (permalink / raw)
  To: torvalds, tglx, hpa, julien.thierry, will.deacon, luto, mingo,
	catalin.marinas, james.morse, valentin.schneider, brgerst,
	jpoimboe, luto, bp, dvlasenk
  Cc: linux-kernel, peterz, dvyukov, rostedt

Function aliases result in different symbols for the same set of
instructions; track a canonical symbol so there is a unique point of
access.

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
---
 tools/objtool/elf.c |   15 +++++++++++----
 tools/objtool/elf.h |    2 +-
 2 files changed, 12 insertions(+), 5 deletions(-)

--- a/tools/objtool/elf.c
+++ b/tools/objtool/elf.c
@@ -219,7 +219,7 @@ static int read_sections(struct elf *elf
 static int read_symbols(struct elf *elf)
 {
 	struct section *symtab, *sec;
-	struct symbol *sym, *pfunc;
+	struct symbol *sym, *pfunc, *alias;
 	struct list_head *entry, *tmp;
 	int symbols_nr, i;
 	char *coldstr;
@@ -239,6 +239,7 @@ static int read_symbols(struct elf *elf)
 			return -1;
 		}
 		memset(sym, 0, sizeof(*sym));
+		alias = sym;
 
 		sym->idx = i;
 
@@ -288,11 +289,17 @@ static int read_symbols(struct elf *elf)
 				break;
 			}
 
-			if (sym->offset == s->offset && sym->len >= s->len) {
-				entry = tmp;
-				break;
+			if (sym->offset == s->offset) {
+				if (sym->len == s->len && alias == sym)
+					alias = s;
+
+				if (sym->len >= s->len) {
+					entry = tmp;
+					break;
+				}
 			}
 		}
+		sym->alias = alias;
 		list_add(&sym->list, entry);
 		hash_add(sym->sec->symbol_hash, &sym->hash, sym->idx);
 	}
--- a/tools/objtool/elf.h
+++ b/tools/objtool/elf.h
@@ -61,7 +61,7 @@ struct symbol {
 	unsigned char bind, type;
 	unsigned long offset;
 	unsigned int len;
-	struct symbol *pfunc, *cfunc;
+	struct symbol *pfunc, *cfunc, *alias;
 };
 
 struct rela {



^ permalink raw reply	[flat|nested] 100+ messages in thread

* [PATCH 14/20] objtool: Rewrite add_ignores()
  2019-03-07 11:45 [PATCH 00/20] objtool: UACCESS validation v3 Peter Zijlstra
                   ` (12 preceding siblings ...)
  2019-03-07 11:45 ` [PATCH 13/20] objtool: Hande function aliases Peter Zijlstra
@ 2019-03-07 11:45 ` Peter Zijlstra
  2019-03-08 19:29   ` Josh Poimboeuf
  2019-03-07 11:45 ` [PATCH 15/20] objtool: Add --backtrace support Peter Zijlstra
                   ` (7 subsequent siblings)
  21 siblings, 1 reply; 100+ messages in thread
From: Peter Zijlstra @ 2019-03-07 11:45 UTC (permalink / raw)
  To: torvalds, tglx, hpa, julien.thierry, will.deacon, luto, mingo,
	catalin.marinas, james.morse, valentin.schneider, brgerst,
	jpoimboe, luto, bp, dvlasenk
  Cc: linux-kernel, peterz, dvyukov, rostedt

The whole add_ignores() thing was wildly weird; rewrite it according
to 'modern' ways.

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
---
 tools/objtool/check.c |   51 +++++++++++++++++++-------------------------------
 tools/objtool/check.h |    1 
 2 files changed, 20 insertions(+), 32 deletions(-)

--- a/tools/objtool/check.c
+++ b/tools/objtool/check.c
@@ -105,29 +105,6 @@ static struct instruction *next_insn_sam
 	     insn = next_insn_same_sec(file, insn))
 
 /*
- * Check if the function has been manually whitelisted with the
- * STACK_FRAME_NON_STANDARD macro, or if it should be automatically whitelisted
- * due to its use of a context switching instruction.
- */
-static bool ignore_func(struct objtool_file *file, struct symbol *func)
-{
-	struct rela *rela;
-
-	/* check for STACK_FRAME_NON_STANDARD */
-	if (file->whitelist && file->whitelist->rela)
-		list_for_each_entry(rela, &file->whitelist->rela->rela_list, list) {
-			if (rela->sym->type == STT_SECTION &&
-			    rela->sym->sec == func->sec &&
-			    rela->addend == func->offset)
-				return true;
-			if (rela->sym->type == STT_FUNC && rela->sym == func)
-				return true;
-		}
-
-	return false;
-}
-
-/*
  * This checks to see if the given function is a "noreturn" function.
  *
  * For global functions which are outside the scope of this object file, we
@@ -436,18 +413,31 @@ static void add_ignores(struct objtool_f
 	struct instruction *insn;
 	struct section *sec;
 	struct symbol *func;
+	struct rela *rela;
 
-	for_each_sec(file, sec) {
-		list_for_each_entry(func, &sec->symbol_list, list) {
-			if (func->type != STT_FUNC)
-				continue;
+	sec = find_section_by_name(file->elf, ".rela.discard.func_stack_frame_non_standard");
+	if (!sec)
+		return;
 
-			if (!ignore_func(file, func))
+	list_for_each_entry(rela, &sec->rela_list, list) {
+		switch (rela->sym->type) {
+		case STT_FUNC:
+			func = rela->sym;
+			break;
+
+		case STT_SECTION:
+			func = find_symbol_by_offset(rela->sym->sec, rela->addend);
+			if (!func || func->type != STT_FUNC)
 				continue;
+			break;
 
-			func_for_each_insn_all(file, func, insn)
-				insn->ignore = true;
+		default:
+			WARN("unexpected relation symbol type in %s: %d", sec->name, rela->sym->type);
+			continue;
 		}
+
+		func_for_each_insn_all(file, func, insn)
+			insn->ignore = true;
 	}
 }
 
@@ -2198,7 +2188,6 @@ int check(const char *_objname, bool orc
 
 	INIT_LIST_HEAD(&file.insn_list);
 	hash_init(file.insn_hash);
-	file.whitelist = find_section_by_name(file.elf, ".discard.func_stack_frame_non_standard");
 	file.c_file = find_section_by_name(file.elf, ".comment");
 	file.ignore_unreachables = no_unreachable;
 	file.hints = false;
--- a/tools/objtool/check.h
+++ b/tools/objtool/check.h
@@ -60,7 +60,6 @@ struct objtool_file {
 	struct elf *elf;
 	struct list_head insn_list;
 	DECLARE_HASHTABLE(insn_hash, 16);
-	struct section *whitelist;
 	bool ignore_unreachables, c_file, hints, rodata;
 };
 



^ permalink raw reply	[flat|nested] 100+ messages in thread

* [PATCH 15/20] objtool: Add --backtrace support
  2019-03-07 11:45 [PATCH 00/20] objtool: UACCESS validation v3 Peter Zijlstra
                   ` (13 preceding siblings ...)
  2019-03-07 11:45 ` [PATCH 14/20] objtool: Rewrite add_ignores() Peter Zijlstra
@ 2019-03-07 11:45 ` Peter Zijlstra
  2019-03-08 19:33   ` Josh Poimboeuf
  2019-03-07 11:45 ` [PATCH 16/20] objtool: Rewrite alt->skip_orig Peter Zijlstra
                   ` (6 subsequent siblings)
  21 siblings, 1 reply; 100+ messages in thread
From: Peter Zijlstra @ 2019-03-07 11:45 UTC (permalink / raw)
  To: torvalds, tglx, hpa, julien.thierry, will.deacon, luto, mingo,
	catalin.marinas, james.morse, valentin.schneider, brgerst,
	jpoimboe, luto, bp, dvlasenk
  Cc: linux-kernel, peterz, dvyukov, rostedt

For when you want to know the path that reached your fail state.

$ ./objtool check --no-fp --backtrace arch/x86/lib/usercopy_64.o
arch/x86/lib/usercopy_64.o: warning: objtool: .altinstr_replacement+0x3: UACCESS disable without MEMOPs: __clear_user()
arch/x86/lib/usercopy_64.o: warning: objtool:   __clear_user()+0x3a: (alt)
arch/x86/lib/usercopy_64.o: warning: objtool:   __clear_user()+0x2e: (branch)
arch/x86/lib/usercopy_64.o: warning: objtool:   __clear_user()+0x18: (branch)
arch/x86/lib/usercopy_64.o: warning: objtool:   .altinstr_replacement+0xffffffffffffffff: (branch)
arch/x86/lib/usercopy_64.o: warning: objtool:   __clear_user()+0x5: (alt)
arch/x86/lib/usercopy_64.o: warning: objtool:   __clear_user()+0x0: <=== (func)

0000000000000000 <__clear_user>:
  0:   e8 00 00 00 00          callq  5 <__clear_user+0x5>
               1: R_X86_64_PLT32       __fentry__-0x4
  5:   90                      nop
  6:   90                      nop
  7:   90                      nop
  8:   48 89 f0                mov    %rsi,%rax
  b:   48 c1 ee 03             shr    $0x3,%rsi
  f:   83 e0 07                and    $0x7,%eax
 12:   48 89 f1                mov    %rsi,%rcx
 15:   48 85 c9                test   %rcx,%rcx
 18:   74 0f                   je     29 <__clear_user+0x29>
 1a:   48 c7 07 00 00 00 00    movq   $0x0,(%rdi)
 21:   48 83 c7 08             add    $0x8,%rdi
 25:   ff c9                   dec    %ecx
 27:   75 f1                   jne    1a <__clear_user+0x1a>
 29:   48 89 c1                mov    %rax,%rcx
 2c:   85 c9                   test   %ecx,%ecx
 2e:   74 0a                   je     3a <__clear_user+0x3a>
 30:   c6 07 00                movb   $0x0,(%rdi)
 33:   48 ff c7                inc    %rdi
 36:   ff c9                   dec    %ecx
 38:   75 f6                   jne    30 <__clear_user+0x30>
 3a:   90                      nop
 3b:   90                      nop
 3c:   90                      nop
 3d:   48 89 c8                mov    %rcx,%rax
 40:   c3                      retq


Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
---
 tools/objtool/builtin-check.c |    3 ++-
 tools/objtool/builtin.h       |    2 +-
 tools/objtool/check.c         |   18 ++++++++++++++----
 tools/objtool/warn.h          |    8 ++++++++
 4 files changed, 25 insertions(+), 6 deletions(-)

--- a/tools/objtool/builtin-check.c
+++ b/tools/objtool/builtin-check.c
@@ -29,7 +29,7 @@
 #include "builtin.h"
 #include "check.h"
 
-bool no_fp, no_unreachable, retpoline, module;
+bool no_fp, no_unreachable, retpoline, module, backtrace;
 
 static const char * const check_usage[] = {
 	"objtool check [<options>] file.o",
@@ -41,6 +41,7 @@ const struct option check_options[] = {
 	OPT_BOOLEAN('u', "no-unreachable", &no_unreachable, "Skip 'unreachable instruction' warnings"),
 	OPT_BOOLEAN('r', "retpoline", &retpoline, "Validate retpoline assumptions"),
 	OPT_BOOLEAN('m', "module", &module, "Indicates the object will be part of a kernel module"),
+	OPT_BOOLEAN('b', "backtrace", &backtrace, "unwind on error"),
 	OPT_END(),
 };
 
--- a/tools/objtool/builtin.h
+++ b/tools/objtool/builtin.h
@@ -20,7 +20,7 @@
 #include <subcmd/parse-options.h>
 
 extern const struct option check_options[];
-extern bool no_fp, no_unreachable, retpoline, module;
+extern bool no_fp, no_unreachable, retpoline, module, backtrace;
 
 extern int cmd_check(int argc, const char **argv);
 extern int cmd_orc(int argc, const char **argv);
--- a/tools/objtool/check.c
+++ b/tools/objtool/check.c
@@ -1885,8 +1885,11 @@ static int validate_branch(struct objtoo
 		if (!insn->ignore_alts) {
 			list_for_each_entry(alt, &insn->alts, list) {
 				ret = validate_branch(file, alt->insn, state);
-				if (ret)
-					return 1;
+				if (ret) {
+					if (backtrace)
+						BT_FUNC("(alt)", insn);
+					return ret;
+				}
 			}
 		}
 
@@ -1933,8 +1936,11 @@ static int validate_branch(struct objtoo
 			     insn->jump_dest->func->pfunc == func)) {
 				ret = validate_branch(file, insn->jump_dest,
 						      state);
-				if (ret)
-					return 1;
+				if (ret) {
+					if (backtrace)
+						BT_FUNC("(branch)", insn);
+					return ret;
+				}
 
 			} else if (func && has_modified_stack_frame(&state)) {
 				WARN_FUNC("sibling call from callable instruction with modified stack frame",
@@ -2005,6 +2011,8 @@ static int validate_unwind_hints(struct
 	for_each_insn(file, insn) {
 		if (insn->hint && !insn->visited) {
 			ret = validate_branch(file, insn, state);
+			if (ret && backtrace)
+				BT_FUNC("<=== (hint)", insn);
 			warnings += ret;
 		}
 	}
@@ -2133,6 +2141,8 @@ static int validate_functions(struct obj
 				continue;
 
 			ret = validate_branch(file, insn, state);
+			if (ret && backtrace)
+				BT_FUNC("<=== (func)", insn);
 			warnings += ret;
 		}
 	}
--- a/tools/objtool/warn.h
+++ b/tools/objtool/warn.h
@@ -64,6 +64,14 @@ static inline char *offstr(struct sectio
 	free(_str);					\
 })
 
+#define BT_FUNC(format, insn, ...)			\
+({							\
+	struct instruction *_insn = (insn);		\
+	char *_str = offstr(_insn->sec, _insn->offset); \
+	WARN("  %s: " format, _str, ##__VA_ARGS__);	\
+	free(_str);					\
+})
+
 #define WARN_ELF(format, ...)				\
 	WARN(format ": %s", ##__VA_ARGS__, elf_errmsg(-1))
 



^ permalink raw reply	[flat|nested] 100+ messages in thread

* [PATCH 16/20] objtool: Rewrite alt->skip_orig
  2019-03-07 11:45 [PATCH 00/20] objtool: UACCESS validation v3 Peter Zijlstra
                   ` (14 preceding siblings ...)
  2019-03-07 11:45 ` [PATCH 15/20] objtool: Add --backtrace support Peter Zijlstra
@ 2019-03-07 11:45 ` Peter Zijlstra
  2019-03-08 20:15   ` Josh Poimboeuf
  2019-03-07 11:45 ` [PATCH 17/20] objtool: Fix sibling call detection Peter Zijlstra
                   ` (5 subsequent siblings)
  21 siblings, 1 reply; 100+ messages in thread
From: Peter Zijlstra @ 2019-03-07 11:45 UTC (permalink / raw)
  To: torvalds, tglx, hpa, julien.thierry, will.deacon, luto, mingo,
	catalin.marinas, james.morse, valentin.schneider, brgerst,
	jpoimboe, luto, bp, dvlasenk
  Cc: linux-kernel, peterz, dvyukov, rostedt

Really skip the original instruction flow, instead of letting it
continue with NOPs.

Since the alternative code flow already continues after the original
instructions, only the alt-original is skipped.

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
---
 tools/objtool/check.c |   16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

--- a/tools/objtool/check.c
+++ b/tools/objtool/check.c
@@ -31,6 +31,7 @@
 struct alternative {
 	struct list_head list;
 	struct instruction *insn;
+	bool skip_orig;
 };
 
 const char *objname;
@@ -623,9 +624,6 @@ static int add_call_destinations(struct
  *    conditionally jumps to the _end_ of the entry.  We have to modify these
  *    jumps' destinations to point back to .text rather than the end of the
  *    entry in .altinstr_replacement.
- *
- * 4. It has been requested that we don't validate the !POPCNT feature path
- *    which is a "very very small percentage of machines".
  */
 static int handle_group_alt(struct objtool_file *file,
 			    struct special_alt *special_alt,
@@ -641,9 +639,6 @@ static int handle_group_alt(struct objto
 		if (insn->offset >= special_alt->orig_off + special_alt->orig_len)
 			break;
 
-		if (special_alt->skip_orig)
-			insn->type = INSN_NOP;
-
 		insn->alt_group = true;
 		last_orig_insn = insn;
 	}
@@ -808,6 +803,7 @@ static int add_special_section_alts(stru
 		}
 
 		alt->insn = new_insn;
+		alt->skip_orig = special_alt->skip_orig;
 		list_add_tail(&alt->list, &orig_insn->alts);
 
 		list_del(&special_alt->list);
@@ -1883,7 +1879,12 @@ static int validate_branch(struct objtoo
 		insn->visited = true;
 
 		if (!insn->ignore_alts) {
+			bool skip_orig = false;
+
 			list_for_each_entry(alt, &insn->alts, list) {
+				if (alt->skip_orig)
+					skip_orig = true;
+
 				ret = validate_branch(file, alt->insn, state);
 				if (ret) {
 					if (backtrace)
@@ -1891,6 +1892,9 @@ static int validate_branch(struct objtoo
 					return ret;
 				}
 			}
+
+			if (skip_orig)
+				return 0;
 		}
 
 		switch (insn->type) {



^ permalink raw reply	[flat|nested] 100+ messages in thread

* [PATCH 17/20] objtool: Fix sibling call detection
  2019-03-07 11:45 [PATCH 00/20] objtool: UACCESS validation v3 Peter Zijlstra
                   ` (15 preceding siblings ...)
  2019-03-07 11:45 ` [PATCH 16/20] objtool: Rewrite alt->skip_orig Peter Zijlstra
@ 2019-03-07 11:45 ` Peter Zijlstra
  2019-03-08 20:22   ` Josh Poimboeuf
  2019-03-07 11:45 ` [PATCH 18/20] objtool: Add UACCESS validation Peter Zijlstra
                   ` (4 subsequent siblings)
  21 siblings, 1 reply; 100+ messages in thread
From: Peter Zijlstra @ 2019-03-07 11:45 UTC (permalink / raw)
  To: torvalds, tglx, hpa, julien.thierry, will.deacon, luto, mingo,
	catalin.marinas, james.morse, valentin.schneider, brgerst,
	jpoimboe, luto, bp, dvlasenk
  Cc: linux-kernel, peterz, dvyukov, rostedt

It turned out that we failed to detect some sibling calls;
specifically those without relocation records; like:

$ ./objdump-func.sh defconfig-build/mm/kasan/generic.o __asan_loadN
0000 0000000000000840 <__asan_loadN>:
0000  840:      48 8b 0c 24             mov    (%rsp),%rcx
0004  844:      31 d2                   xor    %edx,%edx
0006  846:      e9 45 fe ff ff          jmpq   690 <check_memory_region>

So extend the cross-function jump to also consider those that are not
between known (or newly detected) parent/child functions, as
sibling-cals when they jump to the start of the function.

The second part of that condition is to deal with random jumps to the
middle of other function, as can be found in
arch/x86/lib/copy_user_64.S for example.

This then (with later patches applied) makes the above recognise the
sibling call:

mm/kasan/generic.o: warning: objtool: __asan_loadN()+0x6: call to check_memory_region() with UACCESS enabled

Also make sure to set insn->call_dest for sibling calls so we can know
who we're calling.

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
---
 tools/objtool/check.c |   79 +++++++++++++++++++++++++++++---------------------
 1 file changed, 46 insertions(+), 33 deletions(-)

--- a/tools/objtool/check.c
+++ b/tools/objtool/check.c
@@ -515,7 +515,8 @@ static int add_jump_destinations(struct
 			continue;
 		} else {
 			/* sibling call */
-			insn->jump_dest = 0;
+			insn->call_dest = rela->sym;
+			insn->jump_dest = NULL;
 			continue;
 		}
 
@@ -537,25 +538,38 @@ static int add_jump_destinations(struct
 		}
 
 		/*
-		 * For GCC 8+, create parent/child links for any cold
-		 * subfunctions.  This is _mostly_ redundant with a similar
-		 * initialization in read_symbols().
-		 *
-		 * If a function has aliases, we want the *first* such function
-		 * in the symbol table to be the subfunction's parent.  In that
-		 * case we overwrite the initialization done in read_symbols().
-		 *
-		 * However this code can't completely replace the
-		 * read_symbols() code because this doesn't detect the case
-		 * where the parent function's only reference to a subfunction
-		 * is through a switch table.
+		 * Cross-function jump.
 		 */
 		if (insn->func && insn->jump_dest->func &&
-		    insn->func != insn->jump_dest->func &&
-		    !strstr(insn->func->name, ".cold.") &&
-		    strstr(insn->jump_dest->func->name, ".cold.")) {
-			insn->func->cfunc = insn->jump_dest->func;
-			insn->jump_dest->func->pfunc = insn->func;
+		    insn->func != insn->jump_dest->func) {
+
+			/*
+			 * For GCC 8+, create parent/child links for any cold
+			 * subfunctions.  This is _mostly_ redundant with a
+			 * similar initialization in read_symbols().
+			 *
+			 * If a function has aliases, we want the *first* such
+			 * function in the symbol table to be the subfunction's
+			 * parent.  In that case we overwrite the
+			 * initialization done in read_symbols().
+			 *
+			 * However this code can't completely replace the
+			 * read_symbols() code because this doesn't detect the
+			 * case where the parent function's only reference to a
+			 * subfunction is through a switch table.
+			 */
+			if (!strstr(insn->func->name, ".cold.") &&
+			    strstr(insn->jump_dest->func->name, ".cold.")) {
+				insn->func->cfunc = insn->jump_dest->func;
+				insn->jump_dest->func->pfunc = insn->func;
+
+			} else if (insn->jump_dest->func->pfunc != insn->func->pfunc &&
+				   insn->jump_dest->offset == insn->jump_dest->func->offset) {
+
+				/* sibling class */
+				insn->call_dest = insn->jump_dest->func;
+				insn->jump_dest = NULL;
+			}
 		}
 	}
 
@@ -1935,9 +1949,16 @@ static int validate_branch(struct objtoo
 
 		case INSN_JUMP_CONDITIONAL:
 		case INSN_JUMP_UNCONDITIONAL:
-			if (insn->jump_dest &&
-			    (!func || !insn->jump_dest->func ||
-			     insn->jump_dest->func->pfunc == func)) {
+			if (func && !insn->jump_dest) {
+do_sibling_call:
+				if (has_modified_stack_frame(&state)) {
+					WARN_FUNC("sibling call from callable instruction with modified stack frame",
+							sec, insn->offset);
+					return 1;
+				}
+			} else if (insn->jump_dest &&
+				   (!func || !insn->jump_dest->func ||
+				    insn->jump_dest->func->pfunc == func)) {
 				ret = validate_branch(file, insn->jump_dest,
 						      state);
 				if (ret) {
@@ -1945,25 +1966,17 @@ static int validate_branch(struct objtoo
 						BT_FUNC("(branch)", insn);
 					return ret;
 				}
-
-			} else if (func && has_modified_stack_frame(&state)) {
-				WARN_FUNC("sibling call from callable instruction with modified stack frame",
-					  sec, insn->offset);
-				return 1;
 			}
 
-			if (insn->type == INSN_JUMP_UNCONDITIONAL)
+			if (insn->type == INSN_JUMP_UNCONDITIONAL ||
+			    insn->type == INSN_JUMP_DYNAMIC)
 				return 0;
 
 			break;
 
 		case INSN_JUMP_DYNAMIC:
-			if (func && list_empty(&insn->alts) &&
-			    has_modified_stack_frame(&state)) {
-				WARN_FUNC("sibling call from callable instruction with modified stack frame",
-					  sec, insn->offset);
-				return 1;
-			}
+			if (func && list_empty(&insn->alts))
+				goto do_sibling_call;
 
 			return 0;
 



^ permalink raw reply	[flat|nested] 100+ messages in thread

* [PATCH 18/20] objtool: Add UACCESS validation
  2019-03-07 11:45 [PATCH 00/20] objtool: UACCESS validation v3 Peter Zijlstra
                   ` (16 preceding siblings ...)
  2019-03-07 11:45 ` [PATCH 17/20] objtool: Fix sibling call detection Peter Zijlstra
@ 2019-03-07 11:45 ` Peter Zijlstra
  2019-03-07 16:33   ` Linus Torvalds
  2019-03-08 21:02   ` Josh Poimboeuf
  2019-03-07 11:45 ` [PATCH 19/20] objtool: uaccess PUSHF/POPF support Peter Zijlstra
                   ` (3 subsequent siblings)
  21 siblings, 2 replies; 100+ messages in thread
From: Peter Zijlstra @ 2019-03-07 11:45 UTC (permalink / raw)
  To: torvalds, tglx, hpa, julien.thierry, will.deacon, luto, mingo,
	catalin.marinas, james.morse, valentin.schneider, brgerst,
	jpoimboe, luto, bp, dvlasenk
  Cc: linux-kernel, peterz, dvyukov, rostedt

It is important that UACCESS regions are as small as possible;
furthermore the UACCESS state is not scheduled, so doing anything that
might directly call into the scheduler will cause random code to be
ran with UACCESS enabled.

Teach objtool too track UACCESS state and warn about any CALL made
while UACCESS is enabled. This very much includes the __fentry__()
and __preempt_schedule() calls.

Note that exceptions _do_ save/restore the UACCESS state, and therefore
they can drive preemption. This also means that all exception handlers
must have an otherwise redundant UACCESS disable instruction;
therefore ignore this warning for !STT_FUNC code (exception handlers
are not normal functions).

XXX: users hard-coded list of uaccess-safe functions because I've
failed to come up with a sensible annotation and the list should be
fairly static.

XXX: are we sure we want __memset marked AC-safe?

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
---
 scripts/Makefile.build          |    3 
 tools/objtool/arch.h            |    4 
 tools/objtool/arch/x86/decode.c |   14 +++
 tools/objtool/builtin-check.c   |    3 
 tools/objtool/builtin.h         |    2 
 tools/objtool/check.c           |  164 +++++++++++++++++++++++++++++++++++++---
 tools/objtool/check.h           |    2 
 tools/objtool/elf.h             |    1 
 tools/objtool/special.c         |   10 ++
 9 files changed, 188 insertions(+), 15 deletions(-)

--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -223,6 +223,9 @@ endif
 ifdef CONFIG_RETPOLINE
   objtool_args += --retpoline
 endif
+ifdef CONFIG_X86_SMAP
+  objtool_args += --uaccess
+endif
 
 # 'OBJECT_FILES_NON_STANDARD := y': skip objtool checking for a directory
 # 'OBJECT_FILES_NON_STANDARD_foo.o := 'y': skip objtool checking for a file
--- a/tools/objtool/arch.h
+++ b/tools/objtool/arch.h
@@ -33,7 +33,9 @@
 #define INSN_STACK		8
 #define INSN_BUG		9
 #define INSN_NOP		10
-#define INSN_OTHER		11
+#define INSN_STAC		11
+#define INSN_CLAC		12
+#define INSN_OTHER		13
 #define INSN_LAST		INSN_OTHER
 
 enum op_dest_type {
--- a/tools/objtool/arch/x86/decode.c
+++ b/tools/objtool/arch/x86/decode.c
@@ -369,7 +369,19 @@ int arch_decode_instruction(struct elf *
 
 	case 0x0f:
 
-		if (op2 >= 0x80 && op2 <= 0x8f) {
+		if (op2 == 0x01) {
+
+			if (modrm == 0xca) {
+
+				*type = INSN_CLAC;
+
+			} else if (modrm == 0xcb) {
+
+				*type = INSN_STAC;
+
+			}
+
+		} else if (op2 >= 0x80 && op2 <= 0x8f) {
 
 			*type = INSN_JUMP_CONDITIONAL;
 
--- a/tools/objtool/builtin-check.c
+++ b/tools/objtool/builtin-check.c
@@ -29,7 +29,7 @@
 #include "builtin.h"
 #include "check.h"
 
-bool no_fp, no_unreachable, retpoline, module, backtrace;
+bool no_fp, no_unreachable, retpoline, module, backtrace, uaccess;
 
 static const char * const check_usage[] = {
 	"objtool check [<options>] file.o",
@@ -42,6 +42,7 @@ const struct option check_options[] = {
 	OPT_BOOLEAN('r', "retpoline", &retpoline, "Validate retpoline assumptions"),
 	OPT_BOOLEAN('m', "module", &module, "Indicates the object will be part of a kernel module"),
 	OPT_BOOLEAN('b', "backtrace", &backtrace, "unwind on error"),
+	OPT_BOOLEAN('a', "uaccess", &uaccess, "enable uaccess checking"),
 	OPT_END(),
 };
 
--- a/tools/objtool/builtin.h
+++ b/tools/objtool/builtin.h
@@ -20,7 +20,7 @@
 #include <subcmd/parse-options.h>
 
 extern const struct option check_options[];
-extern bool no_fp, no_unreachable, retpoline, module, backtrace;
+extern bool no_fp, no_unreachable, retpoline, module, backtrace, uaccess;
 
 extern int cmd_check(int argc, const char **argv);
 extern int cmd_orc(int argc, const char **argv);
--- a/tools/objtool/check.c
+++ b/tools/objtool/check.c
@@ -442,6 +442,81 @@ static void add_ignores(struct objtool_f
 	}
 }
 
+static const char *uaccess_safe_builtin[] = {
+	/* KASAN */
+	"memset_orig", /* XXX why not memset_erms */
+	"__memset",
+	"kasan_poison_shadow",
+	"kasan_unpoison_shadow",
+	"__asan_poison_stack_memory",
+	"__asan_unpoison_stack_memory",
+	"kasan_report",
+	"check_memory_region",
+	/* KASAN out-of-line */
+	"__asan_loadN_noabort",
+	"__asan_load1_noabort",
+	"__asan_load2_noabort",
+	"__asan_load4_noabort",
+	"__asan_load8_noabort",
+	"__asan_load16_noabort",
+	"__asan_storeN_noabort",
+	"__asan_store1_noabort",
+	"__asan_store2_noabort",
+	"__asan_store4_noabort",
+	"__asan_store8_noabort",
+	"__asan_store16_noabort",
+	/* KASAN in-line */
+	"__asan_report_load_n_noabort",
+	"__asan_report_load1_noabort",
+	"__asan_report_load2_noabort",
+	"__asan_report_load4_noabort",
+	"__asan_report_load8_noabort",
+	"__asan_report_load16_noabort",
+	"__asan_report_store_n_noabort",
+	"__asan_report_store1_noabort",
+	"__asan_report_store2_noabort",
+	"__asan_report_store4_noabort",
+	"__asan_report_store8_noabort",
+	"__asan_report_store16_noabort",
+	/* KCOV */
+	"write_comp_data",
+	"__sanitizer_cov_trace_pc",
+	"__sanitizer_cov_trace_const_cmp1",
+	"__sanitizer_cov_trace_const_cmp2",
+	"__sanitizer_cov_trace_const_cmp4",
+	"__sanitizer_cov_trace_const_cmp8",
+	"__sanitizer_cov_trace_cmp1",
+	"__sanitizer_cov_trace_cmp2",
+	"__sanitizer_cov_trace_cmp4",
+	"__sanitizer_cov_trace_cmp8",
+	/* UBSAN */
+	"ubsan_type_mismatch_common",
+	"__ubsan_handle_type_mismatch",
+	"__ubsan_handle_type_mismatch_v1",
+	/* misc */
+	"csum_partial_copy_generic",
+	"__memcpy_mcsafe",
+	"ftrace_likely_update", /* CONFIG_TRACE_BRANCH_PROFILING */
+	NULL
+};
+
+static void add_uaccess_safe(struct objtool_file *file)
+{
+	struct symbol *func;
+	const char **name;
+
+	if (!uaccess)
+		return;
+
+	for (name = uaccess_safe_builtin; *name; name++) {
+		func = find_symbol_by_name(file->elf, *name);
+		if (!func)
+			continue;
+
+		func->alias->uaccess_safe = true;
+	}
+}
+
 /*
  * FIXME: For now, just ignore any alternatives which add retpolines.  This is
  * a temporary hack, as it doesn't allow ORC to unwind from inside a retpoline.
@@ -1239,6 +1314,7 @@ static int decode_sections(struct objtoo
 		return ret;
 
 	add_ignores(file);
+	add_uaccess_safe(file);
 
 	ret = add_nospec_ignores(file);
 	if (ret)
@@ -1799,6 +1875,22 @@ static bool insn_state_match(struct inst
 	return false;
 }
 
+static inline bool func_uaccess_safe(struct symbol *func)
+{
+	if (func)
+		return func->alias->uaccess_safe;
+
+	return false;
+}
+
+static inline const char *insn_dest_name(struct instruction *insn)
+{
+	if (insn->call_dest)
+		return insn->call_dest->name;
+
+	return "{dynamic}";
+}
+
 /*
  * Follow the branch starting at the given instruction, and recursively follow
  * any other branches (jumps).  Meanwhile, track the frame pointer state at
@@ -1844,7 +1936,9 @@ static int validate_branch(struct objtoo
 			if (!insn->hint && !insn_state_match(insn, &state))
 				return 1;
 
-			return 0;
+			/* If we were here with AC=0, but now have AC=1, go again */
+			if (insn->state.uaccess || !state.uaccess)
+				return 0;
 		}
 
 		if (insn->hint) {
@@ -1914,6 +2008,16 @@ static int validate_branch(struct objtoo
 		switch (insn->type) {
 
 		case INSN_RETURN:
+			if (state.uaccess && !func_uaccess_safe(func)) {
+				WARN_FUNC("return with UACCESS enabled", sec, insn->offset);
+				return 1;
+			}
+
+			if (!state.uaccess && func_uaccess_safe(func)) {
+				WARN_FUNC("return with UACCESS disabled from a UACCESS-safe function", sec, insn->offset);
+				return 1;
+			}
+
 			if (func && has_modified_stack_frame(&state)) {
 				WARN_FUNC("return with modified stack frame",
 					  sec, insn->offset);
@@ -1929,17 +2033,32 @@ static int validate_branch(struct objtoo
 			return 0;
 
 		case INSN_CALL:
-			if (is_fentry_call(insn))
-				break;
+		case INSN_CALL_DYNAMIC:
+do_call:
+			if (state.uaccess && !func_uaccess_safe(insn->call_dest)) {
+				WARN_FUNC("call to %s() with UACCESS enabled",
+					  sec, insn->offset, insn_dest_name(insn));
+				return 1;
+			}
 
-			ret = dead_end_function(file, insn->call_dest);
-			if (ret == 1)
+			if (insn->type == INSN_JUMP_UNCONDITIONAL ||
+			    insn->type == INSN_JUMP_DYNAMIC)
 				return 0;
-			if (ret == -1)
-				return 1;
 
-			/* fallthrough */
-		case INSN_CALL_DYNAMIC:
+			if (insn->type == INSN_JUMP_CONDITIONAL)
+				break;
+
+			if (insn->type == INSN_CALL) {
+				if (is_fentry_call(insn))
+					break;
+
+				ret = dead_end_function(file, insn->call_dest);
+				if (ret == 1)
+					return 0;
+				if (ret == -1)
+					return 1;
+			}
+
 			if (!no_fp && func && !has_valid_stack_frame(&state)) {
 				WARN_FUNC("call without frame pointer save/setup",
 					  sec, insn->offset);
@@ -1956,6 +2075,8 @@ static int validate_branch(struct objtoo
 							sec, insn->offset);
 					return 1;
 				}
+				goto do_call;
+
 			} else if (insn->jump_dest &&
 				   (!func || !insn->jump_dest->func ||
 				    insn->jump_dest->func->pfunc == func)) {
@@ -1994,6 +2115,29 @@ static int validate_branch(struct objtoo
 
 			break;
 
+		case INSN_STAC:
+			if (state.uaccess) {
+				WARN_FUNC("recursive UACCESS enable", sec, insn->offset);
+				return 1;
+			}
+
+			state.uaccess = true;
+			break;
+
+		case INSN_CLAC:
+			if (!state.uaccess && insn->func) {
+				WARN_FUNC("redundant UACCESS disable", sec, insn->offset);
+				return 1;
+			}
+
+			if (func_uaccess_safe(func)) {
+				WARN_FUNC("UACCESS-safe disables UACCESS", sec, insn->offset);
+				return 1;
+			}
+
+			state.uaccess = false;
+			break;
+
 		default:
 			break;
 		}
@@ -2157,6 +2301,8 @@ static int validate_functions(struct obj
 			if (!insn || insn->ignore)
 				continue;
 
+			state.uaccess = func->alias->uaccess_safe;
+
 			ret = validate_branch(file, insn, state);
 			if (ret && backtrace)
 				BT_FUNC("<=== (func)", insn);
--- a/tools/objtool/check.h
+++ b/tools/objtool/check.h
@@ -31,7 +31,7 @@ struct insn_state {
 	int stack_size;
 	unsigned char type;
 	bool bp_scratch;
-	bool drap, end;
+	bool drap, end, uaccess;
 	int drap_reg, drap_offset;
 	struct cfi_reg vals[CFI_NUM_REGS];
 };
--- a/tools/objtool/elf.h
+++ b/tools/objtool/elf.h
@@ -62,6 +62,7 @@ struct symbol {
 	unsigned long offset;
 	unsigned int len;
 	struct symbol *pfunc, *cfunc, *alias;
+	bool uaccess_safe;
 };
 
 struct rela {
--- a/tools/objtool/special.c
+++ b/tools/objtool/special.c
@@ -42,6 +42,7 @@
 #define ALT_NEW_LEN_OFFSET	11
 
 #define X86_FEATURE_POPCNT (4*32+23)
+#define X86_FEATURE_SMAP   (9*32+20)
 
 struct special_entry {
 	const char *sec;
@@ -107,8 +108,15 @@ static int get_alt_entry(struct elf *elf
 		 * It has been requested that we don't validate the !POPCNT
 		 * feature path which is a "very very small percentage of
 		 * machines".
+		 *
+		 * Also, unconditionally enable SMAP; this avoids seeing paths
+		 * that pass through the STAC alternative and through the CLAC
+		 * NOPs.
+		 *
+		 * XXX: We could do this for all binary NOP/single-INSN
+		 * alternatives.
 		 */
-		if (feature == X86_FEATURE_POPCNT)
+		if (feature == X86_FEATURE_POPCNT || feature == X86_FEATURE_SMAP)
 			alt->skip_orig = true;
 	}
 



^ permalink raw reply	[flat|nested] 100+ messages in thread

* [PATCH 19/20] objtool: uaccess PUSHF/POPF support
  2019-03-07 11:45 [PATCH 00/20] objtool: UACCESS validation v3 Peter Zijlstra
                   ` (17 preceding siblings ...)
  2019-03-07 11:45 ` [PATCH 18/20] objtool: Add UACCESS validation Peter Zijlstra
@ 2019-03-07 11:45 ` Peter Zijlstra
  2019-03-08 21:11   ` Josh Poimboeuf
  2019-03-07 11:45 ` [PATCH 20/20] objtool: Add Direction Flag validation Peter Zijlstra
                   ` (2 subsequent siblings)
  21 siblings, 1 reply; 100+ messages in thread
From: Peter Zijlstra @ 2019-03-07 11:45 UTC (permalink / raw)
  To: torvalds, tglx, hpa, julien.thierry, will.deacon, luto, mingo,
	catalin.marinas, james.morse, valentin.schneider, brgerst,
	jpoimboe, luto, bp, dvlasenk
  Cc: linux-kernel, peterz, dvyukov, rostedt

Add PUSHF / POPF state.uaccess restore logic.

XXX: should possibly be merged with the previous patch such that KASAN
doesn't explode in between. Split for review.

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
---
 tools/objtool/arch.h            |    2 ++
 tools/objtool/arch/x86/decode.c |    4 ++--
 tools/objtool/check.c           |   30 ++++++++++++++++++++++++++----
 tools/objtool/check.h           |    1 +
 4 files changed, 31 insertions(+), 6 deletions(-)

--- a/tools/objtool/arch.h
+++ b/tools/objtool/arch.h
@@ -43,6 +43,7 @@ enum op_dest_type {
 	OP_DEST_REG_INDIRECT,
 	OP_DEST_MEM,
 	OP_DEST_PUSH,
+	OP_DEST_PUSHF,
 	OP_DEST_LEAVE,
 };
 
@@ -57,6 +58,7 @@ enum op_src_type {
 	OP_SRC_REG_INDIRECT,
 	OP_SRC_CONST,
 	OP_SRC_POP,
+	OP_SRC_POPF,
 	OP_SRC_ADD,
 	OP_SRC_AND,
 };
--- a/tools/objtool/arch/x86/decode.c
+++ b/tools/objtool/arch/x86/decode.c
@@ -357,13 +357,13 @@ int arch_decode_instruction(struct elf *
 		/* pushf */
 		*type = INSN_STACK;
 		op->src.type = OP_SRC_CONST;
-		op->dest.type = OP_DEST_PUSH;
+		op->dest.type = OP_DEST_PUSHF;
 		break;
 
 	case 0x9d:
 		/* popf */
 		*type = INSN_STACK;
-		op->src.type = OP_SRC_POP;
+		op->src.type = OP_SRC_POPF;
 		op->dest.type = OP_DEST_MEM;
 		break;
 
--- a/tools/objtool/check.c
+++ b/tools/objtool/check.c
@@ -1392,11 +1392,11 @@ static int update_insn_state_regs(struct
 		return 0;
 
 	/* push */
-	if (op->dest.type == OP_DEST_PUSH)
+	if (op->dest.type == OP_DEST_PUSH || op->dest.type == OP_DEST_PUSHF)
 		cfa->offset += 8;
 
 	/* pop */
-	if (op->src.type == OP_SRC_POP)
+	if (op->src.type == OP_SRC_POP || op->src.type == OP_SRC_POPF)
 		cfa->offset -= 8;
 
 	/* add immediate to sp */
@@ -1653,6 +1653,7 @@ static int update_insn_state(struct inst
 			break;
 
 		case OP_SRC_POP:
+		case OP_SRC_POPF:
 			if (!state->drap && op->dest.type == OP_DEST_REG &&
 			    op->dest.reg == cfa->base) {
 
@@ -1717,6 +1718,7 @@ static int update_insn_state(struct inst
 		break;
 
 	case OP_DEST_PUSH:
+	case OP_DEST_PUSHF:
 		state->stack_size += 8;
 		if (cfa->base == CFI_SP)
 			cfa->offset += 8;
@@ -1807,7 +1809,7 @@ static int update_insn_state(struct inst
 		break;
 
 	case OP_DEST_MEM:
-		if (op->src.type != OP_SRC_POP) {
+		if (op->src.type != OP_SRC_POP && op->src.type != OP_SRC_POPF) {
 			WARN_FUNC("unknown stack-related memory operation",
 				  insn->sec, insn->offset);
 			return -1;
@@ -2109,6 +2111,26 @@ static int validate_branch(struct objtoo
 			if (update_insn_state(insn, &state))
 				return 1;
 
+			if (insn->stack_op.dest.type == OP_DEST_PUSHF) {
+				if (!state.uaccess_stack) {
+					state.uaccess_stack = 1;
+				} else if (state.uaccess_stack >> 31) {
+					WARN_FUNC("PUSHF stack exhausted", sec, insn->offset);
+					return 1;
+				}
+				state.uaccess_stack <<= 1;
+				state.uaccess_stack  |= state.uaccess;
+			}
+
+			if (insn->stack_op.src.type == OP_SRC_POPF) {
+				if (state.uaccess_stack) {
+					state.uaccess = state.uaccess_stack & 1;
+					state.uaccess_stack >>= 1;
+					if (state.uaccess_stack == 1)
+						state.uaccess_stack = 0;
+				}
+			}
+
 			break;
 
 		case INSN_STAC:
@@ -2126,7 +2148,7 @@ static int validate_branch(struct objtoo
 				return 1;
 			}
 
-			if (func_uaccess_safe(func)) {
+			if (func_uaccess_safe(func) && !state.uaccess_stack) {
 				WARN_FUNC("UACCESS-safe disables UACCESS", sec, insn->offset);
 				return 1;
 			}
--- a/tools/objtool/check.h
+++ b/tools/objtool/check.h
@@ -32,6 +32,7 @@ struct insn_state {
 	unsigned char type;
 	bool bp_scratch;
 	bool drap, end, uaccess;
+	unsigned int uaccess_stack;
 	int drap_reg, drap_offset;
 	struct cfi_reg vals[CFI_NUM_REGS];
 };



^ permalink raw reply	[flat|nested] 100+ messages in thread

* [PATCH 20/20] objtool: Add Direction Flag validation
  2019-03-07 11:45 [PATCH 00/20] objtool: UACCESS validation v3 Peter Zijlstra
                   ` (18 preceding siblings ...)
  2019-03-07 11:45 ` [PATCH 19/20] objtool: uaccess PUSHF/POPF support Peter Zijlstra
@ 2019-03-07 11:45 ` Peter Zijlstra
  2019-03-08 21:16   ` Josh Poimboeuf
  2019-03-07 12:03 ` [PATCH 00/20] objtool: UACCESS validation v3 Peter Zijlstra
  2019-03-07 17:14 ` hpa
  21 siblings, 1 reply; 100+ messages in thread
From: Peter Zijlstra @ 2019-03-07 11:45 UTC (permalink / raw)
  To: torvalds, tglx, hpa, julien.thierry, will.deacon, luto, mingo,
	catalin.marinas, james.morse, valentin.schneider, brgerst,
	jpoimboe, luto, bp, dvlasenk
  Cc: linux-kernel, peterz, dvyukov, rostedt

Having DF escape is BAD(tm).

Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
---
 tools/objtool/arch.h            |    4 +++-
 tools/objtool/arch/x86/decode.c |    8 ++++++++
 tools/objtool/check.c           |   25 +++++++++++++++++++++++++
 tools/objtool/check.h           |    2 +-
 4 files changed, 37 insertions(+), 2 deletions(-)

--- a/tools/objtool/arch.h
+++ b/tools/objtool/arch.h
@@ -35,7 +35,9 @@
 #define INSN_NOP		10
 #define INSN_STAC		11
 #define INSN_CLAC		12
-#define INSN_OTHER		13
+#define INSN_STD		13
+#define INSN_CLD		14
+#define INSN_OTHER		15
 #define INSN_LAST		INSN_OTHER
 
 enum op_dest_type {
--- a/tools/objtool/arch/x86/decode.c
+++ b/tools/objtool/arch/x86/decode.c
@@ -456,6 +456,14 @@ int arch_decode_instruction(struct elf *
 		*type = INSN_CALL;
 		break;
 
+	case 0xfc:
+		*type = INSN_CLD;
+		break;
+
+	case 0xfd:
+		*type = INSN_STD;
+		break;
+
 	case 0xff:
 		if (modrm_reg == 2 || modrm_reg == 3)
 
--- a/tools/objtool/check.c
+++ b/tools/objtool/check.c
@@ -2020,6 +2020,11 @@ static int validate_branch(struct objtoo
 				return 1;
 			}
 
+			if (state.df) {
+				WARN_FUNC("return with DF set", sec, insn->offset);
+				return 1;
+			}
+
 			if (func && has_modified_stack_frame(&state)) {
 				WARN_FUNC("return with modified stack frame",
 					  sec, insn->offset);
@@ -2043,6 +2048,12 @@ static int validate_branch(struct objtoo
 				return 1;
 			}
 
+			if (state.df) {
+				WARN_FUNC("call to %s() with DF set",
+					  sec, insn->offset, insn_dest_name(insn));
+				return 1;
+			}
+
 			if (insn->type == INSN_JUMP_UNCONDITIONAL ||
 			    insn->type == INSN_JUMP_DYNAMIC)
 				return 0;
@@ -2160,6 +2171,20 @@ static int validate_branch(struct objtoo
 			state.uaccess = false;
 			break;
 
+		case INSN_STD:
+			if (state.df)
+				WARN_FUNC("recursive STD", sec, insn->offset);
+
+			state.df = true;
+			break;
+
+		case INSN_CLD:
+			if (!state.df && insn->func)
+				WARN_FUNC("redundant CLD", sec, insn->offset);
+
+			state.df = false;
+			break;
+
 		default:
 			break;
 		}
--- a/tools/objtool/check.h
+++ b/tools/objtool/check.h
@@ -31,7 +31,7 @@ struct insn_state {
 	int stack_size;
 	unsigned char type;
 	bool bp_scratch;
-	bool drap, end, uaccess;
+	bool drap, end, uaccess, df;
 	unsigned int uaccess_stack;
 	int drap_reg, drap_offset;
 	struct cfi_reg vals[CFI_NUM_REGS];



^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 00/20] objtool: UACCESS validation v3
  2019-03-07 11:45 [PATCH 00/20] objtool: UACCESS validation v3 Peter Zijlstra
                   ` (19 preceding siblings ...)
  2019-03-07 11:45 ` [PATCH 20/20] objtool: Add Direction Flag validation Peter Zijlstra
@ 2019-03-07 12:03 ` Peter Zijlstra
  2019-03-07 12:55   ` Peter Zijlstra
  2019-03-07 16:31   ` [PATCH 00/20] objtool: UACCESS validation v3 Linus Torvalds
  2019-03-07 17:14 ` hpa
  21 siblings, 2 replies; 100+ messages in thread
From: Peter Zijlstra @ 2019-03-07 12:03 UTC (permalink / raw)
  To: torvalds, tglx, hpa, julien.thierry, will.deacon, luto, mingo,
	catalin.marinas, james.morse, valentin.schneider, brgerst,
	jpoimboe, luto, bp, dvlasenk
  Cc: linux-kernel, dvyukov, rostedt

[-- Attachment #1: Type: text/plain, Size: 16375 bytes --]

On Thu, Mar 07, 2019 at 12:45:11PM +0100, Peter Zijlstra wrote:
> I've only got a few randconfig
> failures left (GCC-8) that I'm not quite understanding.

Take for instance this one (.config attached); it has both
CONFIG_PROFILE_ALL_BRANCHES=y and CONFIG_TRACE_BRANCH_PROFILING=y
and it compiles:

(from kernel/exit.c)

SYSCALL_DEFINE5(waitid, int, which, pid_t, upid, struct siginfo __user *,
		infop, int, options, struct rusage __user *, ru)
{
	struct rusage r;
	struct waitid_info info = {.status = 0};
	long err = kernel_waitid(which, upid, &info, options, ru ? &r : NULL);
	int signo = 0;

	if (err > 0) {
		signo = SIGCHLD;
		err = 0;
		if (ru && copy_to_user(ru, &r, sizeof(struct rusage)))
			return -EFAULT;
	}
	if (!infop)
		return err;

	if (!user_access_begin(infop, sizeof(*infop)))
		return -EFAULT;

	unsafe_put_user(signo, &infop->si_signo, Efault);
	unsafe_put_user(0, &infop->si_errno, Efault);
	unsafe_put_user(info.cause, &infop->si_code, Efault);
	unsafe_put_user(info.pid, &infop->si_pid, Efault);
	unsafe_put_user(info.uid, &infop->si_uid, Efault);
	unsafe_put_user(info.status, &infop->si_status, Efault);
	user_access_end();
	return err;
Efault:
	user_access_end();
	return -EFAULT;
}

into this atrocious crap (grep -v ffffffffffffe0eb; if you want the src
to go away):

$ objdump -Sdr randconfig-build/kernel/exit.o | awk "/>:\$/ { P=0; } /__do_sys_waitid>:\$/ { P=1; O=strtonum(\"0x\" \$1); } { if (P) { o=strtonum(\"0x\" \$1); printf(\"%04x \", o-O); print \$0; } }"

0000 0000000000001f15 <__do_sys_waitid>:
ffffffffffffe0eb 
ffffffffffffe0eb SYSCALL_DEFINE5(waitid, int, which, pid_t, upid, struct siginfo __user *,
ffffffffffffe0eb 		infop, int, options, struct rusage __user *, ru)
ffffffffffffe0eb {
0000     1f15:	55                   	push   %rbp
ffffffffffffe0eb 	struct rusage r;
ffffffffffffe0eb 	struct waitid_info info = {.status = 0};
ffffffffffffe0eb 	long err = kernel_waitid(which, upid, &info, options, ru ? &r : NULL);
0001     1f16:	b8 00 00 00 00       	mov    $0x0,%eax
ffffffffffffe0eb {
0006     1f1b:	48 89 e5             	mov    %rsp,%rbp
0009     1f1e:	41 57                	push   %r15
000b     1f20:	41 56                	push   %r14
000d     1f22:	41 55                	push   %r13
000f     1f24:	41 54                	push   %r12
0011     1f26:	4d 89 c4             	mov    %r8,%r12
0014     1f29:	53                   	push   %rbx
0015     1f2a:	48 89 d3             	mov    %rdx,%rbx
0018     1f2d:	48 83 e4 f0          	and    $0xfffffffffffffff0,%rsp
001c     1f31:	48 81 ec a0 00 00 00 	sub    $0xa0,%rsp
ffffffffffffe0eb 	long err = kernel_waitid(which, upid, &info, options, ru ? &r : NULL);
0023     1f38:	4d 85 e4             	test   %r12,%r12
0026     1f3b:	4c 8d 44 24 10       	lea    0x10(%rsp),%r8
002b     1f40:	48 89 e2             	mov    %rsp,%rdx
ffffffffffffe0eb 	struct waitid_info info = {.status = 0};
002e     1f43:	48 c7 04 24 00 00 00 	movq   $0x0,(%rsp)
0035     1f4a:	00 
0036     1f4b:	48 c7 44 24 08 00 00 	movq   $0x0,0x8(%rsp)
003d     1f52:	00 00 
ffffffffffffe0eb 	long err = kernel_waitid(which, upid, &info, options, ru ? &r : NULL);
003f     1f54:	4c 0f 44 c0          	cmove  %rax,%r8
0043     1f58:	e8 9c fe ff ff       	callq  1df9 <kernel_waitid>
ffffffffffffe0eb 	int signo = 0;
ffffffffffffe0eb 
ffffffffffffe0eb 	if (err > 0) {
0048     1f5d:	48 85 c0             	test   %rax,%rax
ffffffffffffe0eb 	long err = kernel_waitid(which, upid, &info, options, ru ? &r : NULL);
004b     1f60:	49 89 c7             	mov    %rax,%r15
ffffffffffffe0eb 	if (err > 0) {
004e     1f63:	0f 9f c0             	setg   %al
0051     1f66:	0f b6 c0             	movzbl %al,%eax
0054     1f69:	48 83 c0 02          	add    $0x2,%rax
0058     1f6d:	48 ff 04 c5 00 00 00 	incq   0x0(,%rax,8)
005f     1f74:	00 
005c 			1f71: R_X86_64_32S	_ftrace_branch+0x1c0
0060     1f75:	4d 85 ff             	test   %r15,%r15
0063     1f78:	7e 7b                	jle    1ff5 <__do_sys_waitid+0xe0>
ffffffffffffe0eb 		signo = SIGCHLD;
ffffffffffffe0f9 		err = 0;
ffffffffffffe0eb 		if (ru && copy_to_user(ru, &r, sizeof(struct rusage)))
0065     1f7a:	31 d2                	xor    %edx,%edx
0067     1f7c:	4d 85 e4             	test   %r12,%r12
006a     1f7f:	74 53                	je     1fd4 <__do_sys_waitid+0xbf>
ffffffffffffe0eb 
ffffffffffffe0eb static __always_inline bool
ffffffffffffe0f7 check_copy_size(const void *addr, size_t bytes, bool is_source)
ffffffffffffe0eb {
ffffffffffffe0eb 	int sz = __compiletime_object_size(addr);
ffffffffffffe0eb 	if (unlikely(sz >= 0 && sz < bytes)) {
006c     1f81:	31 f6                	xor    %esi,%esi
006e     1f83:	b9 01 00 00 00       	mov    $0x1,%ecx
0073     1f88:	48 c7 c7 00 00 00 00 	mov    $0x0,%rdi
0076 			1f8b: R_X86_64_32S	_ftrace_annotated_branch+0xcc0
007a     1f8f:	e8 00 00 00 00       	callq  1f94 <__do_sys_waitid+0x7f>
007b 			1f90: R_X86_64_PLT32	ftrace_likely_update-0x4
ffffffffffffe0eb }
ffffffffffffe0eb 
ffffffffffffe0eb static __always_inline unsigned long __must_check
ffffffffffffe0f7 copy_to_user(void __user *to, const void *from, unsigned long n)
ffffffffffffe0eb {
ffffffffffffe0eb 	if (likely(check_copy_size(from, n, true)))
007f     1f94:	31 c9                	xor    %ecx,%ecx
0081     1f96:	ba 01 00 00 00       	mov    $0x1,%edx
0086     1f9b:	be 01 00 00 00       	mov    $0x1,%esi
008b     1fa0:	48 c7 c7 00 00 00 00 	mov    $0x0,%rdi
008e 			1fa3: R_X86_64_32S	_ftrace_annotated_branch+0xae0
0092     1fa7:	48 ff 05 00 00 00 00 	incq   0x0(%rip)        # 1fae <__do_sys_waitid+0x99>
0095 			1faa: R_X86_64_PC32	_ftrace_branch+0x1fcc
0099     1fae:	e8 00 00 00 00       	callq  1fb3 <__do_sys_waitid+0x9e>
009a 			1faf: R_X86_64_PLT32	ftrace_likely_update-0x4
ffffffffffffe0eb 		n = _copy_to_user(to, from, n);
009e     1fb3:	ba 90 00 00 00       	mov    $0x90,%edx
00a3     1fb8:	4c 89 e7             	mov    %r12,%rdi
ffffffffffffe0eb 	if (likely(check_copy_size(from, n, true)))
00a6     1fbb:	48 ff 05 00 00 00 00 	incq   0x0(%rip)        # 1fc2 <__do_sys_waitid+0xad>
00a9 			1fbe: R_X86_64_PC32	_ftrace_branch+0x1d7c
ffffffffffffe0eb 		n = _copy_to_user(to, from, n);
00ad     1fc2:	48 8d 74 24 10       	lea    0x10(%rsp),%rsi
00b2     1fc7:	e8 00 00 00 00       	callq  1fcc <__do_sys_waitid+0xb7>
00b3 			1fc8: R_X86_64_PLT32	_copy_to_user-0x4
00b7     1fcc:	31 d2                	xor    %edx,%edx
00b9     1fce:	48 85 c0             	test   %rax,%rax
00bc     1fd1:	0f 95 c2             	setne  %dl
00bf     1fd4:	48 63 c2             	movslq %edx,%rax
ffffffffffffe0eb 		signo = SIGCHLD;
00c2     1fd7:	41 be 11 00 00 00    	mov    $0x11,%r14d
ffffffffffffe0f9 		err = 0;
00c8     1fdd:	45 31 ff             	xor    %r15d,%r15d
ffffffffffffe0eb 		if (ru && copy_to_user(ru, &r, sizeof(struct rusage)))
00cb     1fe0:	48 83 c0 02          	add    $0x2,%rax
00cf     1fe4:	48 ff 04 c5 00 00 00 	incq   0x0(,%rax,8)
00d6     1feb:	00 
00d3 			1fe8: R_X86_64_32S	_ftrace_branch+0x198
00d7     1fec:	85 d2                	test   %edx,%edx
00d9     1fee:	74 08                	je     1ff8 <__do_sys_waitid+0xe3>
00db     1ff0:	e9 33 01 00 00       	jmpq   2128 <__do_sys_waitid+0x213>
ffffffffffffe0eb 	int signo = 0;
00e0     1ff5:	45 31 f6             	xor    %r14d,%r14d
ffffffffffffe0eb 			return -EFAULT;
ffffffffffffe0eb 	}
ffffffffffffe0eb 	if (!infop)
00e3     1ff8:	31 c0                	xor    %eax,%eax
00e5     1ffa:	48 85 db             	test   %rbx,%rbx
00e8     1ffd:	0f 94 c0             	sete   %al
00eb     2000:	48 83 c0 02          	add    $0x2,%rax
00ef     2004:	48 ff 04 c5 00 00 00 	incq   0x0(,%rax,8)
00f6     200b:	00 
00f3 			2008: R_X86_64_32S	_ftrace_branch+0x170
00f7     200c:	48 85 db             	test   %rbx,%rbx
00fa     200f:	0f 84 1a 01 00 00    	je     212f <__do_sys_waitid+0x21a>
ffffffffffffe0eb 	return raw_cpu_read_4(__preempt_count) & ~PREEMPT_NEED_RESCHED;
0100     2015:	65 44 8b 25 00 00 00 	mov    %gs:0x0(%rip),%r12d        # 201d <__do_sys_waitid+0x108>
0107     201c:	00 
0104 			2019: R_X86_64_PC32	__preempt_count-0x4
ffffffffffffe0eb  * checking before using them, but you have to surround them with the
ffffffffffffe0eb  * user_access_begin/end() pair.
ffffffffffffe0eb  */
ffffffffffffe0eb static __must_check __always_inline bool user_access_begin(const void __user *ptr, size_t len)
ffffffffffffe0eb {
ffffffffffffe0eb 	if (unlikely(!access_ok(ptr,len)))
0108     201d:	45 31 ed             	xor    %r13d,%r13d
010b     2020:	41 81 e4 00 01 1f 00 	and    $0x1f0100,%r12d
0112     2027:	48 c7 c7 00 00 00 00 	mov    $0x0,%rdi
0115 			202a: R_X86_64_32S	_ftrace_annotated_branch+0xb70
0119     202e:	41 0f 95 c5          	setne  %r13b
011d     2032:	31 c9                	xor    %ecx,%ecx
011f     2034:	31 d2                	xor    %edx,%edx
0121     2036:	44 89 ee             	mov    %r13d,%esi
0124     2039:	e8 00 00 00 00       	callq  203e <__do_sys_waitid+0x129>
0125 			203a: R_X86_64_PLT32	ftrace_likely_update-0x4
0129     203e:	49 63 c5             	movslq %r13d,%rax
012c     2041:	48 83 c0 02          	add    $0x2,%rax
0130     2045:	48 ff 04 c5 00 00 00 	incq   0x0(,%rax,8)
0137     204c:	00 
0134 			2049: R_X86_64_32S	_ftrace_branch+0x1d90
0138     204d:	45 85 e4             	test   %r12d,%r12d
013b     2050:	74 02                	je     2054 <__do_sys_waitid+0x13f>
013d     2052:	0f 0b                	ud2    
013f     2054:	31 c9                	xor    %ecx,%ecx
0141     2056:	31 d2                	xor    %edx,%edx
0143     2058:	44 89 ee             	mov    %r13d,%esi
0146     205b:	48 c7 c7 00 00 00 00 	mov    $0x0,%rdi
0149 			205e: R_X86_64_32S	_ftrace_annotated_branch+0xb40
014d     2062:	e8 00 00 00 00       	callq  2067 <__do_sys_waitid+0x152>
014e 			2063: R_X86_64_PLT32	ftrace_likely_update-0x4
ffffffffffffe0eb 		return unlikely(addr > limit - size);
0152     2067:	45 31 e4             	xor    %r12d,%r12d
0155     206a:	48 c7 c7 00 00 00 00 	mov    $0x0,%rdi
0158 			206d: R_X86_64_32S	_ftrace_annotated_branch+0xbd0
015c     2071:	65 48 8b 04 25 00 00 	mov    %gs:0x0,%rax
0163     2078:	00 00 
0161 			2076: R_X86_64_32S	current_task
0165     207a:	4c 8b a8 d8 1d 00 00 	mov    0x1dd8(%rax),%r13
016c     2081:	49 83 c5 80          	add    $0xffffffffffffff80,%r13
0170     2085:	4c 39 eb             	cmp    %r13,%rbx
0173     2088:	41 0f 97 c4          	seta   %r12b
0177     208c:	31 c9                	xor    %ecx,%ecx
0179     208e:	31 d2                	xor    %edx,%edx
017b     2090:	44 89 e6             	mov    %r12d,%esi
017e     2093:	e8 00 00 00 00       	callq  2098 <__do_sys_waitid+0x183>
017f 			2094: R_X86_64_PLT32	ftrace_likely_update-0x4
ffffffffffffe0eb 	if (unlikely(!access_ok(ptr,len)))
0183     2098:	31 f6                	xor    %esi,%esi
0185     209a:	4c 39 eb             	cmp    %r13,%rbx
0188     209d:	ba 01 00 00 00       	mov    $0x1,%edx
018d     20a2:	40 0f 96 c6          	setbe  %sil
0191     20a6:	48 c7 c7 00 00 00 00 	mov    $0x0,%rdi
0194 			20a9: R_X86_64_32S	_ftrace_annotated_branch+0xb10
0198     20ad:	31 c9                	xor    %ecx,%ecx
019a     20af:	e8 00 00 00 00       	callq  20b4 <__do_sys_waitid+0x19f>
019b 			20b0: R_X86_64_PLT32	ftrace_likely_update-0x4
019f     20b4:	44 89 e6             	mov    %r12d,%esi
01a2     20b7:	31 c9                	xor    %ecx,%ecx
01a4     20b9:	31 d2                	xor    %edx,%edx
01a6     20bb:	48 c7 c7 00 00 00 00 	mov    $0x0,%rdi
01a9 			20be: R_X86_64_32S	_ftrace_annotated_branch+0xba0
01ad     20c2:	49 83 c4 02          	add    $0x2,%r12
01b1     20c6:	e8 00 00 00 00       	callq  20cb <__do_sys_waitid+0x1b6>
01b2 			20c7: R_X86_64_PLT32	ftrace_likely_update-0x4
01b6     20cb:	4a ff 04 e5 00 00 00 	incq   0x0(,%r12,8)
01bd     20d2:	00 
01ba 			20cf: R_X86_64_32S	_ftrace_branch+0x1db8
ffffffffffffe0eb 		return 0;
01be     20d3:	31 c0                	xor    %eax,%eax
ffffffffffffe0eb 	if (unlikely(!access_ok(ptr,len)))
01c0     20d5:	4c 39 eb             	cmp    %r13,%rbx
01c3     20d8:	77 08                	ja     20e2 <__do_sys_waitid+0x1cd>
ffffffffffffe0eb 	__uaccess_begin_nospec();
01c5     20da:	90                   	nop
01c6     20db:	90                   	nop
01c7     20dc:	90                   	nop
ffffffffffffe0eb }
ffffffffffffe0eb 
ffffffffffffe0eb static __always_inline void stac(void)
ffffffffffffe0eb {
ffffffffffffe0eb 	/* Note: a barrier is implicit in alternative() */
ffffffffffffe0f5 	alternative("", __stringify(__ASM_STAC), X86_FEATURE_SMAP);
01c8     20dd:	90                   	nop
01c9     20de:	90                   	nop
01ca     20df:	90                   	nop
ffffffffffffe0eb 	return 1;
01cb     20e0:	b0 01                	mov    $0x1,%al
ffffffffffffe0eb 		return err;
ffffffffffffe0eb 
ffffffffffffe0eb 	if (!user_access_begin(infop, sizeof(*infop)))
01cd     20e2:	83 f0 01             	xor    $0x1,%eax
01d0     20e5:	48 89 c2             	mov    %rax,%rdx
01d3     20e8:	83 e2 01             	and    $0x1,%edx
01d6     20eb:	48 83 c2 02          	add    $0x2,%rdx
01da     20ef:	48 ff 04 d5 00 00 00 	incq   0x0(,%rdx,8)
01e1     20f6:	00 
01de 			20f3: R_X86_64_32S	_ftrace_branch+0x148
01e2     20f7:	84 c0                	test   %al,%al
01e4     20f9:	75 2d                	jne    2128 <__do_sys_waitid+0x213>
ffffffffffffe0eb 		return -EFAULT;
ffffffffffffe0eb 
ffffffffffffe0eb 	unsafe_put_user(signo, &infop->si_signo, Efault);
01e6     20fb:	44 89 33             	mov    %r14d,(%rbx)
ffffffffffffe0eb 	unsafe_put_user(0, &infop->si_errno, Efault);
01e9     20fe:	c7 43 04 00 00 00 00 	movl   $0x0,0x4(%rbx)
ffffffffffffe0eb 	unsafe_put_user(info.cause, &infop->si_code, Efault);
01f0     2105:	8b 44 24 0c          	mov    0xc(%rsp),%eax
01f4     2109:	89 43 08             	mov    %eax,0x8(%rbx)
ffffffffffffe0eb 	unsafe_put_user(info.pid, &infop->si_pid, Efault);
01f7     210c:	8b 04 24             	mov    (%rsp),%eax
01fa     210f:	89 43 10             	mov    %eax,0x10(%rbx)
ffffffffffffe0eb 	unsafe_put_user(info.uid, &infop->si_uid, Efault);
01fd     2112:	8b 44 24 04          	mov    0x4(%rsp),%eax
0201     2116:	89 43 14             	mov    %eax,0x14(%rbx)
ffffffffffffe0eb 	unsafe_put_user(info.status, &infop->si_status, Efault);
0204     2119:	8b 44 24 08          	mov    0x8(%rsp),%eax
0208     211d:	89 43 18             	mov    %eax,0x18(%rbx)
ffffffffffffe0eb 	user_access_end();
020b     2120:	90                   	nop
020c     2121:	90                   	nop
020d     2122:	90                   	nop
ffffffffffffe0eb 	return err;
020e     2123:	eb 0a                	jmp    212f <__do_sys_waitid+0x21a>
ffffffffffffefe5 Efault:
ffffffffffffe0eb 	user_access_end();
0210     2125:	90                   	nop
0211     2126:	90                   	nop
0212     2127:	90                   	nop
ffffffffffffe0eb 	return -EFAULT;
0213     2128:	49 c7 c7 f2 ff ff ff 	mov    $0xfffffffffffffff2,%r15
ffffffffffffe0eb }
021a     212f:	48 8d 65 d8          	lea    -0x28(%rbp),%rsp
021e     2133:	4c 89 f8             	mov    %r15,%rax
0221     2136:	5b                   	pop    %rbx
0222     2137:	41 5c                	pop    %r12
0224     2139:	41 5d                	pop    %r13
0226     213b:	41 5e                	pop    %r14
0228     213d:	41 5f                	pop    %r15
022a     213f:	5d                   	pop    %rbp
022b     2140:	c3                   	retq   
ffffffffffffe0eb 

And then complains about:

$ tools/objtool/objtool check --no-fp --uaccess --backtrace randconfig-build/kernel/exit.o
randconfig-build/kernel/exit.o: warning: objtool: .altinstr_replacement+0xc: redundant UACCESS disable
randconfig-build/kernel/exit.o: warning: objtool:   __do_sys_waitid()+0x210: (alt)
randconfig-build/kernel/exit.o: warning: objtool:   __do_sys_waitid()+0x1e6: (alt)
randconfig-build/kernel/exit.o: warning: objtool:   __do_sys_waitid()+0x1c3: (branch)
randconfig-build/kernel/exit.o: warning: objtool:   __do_sys_waitid()+0x13b: (branch)
randconfig-build/kernel/exit.o: warning: objtool:   __do_sys_waitid()+0x63: (branch)
randconfig-build/kernel/exit.o: warning: objtool:   __do_sys_waitid()+0x0: <=== (func)

Which, afaict is correct given the asm, but is absolute nonsense given
the original C. If you follow that code path, it appears to do the
memops without STAC, and then complains it does CLAC. Which is of course
complete crap.

Maybe I've been staring at this too long and am (again) missing the
obvious :/

[-- Attachment #2: randconfig-fail --]
[-- Type: text/plain, Size: 92009 bytes --]

#
# Automatically generated file; DO NOT EDIT.
# Linux/x86 5.0.0-rc8 Kernel Configuration
#

#
# Compiler: gcc-8 (Debian 8.2.0-21) 8.2.0
#
CONFIG_CC_IS_GCC=y
CONFIG_GCC_VERSION=80200
CONFIG_CLANG_VERSION=0
CONFIG_CC_HAS_ASM_GOTO=y
CONFIG_CONSTRUCTORS=y
CONFIG_IRQ_WORK=y
CONFIG_BUILDTIME_EXTABLE_SORT=y
CONFIG_THREAD_INFO_IN_TASK=y

#
# General setup
#
CONFIG_INIT_ENV_ARG_LIMIT=32
# CONFIG_COMPILE_TEST is not set
CONFIG_LOCALVERSION=""
CONFIG_LOCALVERSION_AUTO=y
CONFIG_BUILD_SALT=""
CONFIG_HAVE_KERNEL_GZIP=y
CONFIG_HAVE_KERNEL_BZIP2=y
CONFIG_HAVE_KERNEL_LZMA=y
CONFIG_HAVE_KERNEL_XZ=y
CONFIG_HAVE_KERNEL_LZO=y
CONFIG_HAVE_KERNEL_LZ4=y
CONFIG_KERNEL_GZIP=y
# CONFIG_KERNEL_BZIP2 is not set
# CONFIG_KERNEL_LZMA is not set
# CONFIG_KERNEL_XZ is not set
# CONFIG_KERNEL_LZO is not set
# CONFIG_KERNEL_LZ4 is not set
CONFIG_DEFAULT_HOSTNAME="(none)"
CONFIG_SWAP=y
# CONFIG_SYSVIPC is not set
# CONFIG_CROSS_MEMORY_ATTACH is not set
CONFIG_USELIB=y
CONFIG_HAVE_ARCH_AUDITSYSCALL=y

#
# IRQ subsystem
#
CONFIG_GENERIC_IRQ_PROBE=y
CONFIG_GENERIC_IRQ_SHOW=y
CONFIG_GENERIC_IRQ_EFFECTIVE_AFF_MASK=y
CONFIG_GENERIC_PENDING_IRQ=y
CONFIG_GENERIC_IRQ_MIGRATION=y
CONFIG_GENERIC_IRQ_CHIP=y
CONFIG_IRQ_DOMAIN=y
CONFIG_IRQ_SIM=y
CONFIG_IRQ_DOMAIN_HIERARCHY=y
CONFIG_GENERIC_IRQ_MATRIX_ALLOCATOR=y
CONFIG_GENERIC_IRQ_RESERVATION_MODE=y
CONFIG_IRQ_FORCED_THREADING=y
CONFIG_SPARSE_IRQ=y
# CONFIG_GENERIC_IRQ_DEBUGFS is not set
CONFIG_CLOCKSOURCE_WATCHDOG=y
CONFIG_ARCH_CLOCKSOURCE_DATA=y
CONFIG_ARCH_CLOCKSOURCE_INIT=y
CONFIG_CLOCKSOURCE_VALIDATE_LAST_CYCLE=y
CONFIG_GENERIC_TIME_VSYSCALL=y
CONFIG_GENERIC_CLOCKEVENTS=y
CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y
CONFIG_GENERIC_CLOCKEVENTS_MIN_ADJUST=y
CONFIG_GENERIC_CMOS_UPDATE=y

#
# Timers subsystem
#
CONFIG_TICK_ONESHOT=y
CONFIG_NO_HZ_COMMON=y
# CONFIG_HZ_PERIODIC is not set
# CONFIG_NO_HZ_IDLE is not set
CONFIG_NO_HZ_FULL=y
CONFIG_CONTEXT_TRACKING=y
CONFIG_CONTEXT_TRACKING_FORCE=y
CONFIG_NO_HZ=y
# CONFIG_HIGH_RES_TIMERS is not set
# CONFIG_PREEMPT_NONE is not set
CONFIG_PREEMPT_VOLUNTARY=y
# CONFIG_PREEMPT is not set
CONFIG_PREEMPT_COUNT=y

#
# CPU/Task time and stats accounting
#
CONFIG_VIRT_CPU_ACCOUNTING=y
CONFIG_VIRT_CPU_ACCOUNTING_GEN=y
CONFIG_IRQ_TIME_ACCOUNTING=y
CONFIG_HAVE_SCHED_AVG_IRQ=y
# CONFIG_PSI is not set
CONFIG_CPU_ISOLATION=y

#
# RCU Subsystem
#
CONFIG_TREE_RCU=y
# CONFIG_RCU_EXPERT is not set
CONFIG_SRCU=y
CONFIG_TREE_SRCU=y
CONFIG_TASKS_RCU=y
CONFIG_RCU_STALL_COMMON=y
CONFIG_RCU_NEED_SEGCBLIST=y
CONFIG_RCU_NOCB_CPU=y
CONFIG_BUILD_BIN2C=y
CONFIG_IKCONFIG=y
CONFIG_HAVE_UNSTABLE_SCHED_CLOCK=y
CONFIG_ARCH_SUPPORTS_NUMA_BALANCING=y
CONFIG_ARCH_WANT_BATCHED_UNMAP_TLB_FLUSH=y
CONFIG_ARCH_SUPPORTS_INT128=y
# CONFIG_NUMA_BALANCING is not set
CONFIG_CGROUPS=y
CONFIG_PAGE_COUNTER=y
CONFIG_MEMCG=y
# CONFIG_MEMCG_SWAP is not set
CONFIG_MEMCG_KMEM=y
# CONFIG_BLK_CGROUP is not set
CONFIG_CGROUP_SCHED=y
CONFIG_FAIR_GROUP_SCHED=y
CONFIG_CFS_BANDWIDTH=y
CONFIG_RT_GROUP_SCHED=y
CONFIG_CGROUP_PIDS=y
CONFIG_CGROUP_RDMA=y
CONFIG_CGROUP_FREEZER=y
# CONFIG_CGROUP_HUGETLB is not set
CONFIG_CPUSETS=y
# CONFIG_PROC_PID_CPUSET is not set
# CONFIG_CGROUP_DEVICE is not set
CONFIG_CGROUP_CPUACCT=y
# CONFIG_CGROUP_PERF is not set
# CONFIG_CGROUP_BPF is not set
CONFIG_CGROUP_DEBUG=y
# CONFIG_CHECKPOINT_RESTORE is not set
CONFIG_SCHED_AUTOGROUP=y
# CONFIG_SYSFS_DEPRECATED is not set
# CONFIG_RELAY is not set
# CONFIG_BLK_DEV_INITRD is not set
# CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE is not set
CONFIG_CC_OPTIMIZE_FOR_SIZE=y
CONFIG_ANON_INODES=y
CONFIG_SYSCTL_EXCEPTION_TRACE=y
CONFIG_HAVE_PCSPKR_PLATFORM=y
CONFIG_BPF=y
CONFIG_EXPERT=y
# CONFIG_MULTIUSER is not set
CONFIG_SGETMASK_SYSCALL=y
# CONFIG_SYSFS_SYSCALL is not set
# CONFIG_FHANDLE is not set
CONFIG_POSIX_TIMERS=y
# CONFIG_PRINTK is not set
CONFIG_BUG=y
CONFIG_ELF_CORE=y
CONFIG_PCSPKR_PLATFORM=y
CONFIG_BASE_FULL=y
CONFIG_FUTEX=y
CONFIG_FUTEX_PI=y
# CONFIG_EPOLL is not set
# CONFIG_SIGNALFD is not set
CONFIG_TIMERFD=y
CONFIG_EVENTFD=y
# CONFIG_SHMEM is not set
# CONFIG_AIO is not set
CONFIG_ADVISE_SYSCALLS=y
CONFIG_MEMBARRIER=y
CONFIG_KALLSYMS=y
CONFIG_KALLSYMS_ALL=y
CONFIG_KALLSYMS_ABSOLUTE_PERCPU=y
CONFIG_KALLSYMS_BASE_RELATIVE=y
CONFIG_BPF_SYSCALL=y
# CONFIG_USERFAULTFD is not set
CONFIG_ARCH_HAS_MEMBARRIER_SYNC_CORE=y
CONFIG_RSEQ=y
# CONFIG_DEBUG_RSEQ is not set
CONFIG_EMBEDDED=y
CONFIG_HAVE_PERF_EVENTS=y
CONFIG_PC104=y

#
# Kernel Performance Events And Counters
#
CONFIG_PERF_EVENTS=y
# CONFIG_DEBUG_PERF_USE_VMALLOC is not set
# CONFIG_VM_EVENT_COUNTERS is not set
# CONFIG_COMPAT_BRK is not set
CONFIG_SLAB=y
# CONFIG_SLUB is not set
# CONFIG_SLOB is not set
# CONFIG_SLAB_MERGE_DEFAULT is not set
CONFIG_SLAB_FREELIST_RANDOM=y
CONFIG_SYSTEM_DATA_VERIFICATION=y
# CONFIG_PROFILING is not set
CONFIG_TRACEPOINTS=y
CONFIG_64BIT=y
CONFIG_X86_64=y
CONFIG_X86=y
CONFIG_INSTRUCTION_DECODER=y
CONFIG_OUTPUT_FORMAT="elf64-x86-64"
CONFIG_ARCH_DEFCONFIG="arch/x86/configs/x86_64_defconfig"
CONFIG_LOCKDEP_SUPPORT=y
CONFIG_STACKTRACE_SUPPORT=y
CONFIG_MMU=y
CONFIG_ARCH_MMAP_RND_BITS_MIN=28
CONFIG_ARCH_MMAP_RND_BITS_MAX=32
CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MIN=8
CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MAX=16
CONFIG_GENERIC_BUG=y
CONFIG_GENERIC_BUG_RELATIVE_POINTERS=y
CONFIG_GENERIC_HWEIGHT=y
CONFIG_RWSEM_XCHGADD_ALGORITHM=y
CONFIG_GENERIC_CALIBRATE_DELAY=y
CONFIG_ARCH_HAS_CPU_RELAX=y
CONFIG_ARCH_HAS_CACHE_LINE_SIZE=y
CONFIG_ARCH_HAS_FILTER_PGPROT=y
CONFIG_HAVE_SETUP_PER_CPU_AREA=y
CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK=y
CONFIG_NEED_PER_CPU_PAGE_FIRST_CHUNK=y
CONFIG_ARCH_HIBERNATION_POSSIBLE=y
CONFIG_ARCH_SUSPEND_POSSIBLE=y
CONFIG_ARCH_WANT_HUGE_PMD_SHARE=y
CONFIG_ARCH_WANT_GENERAL_HUGETLB=y
CONFIG_ZONE_DMA32=y
CONFIG_AUDIT_ARCH=y
CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING=y
CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y
CONFIG_X86_64_SMP=y
CONFIG_ARCH_SUPPORTS_UPROBES=y
CONFIG_FIX_EARLYCON_MEM=y
CONFIG_PGTABLE_LEVELS=5
CONFIG_CC_HAS_SANE_STACKPROTECTOR=y

#
# Processor type and features
#
# CONFIG_ZONE_DMA is not set
CONFIG_SMP=y
# CONFIG_X86_FEATURE_NAMES is not set
CONFIG_X86_X2APIC=y
CONFIG_X86_MPPARSE=y
CONFIG_GOLDFISH=y
CONFIG_RETPOLINE=y
# CONFIG_X86_CPU_RESCTRL is not set
CONFIG_X86_EXTENDED_PLATFORM=y
CONFIG_X86_GOLDFISH=y
# CONFIG_SCHED_OMIT_FRAME_POINTER is not set
CONFIG_HYPERVISOR_GUEST=y
CONFIG_PARAVIRT=y
CONFIG_PARAVIRT_DEBUG=y
CONFIG_PARAVIRT_SPINLOCKS=y
# CONFIG_QUEUED_LOCK_STAT is not set
CONFIG_XEN=y
# CONFIG_XEN_PV is not set
CONFIG_XEN_SAVE_RESTORE=y
CONFIG_XEN_DEBUG_FS=y
CONFIG_KVM_GUEST=y
# CONFIG_PVH is not set
# CONFIG_KVM_DEBUG_FS is not set
CONFIG_PARAVIRT_TIME_ACCOUNTING=y
CONFIG_PARAVIRT_CLOCK=y
# CONFIG_MK8 is not set
# CONFIG_MPSC is not set
# CONFIG_MCORE2 is not set
# CONFIG_MATOM is not set
CONFIG_GENERIC_CPU=y
CONFIG_X86_INTERNODE_CACHE_SHIFT=6
CONFIG_X86_L1_CACHE_SHIFT=6
CONFIG_X86_TSC=y
CONFIG_X86_CMPXCHG64=y
CONFIG_X86_CMOV=y
CONFIG_X86_MINIMUM_CPU_FAMILY=64
CONFIG_X86_DEBUGCTLMSR=y
# CONFIG_PROCESSOR_SELECT is not set
CONFIG_CPU_SUP_INTEL=y
CONFIG_CPU_SUP_AMD=y
CONFIG_CPU_SUP_HYGON=y
CONFIG_CPU_SUP_CENTAUR=y
CONFIG_HPET_TIMER=y
CONFIG_HPET_EMULATE_RTC=y
# CONFIG_DMI is not set
CONFIG_MAXSMP=y
CONFIG_NR_CPUS_RANGE_BEGIN=8192
CONFIG_NR_CPUS_RANGE_END=8192
CONFIG_NR_CPUS_DEFAULT=8192
CONFIG_NR_CPUS=8192
CONFIG_SCHED_SMT=y
CONFIG_SCHED_MC=y
# CONFIG_SCHED_MC_PRIO is not set
CONFIG_X86_LOCAL_APIC=y
CONFIG_X86_IO_APIC=y
# CONFIG_X86_REROUTE_FOR_BROKEN_BOOT_IRQS is not set
# CONFIG_X86_MCE is not set

#
# Performance monitoring
#
# CONFIG_PERF_EVENTS_AMD_POWER is not set
CONFIG_X86_16BIT=y
CONFIG_X86_ESPFIX64=y
CONFIG_X86_VSYSCALL_EMULATION=y
# CONFIG_I8K is not set
# CONFIG_MICROCODE is not set
CONFIG_X86_MSR=y
# CONFIG_X86_CPUID is not set
CONFIG_X86_5LEVEL=y
CONFIG_X86_DIRECT_GBPAGES=y
CONFIG_X86_CPA_STATISTICS=y
CONFIG_ARCH_HAS_MEM_ENCRYPT=y
# CONFIG_AMD_MEM_ENCRYPT is not set
CONFIG_NUMA=y
CONFIG_NUMA_EMU=y
CONFIG_NODES_SHIFT=10
CONFIG_ARCH_SPARSEMEM_ENABLE=y
CONFIG_ARCH_SPARSEMEM_DEFAULT=y
CONFIG_ARCH_SELECT_MEMORY_MODEL=y
CONFIG_ARCH_MEMORY_PROBE=y
CONFIG_ILLEGAL_POINTER_VALUE=0xdead000000000000
CONFIG_X86_PMEM_LEGACY_DEVICE=y
CONFIG_X86_PMEM_LEGACY=m
# CONFIG_X86_CHECK_BIOS_CORRUPTION is not set
CONFIG_X86_RESERVE_LOW=64
CONFIG_MTRR=y
# CONFIG_MTRR_SANITIZER is not set
# CONFIG_X86_PAT is not set
CONFIG_ARCH_RANDOM=y
CONFIG_X86_SMAP=y
# CONFIG_X86_INTEL_UMIP is not set
CONFIG_X86_INTEL_MPX=y
# CONFIG_X86_INTEL_MEMORY_PROTECTION_KEYS is not set
# CONFIG_SECCOMP is not set
# CONFIG_HZ_100 is not set
# CONFIG_HZ_250 is not set
# CONFIG_HZ_300 is not set
CONFIG_HZ_1000=y
CONFIG_HZ=1000
CONFIG_KEXEC=y
# CONFIG_KEXEC_FILE is not set
CONFIG_CRASH_DUMP=y
CONFIG_KEXEC_JUMP=y
CONFIG_PHYSICAL_START=0x1000000
# CONFIG_RELOCATABLE is not set
CONFIG_PHYSICAL_ALIGN=0x200000
CONFIG_DYNAMIC_MEMORY_LAYOUT=y
CONFIG_HOTPLUG_CPU=y
# CONFIG_BOOTPARAM_HOTPLUG_CPU0 is not set
# CONFIG_DEBUG_HOTPLUG_CPU0 is not set
# CONFIG_LEGACY_VSYSCALL_EMULATE is not set
CONFIG_LEGACY_VSYSCALL_NONE=y
# CONFIG_CMDLINE_BOOL is not set
CONFIG_MODIFY_LDT_SYSCALL=y
CONFIG_HAVE_LIVEPATCH=y
CONFIG_ARCH_HAS_ADD_PAGES=y
CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
CONFIG_USE_PERCPU_NUMA_NODE_ID=y
CONFIG_ARCH_ENABLE_SPLIT_PMD_PTLOCK=y
CONFIG_ARCH_ENABLE_HUGEPAGE_MIGRATION=y
CONFIG_ARCH_ENABLE_THP_MIGRATION=y

#
# Power management and ACPI options
#
CONFIG_ARCH_HIBERNATION_HEADER=y
# CONFIG_SUSPEND is not set
CONFIG_HIBERNATE_CALLBACKS=y
CONFIG_HIBERNATION=y
CONFIG_PM_STD_PARTITION=""
CONFIG_PM_SLEEP=y
CONFIG_PM_SLEEP_SMP=y
CONFIG_PM_AUTOSLEEP=y
CONFIG_PM_WAKELOCKS=y
CONFIG_PM_WAKELOCKS_LIMIT=100
CONFIG_PM_WAKELOCKS_GC=y
CONFIG_PM=y
CONFIG_PM_DEBUG=y
CONFIG_PM_ADVANCED_DEBUG=y
CONFIG_PM_SLEEP_DEBUG=y
# CONFIG_PM_TRACE_RTC is not set
CONFIG_WQ_POWER_EFFICIENT_DEFAULT=y
CONFIG_ENERGY_MODEL=y
CONFIG_ARCH_SUPPORTS_ACPI=y
# CONFIG_ACPI is not set
# CONFIG_SFI is not set

#
# CPU Frequency scaling
#
CONFIG_CPU_FREQ=y
CONFIG_CPU_FREQ_GOV_ATTR_SET=y
CONFIG_CPU_FREQ_GOV_COMMON=y
CONFIG_CPU_FREQ_STAT=y
# CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE is not set
# CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE is not set
# CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set
CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y
# CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE is not set
# CONFIG_CPU_FREQ_DEFAULT_GOV_SCHEDUTIL is not set
CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
CONFIG_CPU_FREQ_GOV_POWERSAVE=m
# CONFIG_CPU_FREQ_GOV_USERSPACE is not set
CONFIG_CPU_FREQ_GOV_ONDEMAND=y
# CONFIG_CPU_FREQ_GOV_CONSERVATIVE is not set
# CONFIG_CPU_FREQ_GOV_SCHEDUTIL is not set

#
# CPU frequency scaling drivers
#
CONFIG_X86_INTEL_PSTATE=y
# CONFIG_X86_P4_CLOCKMOD is not set

#
# shared options
#

#
# CPU Idle
#
# CONFIG_CPU_IDLE is not set

#
# Bus options (PCI etc.)
#
# CONFIG_ISA_BUS is not set
# CONFIG_ISA_DMA_API is not set
CONFIG_X86_SYSFB=y

#
# Binary Emulations
#
# CONFIG_IA32_EMULATION is not set
# CONFIG_X86_X32 is not set
CONFIG_X86_DEV_DMA_OPS=y
CONFIG_HAVE_GENERIC_GUP=y

#
# Firmware Drivers
#
CONFIG_EDD=m
# CONFIG_EDD_OFF is not set
CONFIG_FIRMWARE_MEMMAP=y
CONFIG_FW_CFG_SYSFS=m
CONFIG_FW_CFG_SYSFS_CMDLINE=y
CONFIG_GOOGLE_FIRMWARE=y
CONFIG_EFI_EARLYCON=y

#
# Tegra firmware driver
#
CONFIG_HAVE_KVM=y
# CONFIG_VIRTUALIZATION is not set

#
# General architecture-dependent options
#
CONFIG_CRASH_CORE=y
CONFIG_KEXEC_CORE=y
CONFIG_HOTPLUG_SMT=y
CONFIG_HAVE_OPROFILE=y
CONFIG_OPROFILE_NMI_TIMER=y
CONFIG_KPROBES=y
CONFIG_JUMP_LABEL=y
# CONFIG_STATIC_KEYS_SELFTEST is not set
CONFIG_OPTPROBES=y
CONFIG_UPROBES=y
CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y
CONFIG_ARCH_USE_BUILTIN_BSWAP=y
CONFIG_KRETPROBES=y
CONFIG_HAVE_IOREMAP_PROT=y
CONFIG_HAVE_KPROBES=y
CONFIG_HAVE_KRETPROBES=y
CONFIG_HAVE_OPTPROBES=y
CONFIG_HAVE_KPROBES_ON_FTRACE=y
CONFIG_HAVE_FUNCTION_ERROR_INJECTION=y
CONFIG_HAVE_NMI=y
CONFIG_HAVE_ARCH_TRACEHOOK=y
CONFIG_HAVE_DMA_CONTIGUOUS=y
CONFIG_GENERIC_SMP_IDLE_THREAD=y
CONFIG_ARCH_HAS_FORTIFY_SOURCE=y
CONFIG_ARCH_HAS_SET_MEMORY=y
CONFIG_HAVE_ARCH_THREAD_STRUCT_WHITELIST=y
CONFIG_ARCH_WANTS_DYNAMIC_TASK_STRUCT=y
CONFIG_HAVE_REGS_AND_STACK_ACCESS_API=y
CONFIG_HAVE_RSEQ=y
CONFIG_HAVE_FUNCTION_ARG_ACCESS_API=y
CONFIG_HAVE_HW_BREAKPOINT=y
CONFIG_HAVE_MIXED_BREAKPOINTS_REGS=y
CONFIG_HAVE_USER_RETURN_NOTIFIER=y
CONFIG_HAVE_PERF_EVENTS_NMI=y
CONFIG_HAVE_HARDLOCKUP_DETECTOR_PERF=y
CONFIG_HAVE_PERF_REGS=y
CONFIG_HAVE_PERF_USER_STACK_DUMP=y
CONFIG_HAVE_ARCH_JUMP_LABEL=y
CONFIG_HAVE_ARCH_JUMP_LABEL_RELATIVE=y
CONFIG_HAVE_RCU_TABLE_FREE=y
CONFIG_HAVE_RCU_TABLE_INVALIDATE=y
CONFIG_ARCH_HAVE_NMI_SAFE_CMPXCHG=y
CONFIG_HAVE_CMPXCHG_LOCAL=y
CONFIG_HAVE_CMPXCHG_DOUBLE=y
CONFIG_HAVE_ARCH_SECCOMP_FILTER=y
CONFIG_HAVE_ARCH_STACKLEAK=y
CONFIG_HAVE_STACKPROTECTOR=y
CONFIG_CC_HAS_STACKPROTECTOR_NONE=y
# CONFIG_STACKPROTECTOR is not set
CONFIG_HAVE_ARCH_WITHIN_STACK_FRAMES=y
CONFIG_HAVE_CONTEXT_TRACKING=y
CONFIG_HAVE_VIRT_CPU_ACCOUNTING_GEN=y
CONFIG_HAVE_IRQ_TIME_ACCOUNTING=y
CONFIG_HAVE_MOVE_PMD=y
CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE=y
CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD=y
CONFIG_HAVE_ARCH_HUGE_VMAP=y
CONFIG_HAVE_ARCH_SOFT_DIRTY=y
CONFIG_HAVE_MOD_ARCH_SPECIFIC=y
CONFIG_MODULES_USE_ELF_RELA=y
CONFIG_HAVE_IRQ_EXIT_ON_IRQ_STACK=y
CONFIG_ARCH_HAS_ELF_RANDOMIZE=y
CONFIG_HAVE_ARCH_MMAP_RND_BITS=y
CONFIG_HAVE_EXIT_THREAD=y
CONFIG_ARCH_MMAP_RND_BITS=28
CONFIG_HAVE_COPY_THREAD_TLS=y
CONFIG_HAVE_STACK_VALIDATION=y
CONFIG_HAVE_RELIABLE_STACKTRACE=y
CONFIG_ISA_BUS_API=y
CONFIG_HAVE_ARCH_VMAP_STACK=y
# CONFIG_VMAP_STACK is not set
CONFIG_ARCH_HAS_STRICT_KERNEL_RWX=y
CONFIG_STRICT_KERNEL_RWX=y
CONFIG_ARCH_HAS_STRICT_MODULE_RWX=y
CONFIG_STRICT_MODULE_RWX=y
CONFIG_ARCH_HAS_REFCOUNT=y
CONFIG_REFCOUNT_FULL=y
CONFIG_HAVE_ARCH_PREL32_RELOCATIONS=y
CONFIG_ARCH_USE_MEMREMAP_PROT=y

#
# GCOV-based kernel profiling
#
CONFIG_GCOV_KERNEL=y
CONFIG_ARCH_HAS_GCOV_PROFILE_ALL=y
# CONFIG_GCOV_PROFILE_ALL is not set
CONFIG_GCOV_FORMAT_4_7=y
CONFIG_PLUGIN_HOSTCC=""
CONFIG_HAVE_GCC_PLUGINS=y
CONFIG_RT_MUTEXES=y
CONFIG_BASE_SMALL=0
CONFIG_MODULES=y
# CONFIG_MODULE_FORCE_LOAD is not set
CONFIG_MODULE_UNLOAD=y
# CONFIG_MODULE_FORCE_UNLOAD is not set
# CONFIG_MODVERSIONS is not set
CONFIG_MODULE_SRCVERSION_ALL=y
CONFIG_MODULE_SIG=y
CONFIG_MODULE_SIG_FORCE=y
# CONFIG_MODULE_SIG_ALL is not set

#
# Do not forget to sign required modules with scripts/sign-file
#
# CONFIG_MODULE_SIG_SHA1 is not set
# CONFIG_MODULE_SIG_SHA224 is not set
CONFIG_MODULE_SIG_SHA256=y
# CONFIG_MODULE_SIG_SHA384 is not set
# CONFIG_MODULE_SIG_SHA512 is not set
CONFIG_MODULE_SIG_HASH="sha256"
CONFIG_MODULE_COMPRESS=y
# CONFIG_MODULE_COMPRESS_GZIP is not set
CONFIG_MODULE_COMPRESS_XZ=y
CONFIG_MODULES_TREE_LOOKUP=y
CONFIG_BLOCK=y
CONFIG_BLK_SCSI_REQUEST=y
CONFIG_BLK_DEV_BSG=y
CONFIG_BLK_DEV_BSGLIB=y
CONFIG_BLK_DEV_INTEGRITY=y
# CONFIG_BLK_DEV_ZONED is not set
CONFIG_BLK_CMDLINE_PARSER=y
# CONFIG_BLK_WBT is not set
# CONFIG_BLK_DEBUG_FS is not set
CONFIG_BLK_SED_OPAL=y

#
# Partition Types
#
CONFIG_PARTITION_ADVANCED=y
# CONFIG_ACORN_PARTITION is not set
# CONFIG_AIX_PARTITION is not set
# CONFIG_OSF_PARTITION is not set
# CONFIG_AMIGA_PARTITION is not set
# CONFIG_ATARI_PARTITION is not set
CONFIG_MAC_PARTITION=y
CONFIG_MSDOS_PARTITION=y
CONFIG_BSD_DISKLABEL=y
# CONFIG_MINIX_SUBPARTITION is not set
CONFIG_SOLARIS_X86_PARTITION=y
# CONFIG_UNIXWARE_DISKLABEL is not set
CONFIG_LDM_PARTITION=y
# CONFIG_LDM_DEBUG is not set
CONFIG_SGI_PARTITION=y
# CONFIG_ULTRIX_PARTITION is not set
# CONFIG_SUN_PARTITION is not set
CONFIG_KARMA_PARTITION=y
CONFIG_EFI_PARTITION=y
# CONFIG_SYSV68_PARTITION is not set
# CONFIG_CMDLINE_PARTITION is not set
CONFIG_BLK_MQ_VIRTIO=y
CONFIG_BLK_PM=y

#
# IO Schedulers
#
# CONFIG_MQ_IOSCHED_DEADLINE is not set
CONFIG_MQ_IOSCHED_KYBER=y
CONFIG_IOSCHED_BFQ=y
CONFIG_PADATA=y
CONFIG_ASN1=y
CONFIG_UNINLINE_SPIN_UNLOCK=y
CONFIG_ARCH_SUPPORTS_ATOMIC_RMW=y
CONFIG_MUTEX_SPIN_ON_OWNER=y
CONFIG_RWSEM_SPIN_ON_OWNER=y
CONFIG_LOCK_SPIN_ON_OWNER=y
CONFIG_ARCH_USE_QUEUED_SPINLOCKS=y
CONFIG_QUEUED_SPINLOCKS=y
CONFIG_ARCH_USE_QUEUED_RWLOCKS=y
CONFIG_QUEUED_RWLOCKS=y
CONFIG_ARCH_HAS_SYNC_CORE_BEFORE_USERMODE=y
CONFIG_ARCH_HAS_SYSCALL_WRAPPER=y
CONFIG_FREEZER=y

#
# Executable file formats
#
CONFIG_BINFMT_ELF=y
CONFIG_ELFCORE=y
CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS=y
CONFIG_BINFMT_SCRIPT=y
# CONFIG_BINFMT_MISC is not set
CONFIG_COREDUMP=y

#
# Memory Management options
#
CONFIG_SELECT_MEMORY_MODEL=y
CONFIG_SPARSEMEM_MANUAL=y
CONFIG_SPARSEMEM=y
CONFIG_NEED_MULTIPLE_NODES=y
CONFIG_HAVE_MEMORY_PRESENT=y
CONFIG_SPARSEMEM_EXTREME=y
CONFIG_SPARSEMEM_VMEMMAP_ENABLE=y
CONFIG_SPARSEMEM_VMEMMAP=y
CONFIG_HAVE_MEMBLOCK_NODE_MAP=y
CONFIG_ARCH_DISCARD_MEMBLOCK=y
CONFIG_MEMORY_HOTPLUG=y
CONFIG_MEMORY_HOTPLUG_SPARSE=y
# CONFIG_MEMORY_HOTPLUG_DEFAULT_ONLINE is not set
# CONFIG_MEMORY_HOTREMOVE is not set
CONFIG_SPLIT_PTLOCK_CPUS=4
CONFIG_MEMORY_BALLOON=y
CONFIG_BALLOON_COMPACTION=y
CONFIG_COMPACTION=y
CONFIG_MIGRATION=y
CONFIG_PHYS_ADDR_T_64BIT=y
CONFIG_VIRT_TO_BUS=y
CONFIG_MMU_NOTIFIER=y
CONFIG_KSM=y
CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
CONFIG_TRANSPARENT_HUGEPAGE=y
CONFIG_TRANSPARENT_HUGEPAGE_ALWAYS=y
# CONFIG_TRANSPARENT_HUGEPAGE_MADVISE is not set
CONFIG_ARCH_WANTS_THP_SWAP=y
CONFIG_THP_SWAP=y
CONFIG_TRANSPARENT_HUGE_PAGECACHE=y
# CONFIG_CLEANCACHE is not set
CONFIG_FRONTSWAP=y
# CONFIG_CMA is not set
CONFIG_ZSWAP=y
CONFIG_ZPOOL=y
CONFIG_ZBUD=y
CONFIG_Z3FOLD=m
# CONFIG_ZSMALLOC is not set
CONFIG_GENERIC_EARLY_IOREMAP=y
CONFIG_DEFERRED_STRUCT_PAGE_INIT=y
CONFIG_IDLE_PAGE_TRACKING=y
CONFIG_ARCH_HAS_ZONE_DEVICE=y
CONFIG_ARCH_USES_HIGH_VMA_FLAGS=y
CONFIG_PERCPU_STATS=y
# CONFIG_GUP_BENCHMARK is not set
CONFIG_ARCH_HAS_PTE_SPECIAL=y
# CONFIG_NET is not set
CONFIG_HAVE_EBPF_JIT=y

#
# Device Drivers
#
CONFIG_HAVE_EISA=y
CONFIG_EISA=y
CONFIG_EISA_VLB_PRIMING=y
CONFIG_EISA_VIRTUAL_ROOT=y
# CONFIG_EISA_NAMES is not set
CONFIG_HAVE_PCI=y
# CONFIG_PCI is not set
CONFIG_PCCARD=y
# CONFIG_PCMCIA is not set

#
# PC-card bridges
#

#
# Generic Driver Options
#
CONFIG_UEVENT_HELPER=y
CONFIG_UEVENT_HELPER_PATH=""
# CONFIG_DEVTMPFS is not set
CONFIG_STANDALONE=y
CONFIG_PREVENT_FIRMWARE_BUILD=y

#
# Firmware loader
#
CONFIG_FW_LOADER=y
CONFIG_EXTRA_FIRMWARE=""
CONFIG_FW_LOADER_USER_HELPER=y
# CONFIG_FW_LOADER_USER_HELPER_FALLBACK is not set
CONFIG_WANT_DEV_COREDUMP=y
# CONFIG_ALLOW_DEV_COREDUMP is not set
CONFIG_DEBUG_DRIVER=y
CONFIG_DEBUG_DEVRES=y
CONFIG_DEBUG_TEST_DRIVER_REMOVE=y
CONFIG_TEST_ASYNC_DRIVER_PROBE=m
CONFIG_SYS_HYPERVISOR=y
CONFIG_GENERIC_CPU_AUTOPROBE=y
CONFIG_GENERIC_CPU_VULNERABILITIES=y
CONFIG_REGMAP=y
CONFIG_REGMAP_I2C=y
CONFIG_REGMAP_SPI=y
CONFIG_REGMAP_W1=m
CONFIG_REGMAP_MMIO=y
CONFIG_REGMAP_IRQ=y
CONFIG_DMA_SHARED_BUFFER=y
CONFIG_DMA_FENCE_TRACE=y

#
# Bus devices
#
CONFIG_GNSS=y
# CONFIG_GNSS_SIRF_SERIAL is not set
# CONFIG_GNSS_UBX_SERIAL is not set
CONFIG_MTD=m
CONFIG_MTD_TESTS=m
CONFIG_MTD_CMDLINE_PARTS=m
CONFIG_MTD_AR7_PARTS=m

#
# Partition parsers
#
CONFIG_MTD_REDBOOT_PARTS=m
CONFIG_MTD_REDBOOT_DIRECTORY_BLOCK=-1
# CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED is not set
# CONFIG_MTD_REDBOOT_PARTS_READONLY is not set

#
# User Modules And Translation Layers
#
CONFIG_MTD_BLKDEVS=m
# CONFIG_MTD_BLOCK is not set
CONFIG_MTD_BLOCK_RO=m
# CONFIG_FTL is not set
CONFIG_NFTL=m
CONFIG_NFTL_RW=y
# CONFIG_INFTL is not set
# CONFIG_RFD_FTL is not set
# CONFIG_SSFDC is not set
# CONFIG_SM_FTL is not set
# CONFIG_MTD_OOPS is not set
CONFIG_MTD_SWAP=m
# CONFIG_MTD_PARTITIONED_MASTER is not set

#
# RAM/ROM/Flash chip drivers
#
CONFIG_MTD_CFI=m
CONFIG_MTD_JEDECPROBE=m
CONFIG_MTD_GEN_PROBE=m
# CONFIG_MTD_CFI_ADV_OPTIONS is not set
CONFIG_MTD_MAP_BANK_WIDTH_1=y
CONFIG_MTD_MAP_BANK_WIDTH_2=y
CONFIG_MTD_MAP_BANK_WIDTH_4=y
CONFIG_MTD_CFI_I1=y
CONFIG_MTD_CFI_I2=y
CONFIG_MTD_CFI_INTELEXT=m
CONFIG_MTD_CFI_AMDSTD=m
CONFIG_MTD_CFI_STAA=m
CONFIG_MTD_CFI_UTIL=m
CONFIG_MTD_RAM=m
# CONFIG_MTD_ROM is not set
# CONFIG_MTD_ABSENT is not set

#
# Mapping drivers for chip access
#
# CONFIG_MTD_COMPLEX_MAPPINGS is not set
CONFIG_MTD_PHYSMAP=m
CONFIG_MTD_PHYSMAP_COMPAT=y
CONFIG_MTD_PHYSMAP_START=0x8000000
CONFIG_MTD_PHYSMAP_LEN=0
CONFIG_MTD_PHYSMAP_BANKWIDTH=2
# CONFIG_MTD_AMD76XROM is not set
CONFIG_MTD_ICHXROM=m
CONFIG_MTD_NETtel=m
CONFIG_MTD_L440GX=m
# CONFIG_MTD_PLATRAM is not set

#
# Self-contained MTD device drivers
#
# CONFIG_MTD_DATAFLASH is not set
CONFIG_MTD_M25P80=m
# CONFIG_MTD_MCHP23K256 is not set
CONFIG_MTD_SST25L=m
CONFIG_MTD_SLRAM=m
# CONFIG_MTD_PHRAM is not set
CONFIG_MTD_MTDRAM=m
CONFIG_MTDRAM_TOTAL_SIZE=4096
CONFIG_MTDRAM_ERASE_SIZE=128
CONFIG_MTD_BLOCK2MTD=m

#
# Disk-On-Chip Device Drivers
#
# CONFIG_MTD_DOCG3 is not set
CONFIG_MTD_NAND_CORE=m
CONFIG_MTD_ONENAND=m
# CONFIG_MTD_ONENAND_VERIFY_WRITE is not set
# CONFIG_MTD_ONENAND_GENERIC is not set
CONFIG_MTD_ONENAND_OTP=y
CONFIG_MTD_ONENAND_2X_PROGRAM=y
CONFIG_MTD_NAND_ECC=m
CONFIG_MTD_NAND_ECC_SMC=y
CONFIG_MTD_NAND=m
# CONFIG_MTD_NAND_ECC_BCH is not set
CONFIG_MTD_NAND_GPIO=m
# CONFIG_MTD_NAND_DISKONCHIP is not set
CONFIG_MTD_NAND_NANDSIM=m
# CONFIG_MTD_NAND_PLATFORM is not set
CONFIG_MTD_SPI_NAND=m

#
# LPDDR & LPDDR2 PCM memory drivers
#
CONFIG_MTD_LPDDR=m
CONFIG_MTD_QINFO_PROBE=m
CONFIG_MTD_SPI_NOR=m
# CONFIG_MTD_MT81xx_NOR is not set
# CONFIG_MTD_SPI_NOR_USE_4K_SECTORS is not set
CONFIG_SPI_INTEL_SPI=m
CONFIG_SPI_INTEL_SPI_PLATFORM=m
CONFIG_MTD_UBI=m
CONFIG_MTD_UBI_WL_THRESHOLD=4096
CONFIG_MTD_UBI_BEB_LIMIT=20
# CONFIG_MTD_UBI_FASTMAP is not set
CONFIG_MTD_UBI_GLUEBI=m
CONFIG_MTD_UBI_BLOCK=y
# CONFIG_OF is not set
CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y
CONFIG_PARPORT=y
# CONFIG_PARPORT_PC is not set
CONFIG_PARPORT_AX88796=m
# CONFIG_PARPORT_1284 is not set
CONFIG_PARPORT_NOT_PC=y
CONFIG_BLK_DEV=y
CONFIG_BLK_DEV_NULL_BLK=m
CONFIG_CDROM=y
CONFIG_BLK_DEV_LOOP=y
CONFIG_BLK_DEV_LOOP_MIN_COUNT=8
CONFIG_BLK_DEV_CRYPTOLOOP=y

#
# DRBD disabled because PROC_FS or INET not selected
#
CONFIG_BLK_DEV_RAM=y
CONFIG_BLK_DEV_RAM_COUNT=16
CONFIG_BLK_DEV_RAM_SIZE=4096
CONFIG_CDROM_PKTCDVD=m
CONFIG_CDROM_PKTCDVD_BUFFERS=8
CONFIG_CDROM_PKTCDVD_WCACHE=y
# CONFIG_XEN_BLKDEV_FRONTEND is not set
# CONFIG_VIRTIO_BLK is not set

#
# NVME Support
#
CONFIG_NVME_CORE=m
CONFIG_NVME_MULTIPATH=y
CONFIG_NVME_FABRICS=m
CONFIG_NVME_FC=m
# CONFIG_NVME_TARGET is not set

#
# Misc devices
#
CONFIG_SENSORS_LIS3LV02D=m
CONFIG_AD525X_DPOT=y
CONFIG_AD525X_DPOT_I2C=y
CONFIG_AD525X_DPOT_SPI=y
# CONFIG_DUMMY_IRQ is not set
# CONFIG_ICS932S401 is not set
# CONFIG_ENCLOSURE_SERVICES is not set
CONFIG_APDS9802ALS=y
CONFIG_ISL29003=y
CONFIG_ISL29020=m
# CONFIG_SENSORS_TSL2550 is not set
CONFIG_SENSORS_BH1770=y
# CONFIG_SENSORS_APDS990X is not set
CONFIG_HMC6352=y
# CONFIG_DS1682 is not set
CONFIG_USB_SWITCH_FSA9480=y
CONFIG_LATTICE_ECP3_CONFIG=y
CONFIG_SRAM=y
# CONFIG_C2PORT is not set

#
# EEPROM support
#
CONFIG_EEPROM_AT24=m
CONFIG_EEPROM_AT25=y
CONFIG_EEPROM_LEGACY=m
# CONFIG_EEPROM_MAX6875 is not set
# CONFIG_EEPROM_93CX6 is not set
# CONFIG_EEPROM_93XX46 is not set
CONFIG_EEPROM_IDT_89HPESX=y
CONFIG_EEPROM_EE1004=m

#
# Texas Instruments shared transport line discipline
#
CONFIG_SENSORS_LIS3_SPI=m
# CONFIG_SENSORS_LIS3_I2C is not set
CONFIG_ALTERA_STAPL=y

#
# Intel MIC & related support
#

#
# Intel MIC Bus Driver
#

#
# SCIF Bus Driver
#

#
# VOP Bus Driver
#

#
# Intel MIC Host Driver
#

#
# Intel MIC Card Driver
#

#
# SCIF Driver
#

#
# Intel MIC Coprocessor State Management (COSM) Drivers
#

#
# VOP Driver
#
# CONFIG_ECHO is not set
CONFIG_HAVE_IDE=y
CONFIG_IDE=y

#
# Please see Documentation/ide/ide.txt for help/info on IDE drives
#
CONFIG_IDE_XFER_MODE=y
CONFIG_IDE_TIMINGS=y
CONFIG_IDE_ATAPI=y
# CONFIG_BLK_DEV_IDE_SATA is not set
CONFIG_IDE_GD=m
CONFIG_IDE_GD_ATA=y
CONFIG_IDE_GD_ATAPI=y
# CONFIG_BLK_DEV_IDECD is not set
CONFIG_BLK_DEV_IDETAPE=y
CONFIG_IDE_TASK_IOCTL=y

#
# IDE chipset support/bugfixes
#
# CONFIG_IDE_GENERIC is not set
CONFIG_BLK_DEV_PLATFORM=m
CONFIG_BLK_DEV_CMD640=y
# CONFIG_BLK_DEV_CMD640_ENHANCED is not set

#
# SCSI device support
#
CONFIG_SCSI_MOD=y
# CONFIG_RAID_ATTRS is not set
CONFIG_SCSI=y
CONFIG_SCSI_DMA=y

#
# SCSI support type (disk, tape, CD-ROM)
#
# CONFIG_BLK_DEV_SD is not set
# CONFIG_CHR_DEV_ST is not set
CONFIG_CHR_DEV_OSST=m
CONFIG_BLK_DEV_SR=y
# CONFIG_BLK_DEV_SR_VENDOR is not set
CONFIG_CHR_DEV_SG=y
# CONFIG_CHR_DEV_SCH is not set
# CONFIG_SCSI_CONSTANTS is not set
CONFIG_SCSI_LOGGING=y
CONFIG_SCSI_SCAN_ASYNC=y

#
# SCSI Transports
#
CONFIG_SCSI_SPI_ATTRS=y
CONFIG_SCSI_SAS_ATTRS=y
CONFIG_SCSI_SAS_LIBSAS=y
CONFIG_SCSI_SAS_ATA=y
CONFIG_SCSI_SAS_HOST_SMP=y
CONFIG_SCSI_SRP_ATTRS=y
CONFIG_SCSI_LOWLEVEL=y
CONFIG_ISCSI_BOOT_SYSFS=y
# CONFIG_SCSI_AHA1740 is not set
CONFIG_SCSI_AIC7XXX=m
CONFIG_AIC7XXX_CMDS_PER_DEVICE=32
CONFIG_AIC7XXX_RESET_DELAY_MS=5000
CONFIG_AIC7XXX_DEBUG_ENABLE=y
CONFIG_AIC7XXX_DEBUG_MASK=0
CONFIG_AIC7XXX_REG_PRETTY_PRINT=y
CONFIG_SCSI_ADVANSYS=m
CONFIG_SCSI_UFSHCD=m
# CONFIG_SCSI_UFSHCD_PLATFORM is not set
# CONFIG_SCSI_UFS_BSG is not set
CONFIG_XEN_SCSI_FRONTEND=m
CONFIG_SCSI_SIM710=m
CONFIG_SCSI_DEBUG=y
CONFIG_SCSI_VIRTIO=y
CONFIG_SCSI_DH=y
CONFIG_SCSI_DH_RDAC=m
# CONFIG_SCSI_DH_HP_SW is not set
# CONFIG_SCSI_DH_EMC is not set
CONFIG_SCSI_DH_ALUA=m
CONFIG_SCSI_OSD_INITIATOR=y
CONFIG_SCSI_OSD_ULD=y
CONFIG_SCSI_OSD_DPRINT_SENSE=1
CONFIG_SCSI_OSD_DEBUG=y
CONFIG_ATA=y
# CONFIG_ATA_VERBOSE_ERROR is not set
CONFIG_SATA_PMP=y

#
# Controllers with non-SFF native interface
#
# CONFIG_SATA_AHCI_PLATFORM is not set
CONFIG_ATA_SFF=y

#
# SFF controllers with custom DMA interface
#
# CONFIG_ATA_BMDMA is not set

#
# PIO-only SFF controllers
#
CONFIG_PATA_PLATFORM=m

#
# Generic fallback / legacy drivers
#
# CONFIG_MD is not set
# CONFIG_TARGET_CORE is not set
# CONFIG_MACINTOSH_DRIVERS is not set
# CONFIG_NVM is not set

#
# Input device support
#
CONFIG_INPUT=y
# CONFIG_INPUT_LEDS is not set
CONFIG_INPUT_FF_MEMLESS=y
CONFIG_INPUT_POLLDEV=y
CONFIG_INPUT_SPARSEKMAP=y
CONFIG_INPUT_MATRIXKMAP=y

#
# Userland interfaces
#
CONFIG_INPUT_MOUSEDEV=y
# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
# CONFIG_INPUT_JOYDEV is not set
# CONFIG_INPUT_EVDEV is not set
CONFIG_INPUT_EVBUG=y

#
# Input Device Drivers
#
CONFIG_INPUT_KEYBOARD=y
# CONFIG_KEYBOARD_ADC is not set
# CONFIG_KEYBOARD_ADP5588 is not set
CONFIG_KEYBOARD_ADP5589=y
# CONFIG_KEYBOARD_ATKBD is not set
CONFIG_KEYBOARD_QT1070=m
CONFIG_KEYBOARD_QT2160=m
# CONFIG_KEYBOARD_DLINK_DIR685 is not set
CONFIG_KEYBOARD_LKKBD=y
CONFIG_KEYBOARD_GPIO=y
CONFIG_KEYBOARD_GPIO_POLLED=m
CONFIG_KEYBOARD_TCA6416=m
CONFIG_KEYBOARD_TCA8418=y
# CONFIG_KEYBOARD_MATRIX is not set
CONFIG_KEYBOARD_LM8323=y
# CONFIG_KEYBOARD_LM8333 is not set
# CONFIG_KEYBOARD_MAX7359 is not set
CONFIG_KEYBOARD_MCS=y
# CONFIG_KEYBOARD_MPR121 is not set
# CONFIG_KEYBOARD_NEWTON is not set
CONFIG_KEYBOARD_OPENCORES=m
CONFIG_KEYBOARD_GOLDFISH_EVENTS=y
CONFIG_KEYBOARD_STOWAWAY=y
CONFIG_KEYBOARD_SUNKBD=m
# CONFIG_KEYBOARD_TM2_TOUCHKEY is not set
CONFIG_KEYBOARD_XTKBD=y
CONFIG_INPUT_MOUSE=y
CONFIG_MOUSE_PS2=m
CONFIG_MOUSE_PS2_ALPS=y
CONFIG_MOUSE_PS2_BYD=y
CONFIG_MOUSE_PS2_LOGIPS2PP=y
# CONFIG_MOUSE_PS2_SYNAPTICS is not set
# CONFIG_MOUSE_PS2_SYNAPTICS_SMBUS is not set
# CONFIG_MOUSE_PS2_CYPRESS is not set
# CONFIG_MOUSE_PS2_TRACKPOINT is not set
CONFIG_MOUSE_PS2_ELANTECH=y
CONFIG_MOUSE_PS2_ELANTECH_SMBUS=y
CONFIG_MOUSE_PS2_SENTELIC=y
CONFIG_MOUSE_PS2_TOUCHKIT=y
CONFIG_MOUSE_PS2_FOCALTECH=y
# CONFIG_MOUSE_PS2_VMMOUSE is not set
CONFIG_MOUSE_PS2_SMBUS=y
CONFIG_MOUSE_SERIAL=m
CONFIG_MOUSE_CYAPA=y
CONFIG_MOUSE_ELAN_I2C=y
CONFIG_MOUSE_ELAN_I2C_I2C=y
CONFIG_MOUSE_ELAN_I2C_SMBUS=y
CONFIG_MOUSE_VSXXXAA=y
CONFIG_MOUSE_GPIO=m
# CONFIG_MOUSE_SYNAPTICS_I2C is not set
# CONFIG_INPUT_JOYSTICK is not set
# CONFIG_INPUT_TABLET is not set
CONFIG_INPUT_TOUCHSCREEN=y
CONFIG_TOUCHSCREEN_PROPERTIES=y
# CONFIG_TOUCHSCREEN_88PM860X is not set
CONFIG_TOUCHSCREEN_ADS7846=y
# CONFIG_TOUCHSCREEN_AD7877 is not set
# CONFIG_TOUCHSCREEN_AD7879 is not set
CONFIG_TOUCHSCREEN_ADC=y
CONFIG_TOUCHSCREEN_ATMEL_MXT=y
CONFIG_TOUCHSCREEN_AUO_PIXCIR=m
CONFIG_TOUCHSCREEN_BU21013=m
# CONFIG_TOUCHSCREEN_BU21029 is not set
# CONFIG_TOUCHSCREEN_CY8CTMG110 is not set
# CONFIG_TOUCHSCREEN_CYTTSP_CORE is not set
CONFIG_TOUCHSCREEN_CYTTSP4_CORE=m
CONFIG_TOUCHSCREEN_CYTTSP4_I2C=m
CONFIG_TOUCHSCREEN_CYTTSP4_SPI=m
CONFIG_TOUCHSCREEN_DA9052=y
# CONFIG_TOUCHSCREEN_DYNAPRO is not set
CONFIG_TOUCHSCREEN_HAMPSHIRE=y
CONFIG_TOUCHSCREEN_EETI=m
# CONFIG_TOUCHSCREEN_EGALAX_SERIAL is not set
CONFIG_TOUCHSCREEN_EXC3000=m
# CONFIG_TOUCHSCREEN_FUJITSU is not set
# CONFIG_TOUCHSCREEN_GOODIX is not set
# CONFIG_TOUCHSCREEN_HIDEEP is not set
CONFIG_TOUCHSCREEN_ILI210X=y
CONFIG_TOUCHSCREEN_S6SY761=m
CONFIG_TOUCHSCREEN_GUNZE=y
CONFIG_TOUCHSCREEN_EKTF2127=y
CONFIG_TOUCHSCREEN_ELAN=y
# CONFIG_TOUCHSCREEN_ELO is not set
CONFIG_TOUCHSCREEN_WACOM_W8001=m
# CONFIG_TOUCHSCREEN_WACOM_I2C is not set
CONFIG_TOUCHSCREEN_MAX11801=y
# CONFIG_TOUCHSCREEN_MCS5000 is not set
# CONFIG_TOUCHSCREEN_MMS114 is not set
# CONFIG_TOUCHSCREEN_MELFAS_MIP4 is not set
# CONFIG_TOUCHSCREEN_MTOUCH is not set
# CONFIG_TOUCHSCREEN_INEXIO is not set
# CONFIG_TOUCHSCREEN_MK712 is not set
# CONFIG_TOUCHSCREEN_PENMOUNT is not set
CONFIG_TOUCHSCREEN_EDT_FT5X06=m
# CONFIG_TOUCHSCREEN_TOUCHRIGHT is not set
CONFIG_TOUCHSCREEN_TOUCHWIN=y
CONFIG_TOUCHSCREEN_PIXCIR=m
CONFIG_TOUCHSCREEN_WDT87XX_I2C=m
CONFIG_TOUCHSCREEN_WM831X=y
CONFIG_TOUCHSCREEN_MC13783=y
# CONFIG_TOUCHSCREEN_TOUCHIT213 is not set
CONFIG_TOUCHSCREEN_TSC_SERIO=y
CONFIG_TOUCHSCREEN_TSC200X_CORE=m
CONFIG_TOUCHSCREEN_TSC2004=m
# CONFIG_TOUCHSCREEN_TSC2005 is not set
CONFIG_TOUCHSCREEN_TSC2007=y
# CONFIG_TOUCHSCREEN_TSC2007_IIO is not set
CONFIG_TOUCHSCREEN_RM_TS=m
CONFIG_TOUCHSCREEN_SILEAD=m
# CONFIG_TOUCHSCREEN_SIS_I2C is not set
# CONFIG_TOUCHSCREEN_ST1232 is not set
CONFIG_TOUCHSCREEN_STMFTS=m
CONFIG_TOUCHSCREEN_SURFACE3_SPI=m
CONFIG_TOUCHSCREEN_SX8654=m
# CONFIG_TOUCHSCREEN_TPS6507X is not set
CONFIG_TOUCHSCREEN_ZET6223=y
CONFIG_TOUCHSCREEN_ZFORCE=y
# CONFIG_TOUCHSCREEN_ROHM_BU21023 is not set
CONFIG_INPUT_MISC=y
CONFIG_INPUT_88PM860X_ONKEY=m
# CONFIG_INPUT_88PM80X_ONKEY is not set
CONFIG_INPUT_AD714X=y
CONFIG_INPUT_AD714X_I2C=y
# CONFIG_INPUT_AD714X_SPI is not set
CONFIG_INPUT_BMA150=m
CONFIG_INPUT_E3X0_BUTTON=y
# CONFIG_INPUT_PCSPKR is not set
# CONFIG_INPUT_MC13783_PWRBUTTON is not set
CONFIG_INPUT_MMA8450=y
CONFIG_INPUT_APANEL=y
# CONFIG_INPUT_GP2A is not set
# CONFIG_INPUT_GPIO_BEEPER is not set
# CONFIG_INPUT_GPIO_DECODER is not set
# CONFIG_INPUT_KXTJ9 is not set
CONFIG_INPUT_REGULATOR_HAPTIC=y
# CONFIG_INPUT_AXP20X_PEK is not set
# CONFIG_INPUT_UINPUT is not set
# CONFIG_INPUT_PALMAS_PWRBUTTON is not set
CONFIG_INPUT_PCF50633_PMU=m
CONFIG_INPUT_PCF8574=m
CONFIG_INPUT_GPIO_ROTARY_ENCODER=y
CONFIG_INPUT_DA9052_ONKEY=y
CONFIG_INPUT_DA9055_ONKEY=m
CONFIG_INPUT_DA9063_ONKEY=m
CONFIG_INPUT_WM831X_ON=m
CONFIG_INPUT_ADXL34X=y
# CONFIG_INPUT_ADXL34X_I2C is not set
CONFIG_INPUT_ADXL34X_SPI=m
CONFIG_INPUT_CMA3000=y
CONFIG_INPUT_CMA3000_I2C=m
# CONFIG_INPUT_XEN_KBDDEV_FRONTEND is not set
# CONFIG_INPUT_IDEAPAD_SLIDEBAR is not set
CONFIG_INPUT_SOC_BUTTON_ARRAY=y
CONFIG_INPUT_DRV260X_HAPTICS=m
CONFIG_INPUT_DRV2665_HAPTICS=y
CONFIG_INPUT_DRV2667_HAPTICS=m
CONFIG_RMI4_CORE=y
# CONFIG_RMI4_I2C is not set
CONFIG_RMI4_SPI=m
CONFIG_RMI4_SMB=y
CONFIG_RMI4_F03=y
CONFIG_RMI4_F03_SERIO=y
CONFIG_RMI4_2D_SENSOR=y
CONFIG_RMI4_F11=y
CONFIG_RMI4_F12=y
CONFIG_RMI4_F30=y
# CONFIG_RMI4_F34 is not set
# CONFIG_RMI4_F55 is not set

#
# Hardware I/O ports
#
CONFIG_SERIO=y
CONFIG_ARCH_MIGHT_HAVE_PC_SERIO=y
CONFIG_SERIO_I8042=m
CONFIG_SERIO_SERPORT=y
# CONFIG_SERIO_CT82C710 is not set
CONFIG_SERIO_PARKBD=y
CONFIG_SERIO_LIBPS2=m
CONFIG_SERIO_RAW=y
CONFIG_SERIO_ALTERA_PS2=y
# CONFIG_SERIO_PS2MULT is not set
CONFIG_SERIO_ARC_PS2=m
CONFIG_SERIO_OLPC_APSP=y
CONFIG_SERIO_GPIO_PS2=y
# CONFIG_USERIO is not set
# CONFIG_GAMEPORT is not set

#
# Character devices
#
CONFIG_TTY=y
CONFIG_VT=y
CONFIG_CONSOLE_TRANSLATIONS=y
# CONFIG_VT_CONSOLE is not set
CONFIG_HW_CONSOLE=y
CONFIG_VT_HW_CONSOLE_BINDING=y
CONFIG_UNIX98_PTYS=y
CONFIG_LEGACY_PTYS=y
CONFIG_LEGACY_PTY_COUNT=256
CONFIG_SERIAL_NONSTANDARD=y
# CONFIG_ROCKETPORT is not set
CONFIG_MOXA_INTELLIO=y
CONFIG_MOXA_SMARTIO=m
CONFIG_N_HDLC=m
CONFIG_TRACE_ROUTER=m
CONFIG_TRACE_SINK=m
# CONFIG_GOLDFISH_TTY is not set
CONFIG_DEVMEM=y
# CONFIG_DEVKMEM is not set

#
# Serial drivers
#
CONFIG_SERIAL_EARLYCON=y
CONFIG_SERIAL_8250=y
CONFIG_SERIAL_8250_DEPRECATED_OPTIONS=y
CONFIG_SERIAL_8250_FINTEK=y
# CONFIG_SERIAL_8250_CONSOLE is not set
# CONFIG_SERIAL_8250_DMA is not set
CONFIG_SERIAL_8250_MEN_MCB=m
CONFIG_SERIAL_8250_NR_UARTS=4
CONFIG_SERIAL_8250_RUNTIME_UARTS=4
# CONFIG_SERIAL_8250_EXTENDED is not set
# CONFIG_SERIAL_8250_DW is not set
# CONFIG_SERIAL_8250_RT288X is not set

#
# Non-8250 serial port support
#
CONFIG_SERIAL_MAX3100=m
CONFIG_SERIAL_MAX310X=m
CONFIG_SERIAL_UARTLITE=y
CONFIG_SERIAL_UARTLITE_CONSOLE=y
CONFIG_SERIAL_UARTLITE_NR_UARTS=1
CONFIG_SERIAL_CORE=y
CONFIG_SERIAL_CORE_CONSOLE=y
CONFIG_SERIAL_SCCNXP=y
# CONFIG_SERIAL_SCCNXP_CONSOLE is not set
CONFIG_SERIAL_SC16IS7XX_CORE=m
CONFIG_SERIAL_SC16IS7XX=m
# CONFIG_SERIAL_SC16IS7XX_I2C is not set
CONFIG_SERIAL_SC16IS7XX_SPI=y
CONFIG_SERIAL_ALTERA_JTAGUART=m
# CONFIG_SERIAL_ALTERA_UART is not set
# CONFIG_SERIAL_IFX6X60 is not set
CONFIG_SERIAL_ARC=y
CONFIG_SERIAL_ARC_CONSOLE=y
CONFIG_SERIAL_ARC_NR_PORTS=1
# CONFIG_SERIAL_FSL_LPUART is not set
CONFIG_SERIAL_MEN_Z135=y
CONFIG_SERIAL_DEV_BUS=y
CONFIG_SERIAL_DEV_CTRL_TTYPORT=y
CONFIG_TTY_PRINTK=m
CONFIG_TTY_PRINTK_LEVEL=6
CONFIG_PRINTER=y
# CONFIG_LP_CONSOLE is not set
CONFIG_PPDEV=m
CONFIG_HVC_DRIVER=y
CONFIG_HVC_IRQ=y
CONFIG_HVC_XEN=y
# CONFIG_HVC_XEN_FRONTEND is not set
# CONFIG_VIRTIO_CONSOLE is not set
CONFIG_IPMI_HANDLER=m
CONFIG_IPMI_PANIC_EVENT=y
# CONFIG_IPMI_PANIC_STRING is not set
CONFIG_IPMI_DEVICE_INTERFACE=m
CONFIG_IPMI_SI=m
# CONFIG_IPMI_SSIF is not set
CONFIG_IPMI_WATCHDOG=m
CONFIG_IPMI_POWEROFF=m
CONFIG_HW_RANDOM=m
CONFIG_HW_RANDOM_TIMERIOMEM=m
CONFIG_HW_RANDOM_VIA=m
# CONFIG_HW_RANDOM_VIRTIO is not set
# CONFIG_NVRAM is not set
CONFIG_R3964=y
CONFIG_MWAVE=y
CONFIG_RAW_DRIVER=y
CONFIG_MAX_RAW_DEVS=256
CONFIG_HANGCHECK_TIMER=m
CONFIG_TCG_TPM=m
# CONFIG_HW_RANDOM_TPM is not set
CONFIG_TCG_TIS_CORE=m
# CONFIG_TCG_TIS is not set
CONFIG_TCG_TIS_SPI=m
CONFIG_TCG_TIS_I2C_ATMEL=m
# CONFIG_TCG_TIS_I2C_INFINEON is not set
CONFIG_TCG_TIS_I2C_NUVOTON=m
CONFIG_TCG_NSC=m
# CONFIG_TCG_ATMEL is not set
CONFIG_TCG_XEN=m
# CONFIG_TCG_VTPM_PROXY is not set
CONFIG_TCG_TIS_ST33ZP24=m
CONFIG_TCG_TIS_ST33ZP24_I2C=m
CONFIG_TCG_TIS_ST33ZP24_SPI=m
CONFIG_TELCLOCK=y
CONFIG_RANDOM_TRUST_CPU=y

#
# I2C support
#
CONFIG_I2C=y
CONFIG_I2C_BOARDINFO=y
CONFIG_I2C_COMPAT=y
CONFIG_I2C_CHARDEV=y
CONFIG_I2C_MUX=y

#
# Multiplexer I2C Chip support
#
CONFIG_I2C_MUX_GPIO=y
# CONFIG_I2C_MUX_LTC4306 is not set
CONFIG_I2C_MUX_PCA9541=y
# CONFIG_I2C_MUX_PCA954x is not set
# CONFIG_I2C_MUX_REG is not set
# CONFIG_I2C_MUX_MLXCPLD is not set
CONFIG_I2C_HELPER_AUTO=y
CONFIG_I2C_SMBUS=m
CONFIG_I2C_ALGOBIT=y
CONFIG_I2C_ALGOPCA=y

#
# I2C Hardware Bus support
#

#
# I2C system bus drivers (mostly embedded / system-on-chip)
#
CONFIG_I2C_CBUS_GPIO=y
# CONFIG_I2C_DESIGNWARE_PLATFORM is not set
CONFIG_I2C_GPIO=y
# CONFIG_I2C_GPIO_FAULT_INJECTOR is not set
CONFIG_I2C_KEMPLD=m
# CONFIG_I2C_OCORES is not set
CONFIG_I2C_PCA_PLATFORM=y
CONFIG_I2C_SIMTEC=m
CONFIG_I2C_XILINX=y

#
# External I2C/SMBus adapter drivers
#
CONFIG_I2C_PARPORT=m
# CONFIG_I2C_PARPORT_LIGHT is not set
# CONFIG_I2C_TAOS_EVM is not set

#
# Other I2C/SMBus bus drivers
#
CONFIG_I2C_MLXCPLD=m
# CONFIG_I2C_STUB is not set
# CONFIG_I2C_SLAVE is not set
# CONFIG_I2C_DEBUG_CORE is not set
# CONFIG_I2C_DEBUG_ALGO is not set
# CONFIG_I2C_DEBUG_BUS is not set
CONFIG_I3C=y
CONFIG_CDNS_I3C_MASTER=y
# CONFIG_DW_I3C_MASTER is not set
CONFIG_SPI=y
CONFIG_SPI_DEBUG=y
CONFIG_SPI_MASTER=y
CONFIG_SPI_MEM=y

#
# SPI Master Controller Drivers
#
CONFIG_SPI_ALTERA=m
CONFIG_SPI_AXI_SPI_ENGINE=m
CONFIG_SPI_BITBANG=y
CONFIG_SPI_BUTTERFLY=y
# CONFIG_SPI_CADENCE is not set
# CONFIG_SPI_DESIGNWARE is not set
CONFIG_SPI_GPIO=y
# CONFIG_SPI_LM70_LLP is not set
CONFIG_SPI_OC_TINY=m
# CONFIG_SPI_ROCKCHIP is not set
CONFIG_SPI_SC18IS602=m
# CONFIG_SPI_MXIC is not set
CONFIG_SPI_XCOMM=m
CONFIG_SPI_XILINX=y
CONFIG_SPI_ZYNQMP_GQSPI=m

#
# SPI Protocol Masters
#
CONFIG_SPI_SPIDEV=y
CONFIG_SPI_LOOPBACK_TEST=m
CONFIG_SPI_TLE62X0=m
CONFIG_SPI_SLAVE=y
CONFIG_SPI_SLAVE_TIME=y
CONFIG_SPI_SLAVE_SYSTEM_CONTROL=m
# CONFIG_SPMI is not set
CONFIG_HSI=y
CONFIG_HSI_BOARDINFO=y

#
# HSI controllers
#

#
# HSI clients
#
CONFIG_HSI_CHAR=m
CONFIG_PPS=y
CONFIG_PPS_DEBUG=y

#
# PPS clients support
#
CONFIG_PPS_CLIENT_KTIMER=m
CONFIG_PPS_CLIENT_LDISC=m
CONFIG_PPS_CLIENT_PARPORT=y
CONFIG_PPS_CLIENT_GPIO=y

#
# PPS generators support
#

#
# PTP clock support
#

#
# Enable PHYLIB and NETWORK_PHY_TIMESTAMPING to see the additional clocks.
#
# CONFIG_PINCTRL is not set
CONFIG_GPIOLIB=y
CONFIG_GPIOLIB_FASTPATH_LIMIT=512
CONFIG_GPIOLIB_IRQCHIP=y
# CONFIG_DEBUG_GPIO is not set
CONFIG_GPIO_SYSFS=y
CONFIG_GPIO_GENERIC=y
CONFIG_GPIO_MAX730X=y

#
# Memory mapped GPIO drivers
#
CONFIG_GPIO_DWAPB=y
# CONFIG_GPIO_GENERIC_PLATFORM is not set
CONFIG_GPIO_MB86S7X=m
# CONFIG_GPIO_MENZ127 is not set
CONFIG_GPIO_MOCKUP=y
CONFIG_GPIO_SIOX=y

#
# Port-mapped I/O GPIO drivers
#
CONFIG_GPIO_104_DIO_48E=m
CONFIG_GPIO_104_IDIO_16=m
CONFIG_GPIO_104_IDI_48=y
CONFIG_GPIO_F7188X=y
# CONFIG_GPIO_GPIO_MM is not set
CONFIG_GPIO_IT87=y
CONFIG_GPIO_SCH311X=m
CONFIG_GPIO_WINBOND=m
CONFIG_GPIO_WS16C48=y

#
# I2C GPIO expanders
#
CONFIG_GPIO_ADP5588=m
CONFIG_GPIO_MAX7300=y
CONFIG_GPIO_MAX732X=y
CONFIG_GPIO_MAX732X_IRQ=y
# CONFIG_GPIO_PCA953X is not set
# CONFIG_GPIO_PCF857X is not set
# CONFIG_GPIO_TPIC2810 is not set

#
# MFD GPIO expanders
#
# CONFIG_GPIO_ARIZONA is not set
CONFIG_GPIO_BD9571MWV=m
CONFIG_GPIO_DA9052=m
CONFIG_GPIO_DA9055=m
CONFIG_GPIO_KEMPLD=y
CONFIG_GPIO_LP3943=m
# CONFIG_GPIO_LP873X is not set
# CONFIG_GPIO_PALMAS is not set
# CONFIG_GPIO_TPS65910 is not set
# CONFIG_GPIO_TPS65912 is not set
CONFIG_GPIO_WM831X=m
CONFIG_GPIO_WM8994=m

#
# SPI GPIO expanders
#
CONFIG_GPIO_MAX3191X=m
CONFIG_GPIO_MAX7301=m
CONFIG_GPIO_MC33880=y
# CONFIG_GPIO_PISOSR is not set
CONFIG_GPIO_XRA1403=y
CONFIG_W1=m

#
# 1-wire Bus Masters
#
# CONFIG_W1_MASTER_DS2482 is not set
# CONFIG_W1_MASTER_DS1WM is not set
CONFIG_W1_MASTER_GPIO=m

#
# 1-wire Slaves
#
CONFIG_W1_SLAVE_THERM=m
CONFIG_W1_SLAVE_SMEM=m
# CONFIG_W1_SLAVE_DS2405 is not set
CONFIG_W1_SLAVE_DS2408=m
CONFIG_W1_SLAVE_DS2408_READBACK=y
# CONFIG_W1_SLAVE_DS2413 is not set
CONFIG_W1_SLAVE_DS2406=m
CONFIG_W1_SLAVE_DS2423=m
CONFIG_W1_SLAVE_DS2805=m
CONFIG_W1_SLAVE_DS2431=m
# CONFIG_W1_SLAVE_DS2433 is not set
# CONFIG_W1_SLAVE_DS2438 is not set
CONFIG_W1_SLAVE_DS2780=m
CONFIG_W1_SLAVE_DS2781=m
# CONFIG_W1_SLAVE_DS28E04 is not set
CONFIG_W1_SLAVE_DS28E17=m
# CONFIG_POWER_AVS is not set
# CONFIG_POWER_RESET is not set
CONFIG_POWER_SUPPLY=y
CONFIG_POWER_SUPPLY_DEBUG=y
# CONFIG_PDA_POWER is not set
CONFIG_GENERIC_ADC_BATTERY=y
CONFIG_WM831X_BACKUP=y
CONFIG_WM831X_POWER=m
CONFIG_TEST_POWER=y
CONFIG_BATTERY_88PM860X=m
CONFIG_CHARGER_ADP5061=y
CONFIG_BATTERY_DS2760=m
CONFIG_BATTERY_DS2780=m
CONFIG_BATTERY_DS2781=m
CONFIG_BATTERY_DS2782=y
# CONFIG_BATTERY_SBS is not set
CONFIG_CHARGER_SBS=y
# CONFIG_MANAGER_SBS is not set
CONFIG_BATTERY_BQ27XXX=y
CONFIG_BATTERY_BQ27XXX_I2C=y
# CONFIG_BATTERY_BQ27XXX_HDQ is not set
# CONFIG_BATTERY_BQ27XXX_DT_UPDATES_NVM is not set
CONFIG_BATTERY_DA9052=y
# CONFIG_CHARGER_DA9150 is not set
# CONFIG_BATTERY_DA9150 is not set
CONFIG_AXP20X_POWER=m
CONFIG_AXP288_FUEL_GAUGE=m
CONFIG_BATTERY_MAX17040=y
CONFIG_BATTERY_MAX17042=y
CONFIG_BATTERY_MAX1721X=m
CONFIG_CHARGER_88PM860X=m
CONFIG_CHARGER_PCF50633=y
CONFIG_CHARGER_MAX8903=y
CONFIG_CHARGER_LP8727=m
CONFIG_CHARGER_LP8788=m
# CONFIG_CHARGER_GPIO is not set
# CONFIG_CHARGER_MANAGER is not set
CONFIG_CHARGER_LTC3651=m
CONFIG_CHARGER_MAX77693=m
CONFIG_CHARGER_MAX8998=m
CONFIG_CHARGER_BQ2415X=m
CONFIG_CHARGER_BQ24190=m
CONFIG_CHARGER_BQ24257=m
CONFIG_CHARGER_BQ24735=m
CONFIG_CHARGER_BQ25890=m
CONFIG_CHARGER_SMB347=m
# CONFIG_CHARGER_TPS65090 is not set
CONFIG_BATTERY_GAUGE_LTC2941=m
# CONFIG_BATTERY_GOLDFISH is not set
CONFIG_CHARGER_RT9455=m
CONFIG_HWMON=y
CONFIG_HWMON_VID=y
CONFIG_HWMON_DEBUG_CHIP=y

#
# Native drivers
#
CONFIG_SENSORS_AD7314=y
CONFIG_SENSORS_AD7414=m
CONFIG_SENSORS_AD7418=y
CONFIG_SENSORS_ADM1021=y
CONFIG_SENSORS_ADM1025=m
# CONFIG_SENSORS_ADM1026 is not set
CONFIG_SENSORS_ADM1029=y
CONFIG_SENSORS_ADM1031=m
# CONFIG_SENSORS_ADM9240 is not set
CONFIG_SENSORS_ADT7X10=y
# CONFIG_SENSORS_ADT7310 is not set
CONFIG_SENSORS_ADT7410=y
CONFIG_SENSORS_ADT7411=m
CONFIG_SENSORS_ADT7462=y
CONFIG_SENSORS_ADT7470=m
CONFIG_SENSORS_ADT7475=y
# CONFIG_SENSORS_ASC7621 is not set
CONFIG_SENSORS_APPLESMC=m
CONFIG_SENSORS_ASB100=m
CONFIG_SENSORS_ASPEED=m
# CONFIG_SENSORS_ATXP1 is not set
CONFIG_SENSORS_DS620=m
CONFIG_SENSORS_DS1621=y
# CONFIG_SENSORS_DELL_SMM is not set
CONFIG_SENSORS_DA9052_ADC=y
# CONFIG_SENSORS_DA9055 is not set
CONFIG_SENSORS_F71805F=y
# CONFIG_SENSORS_F71882FG is not set
CONFIG_SENSORS_F75375S=m
# CONFIG_SENSORS_MC13783_ADC is not set
CONFIG_SENSORS_FSCHMD=m
# CONFIG_SENSORS_FTSTEUTATES is not set
CONFIG_SENSORS_GL518SM=m
# CONFIG_SENSORS_GL520SM is not set
CONFIG_SENSORS_G760A=y
CONFIG_SENSORS_G762=y
# CONFIG_SENSORS_HIH6130 is not set
CONFIG_SENSORS_IBMAEM=m
# CONFIG_SENSORS_IBMPEX is not set
CONFIG_SENSORS_IIO_HWMON=m
CONFIG_SENSORS_CORETEMP=y
CONFIG_SENSORS_IT87=y
CONFIG_SENSORS_JC42=y
CONFIG_SENSORS_POWR1220=m
CONFIG_SENSORS_LINEAGE=m
CONFIG_SENSORS_LTC2945=m
# CONFIG_SENSORS_LTC2990 is not set
# CONFIG_SENSORS_LTC4151 is not set
# CONFIG_SENSORS_LTC4215 is not set
# CONFIG_SENSORS_LTC4222 is not set
CONFIG_SENSORS_LTC4245=y
# CONFIG_SENSORS_LTC4260 is not set
CONFIG_SENSORS_LTC4261=y
CONFIG_SENSORS_MAX1111=m
CONFIG_SENSORS_MAX16065=m
CONFIG_SENSORS_MAX1619=m
CONFIG_SENSORS_MAX1668=m
CONFIG_SENSORS_MAX197=y
CONFIG_SENSORS_MAX31722=m
CONFIG_SENSORS_MAX6621=m
CONFIG_SENSORS_MAX6639=y
# CONFIG_SENSORS_MAX6642 is not set
CONFIG_SENSORS_MAX6650=m
CONFIG_SENSORS_MAX6697=y
# CONFIG_SENSORS_MAX31790 is not set
CONFIG_SENSORS_MCP3021=m
# CONFIG_SENSORS_MLXREG_FAN is not set
CONFIG_SENSORS_TC654=y
CONFIG_SENSORS_MENF21BMC_HWMON=m
# CONFIG_SENSORS_ADCXX is not set
# CONFIG_SENSORS_LM63 is not set
CONFIG_SENSORS_LM70=m
CONFIG_SENSORS_LM73=m
CONFIG_SENSORS_LM75=m
CONFIG_SENSORS_LM77=y
CONFIG_SENSORS_LM78=m
CONFIG_SENSORS_LM80=y
CONFIG_SENSORS_LM83=m
CONFIG_SENSORS_LM85=m
# CONFIG_SENSORS_LM87 is not set
CONFIG_SENSORS_LM90=m
CONFIG_SENSORS_LM92=y
CONFIG_SENSORS_LM93=y
CONFIG_SENSORS_LM95234=m
# CONFIG_SENSORS_LM95241 is not set
CONFIG_SENSORS_LM95245=y
# CONFIG_SENSORS_PC87360 is not set
CONFIG_SENSORS_PC87427=m
# CONFIG_SENSORS_NTC_THERMISTOR is not set
CONFIG_SENSORS_NCT6683=y
CONFIG_SENSORS_NCT6775=y
CONFIG_SENSORS_NCT7802=m
CONFIG_SENSORS_NCT7904=y
CONFIG_SENSORS_NPCM7XX=y
CONFIG_SENSORS_OCC_P8_I2C=y
CONFIG_SENSORS_OCC=y
# CONFIG_SENSORS_PCF8591 is not set
# CONFIG_PMBUS is not set
CONFIG_SENSORS_SHT15=m
# CONFIG_SENSORS_SHT21 is not set
# CONFIG_SENSORS_SHT3x is not set
# CONFIG_SENSORS_SHTC1 is not set
CONFIG_SENSORS_DME1737=y
CONFIG_SENSORS_EMC1403=m
CONFIG_SENSORS_EMC2103=m
# CONFIG_SENSORS_EMC6W201 is not set
# CONFIG_SENSORS_SMSC47M1 is not set
CONFIG_SENSORS_SMSC47M192=m
CONFIG_SENSORS_SMSC47B397=m
CONFIG_SENSORS_SCH56XX_COMMON=y
CONFIG_SENSORS_SCH5627=y
CONFIG_SENSORS_SCH5636=y
# CONFIG_SENSORS_STTS751 is not set
# CONFIG_SENSORS_SMM665 is not set
CONFIG_SENSORS_ADC128D818=m
# CONFIG_SENSORS_ADS1015 is not set
CONFIG_SENSORS_ADS7828=m
CONFIG_SENSORS_ADS7871=y
CONFIG_SENSORS_AMC6821=y
CONFIG_SENSORS_INA209=y
CONFIG_SENSORS_INA2XX=y
CONFIG_SENSORS_INA3221=m
CONFIG_SENSORS_TC74=y
CONFIG_SENSORS_THMC50=y
CONFIG_SENSORS_TMP102=y
# CONFIG_SENSORS_TMP103 is not set
# CONFIG_SENSORS_TMP108 is not set
CONFIG_SENSORS_TMP401=m
CONFIG_SENSORS_TMP421=m
CONFIG_SENSORS_VIA_CPUTEMP=m
CONFIG_SENSORS_VT1211=m
CONFIG_SENSORS_W83773G=m
CONFIG_SENSORS_W83781D=m
CONFIG_SENSORS_W83791D=m
CONFIG_SENSORS_W83792D=m
# CONFIG_SENSORS_W83793 is not set
CONFIG_SENSORS_W83795=y
CONFIG_SENSORS_W83795_FANCTRL=y
# CONFIG_SENSORS_W83L785TS is not set
CONFIG_SENSORS_W83L786NG=y
CONFIG_SENSORS_W83627HF=m
# CONFIG_SENSORS_W83627EHF is not set
CONFIG_SENSORS_WM831X=m
CONFIG_THERMAL=y
# CONFIG_THERMAL_STATISTICS is not set
CONFIG_THERMAL_EMERGENCY_POWEROFF_DELAY_MS=0
CONFIG_THERMAL_HWMON=y
CONFIG_THERMAL_WRITABLE_TRIPS=y
# CONFIG_THERMAL_DEFAULT_GOV_STEP_WISE is not set
CONFIG_THERMAL_DEFAULT_GOV_FAIR_SHARE=y
# CONFIG_THERMAL_DEFAULT_GOV_USER_SPACE is not set
# CONFIG_THERMAL_DEFAULT_GOV_POWER_ALLOCATOR is not set
CONFIG_THERMAL_GOV_FAIR_SHARE=y
CONFIG_THERMAL_GOV_STEP_WISE=y
# CONFIG_THERMAL_GOV_BANG_BANG is not set
CONFIG_THERMAL_GOV_USER_SPACE=y
# CONFIG_THERMAL_GOV_POWER_ALLOCATOR is not set
CONFIG_DEVFREQ_THERMAL=y
# CONFIG_THERMAL_EMULATION is not set

#
# Intel thermal drivers
#
CONFIG_INTEL_POWERCLAMP=m

#
# ACPI INT340X thermal drivers
#
CONFIG_GENERIC_ADC_THERMAL=y
CONFIG_WATCHDOG=y
CONFIG_WATCHDOG_CORE=y
# CONFIG_WATCHDOG_NOWAYOUT is not set
# CONFIG_WATCHDOG_HANDLE_BOOT_ENABLED is not set
# CONFIG_WATCHDOG_SYSFS is not set

#
# Watchdog Device Drivers
#
CONFIG_SOFT_WATCHDOG=m
CONFIG_DA9052_WATCHDOG=m
CONFIG_DA9055_WATCHDOG=y
CONFIG_DA9063_WATCHDOG=m
CONFIG_DA9062_WATCHDOG=m
CONFIG_MENF21BMC_WATCHDOG=m
CONFIG_MENZ069_WATCHDOG=m
# CONFIG_WM831X_WATCHDOG is not set
CONFIG_XILINX_WATCHDOG=y
# CONFIG_ZIIRAVE_WATCHDOG is not set
CONFIG_CADENCE_WATCHDOG=y
# CONFIG_DW_WATCHDOG is not set
# CONFIG_MAX63XX_WATCHDOG is not set
CONFIG_ACQUIRE_WDT=m
# CONFIG_ADVANTECH_WDT is not set
CONFIG_EBC_C384_WDT=m
CONFIG_F71808E_WDT=m
CONFIG_SBC_FITPC2_WATCHDOG=m
CONFIG_EUROTECH_WDT=m
CONFIG_IB700_WDT=m
CONFIG_IBMASR=y
CONFIG_WAFER_WDT=m
# CONFIG_IT8712F_WDT is not set
# CONFIG_IT87_WDT is not set
CONFIG_KEMPLD_WDT=y
CONFIG_SC1200_WDT=y
CONFIG_PC87413_WDT=m
CONFIG_60XX_WDT=m
CONFIG_CPU5_WDT=m
CONFIG_SMSC_SCH311X_WDT=m
CONFIG_SMSC37B787_WDT=y
CONFIG_TQMX86_WDT=m
CONFIG_W83627HF_WDT=y
CONFIG_W83877F_WDT=y
CONFIG_W83977F_WDT=m
CONFIG_MACHZ_WDT=y
CONFIG_SBC_EPX_C3_WATCHDOG=y
CONFIG_MEN_A21_WDT=y
CONFIG_XEN_WDT=m

#
# Watchdog Pretimeout Governors
#
# CONFIG_WATCHDOG_PRETIMEOUT_GOV is not set
CONFIG_SSB_POSSIBLE=y
# CONFIG_SSB is not set
CONFIG_BCMA_POSSIBLE=y
CONFIG_BCMA=y
CONFIG_BCMA_HOST_SOC=y
CONFIG_BCMA_SFLASH=y
CONFIG_BCMA_DRIVER_GMAC_CMN=y
# CONFIG_BCMA_DRIVER_GPIO is not set
# CONFIG_BCMA_DEBUG is not set

#
# Multifunction device drivers
#
CONFIG_MFD_CORE=y
# CONFIG_MFD_AS3711 is not set
# CONFIG_PMIC_ADP5520 is not set
# CONFIG_MFD_AAT2870_CORE is not set
# CONFIG_MFD_BCM590XX is not set
CONFIG_MFD_BD9571MWV=m
CONFIG_MFD_AXP20X=m
CONFIG_MFD_AXP20X_I2C=m
# CONFIG_MFD_CROS_EC is not set
# CONFIG_MFD_MADERA is not set
# CONFIG_PMIC_DA903X is not set
CONFIG_PMIC_DA9052=y
CONFIG_MFD_DA9052_SPI=y
# CONFIG_MFD_DA9052_I2C is not set
CONFIG_MFD_DA9055=y
CONFIG_MFD_DA9062=m
CONFIG_MFD_DA9063=m
CONFIG_MFD_DA9150=m
CONFIG_MFD_MC13XXX=y
CONFIG_MFD_MC13XXX_SPI=y
CONFIG_MFD_MC13XXX_I2C=y
CONFIG_HTC_PASIC3=y
CONFIG_HTC_I2CPLD=y
CONFIG_MFD_KEMPLD=y
CONFIG_MFD_88PM800=y
# CONFIG_MFD_88PM805 is not set
CONFIG_MFD_88PM860X=y
# CONFIG_MFD_MAX14577 is not set
CONFIG_MFD_MAX77693=y
CONFIG_MFD_MAX77843=y
CONFIG_MFD_MAX8907=m
# CONFIG_MFD_MAX8925 is not set
# CONFIG_MFD_MAX8997 is not set
CONFIG_MFD_MAX8998=y
# CONFIG_MFD_MT6397 is not set
CONFIG_MFD_MENF21BMC=y
# CONFIG_EZX_PCAP is not set
# CONFIG_MFD_RETU is not set
CONFIG_MFD_PCF50633=y
CONFIG_PCF50633_ADC=m
CONFIG_PCF50633_GPIO=y
# CONFIG_MFD_RT5033 is not set
# CONFIG_MFD_RC5T583 is not set
CONFIG_MFD_SEC_CORE=m
CONFIG_MFD_SI476X_CORE=m
# CONFIG_MFD_SM501 is not set
CONFIG_MFD_SKY81452=m
CONFIG_MFD_SMSC=y
CONFIG_ABX500_CORE=y
CONFIG_AB3100_CORE=y
# CONFIG_AB3100_OTP is not set
CONFIG_MFD_SYSCON=y
# CONFIG_MFD_TI_AM335X_TSCADC is not set
CONFIG_MFD_LP3943=m
CONFIG_MFD_LP8788=y
# CONFIG_MFD_TI_LMU is not set
CONFIG_MFD_PALMAS=y
# CONFIG_TPS6105X is not set
CONFIG_TPS65010=m
# CONFIG_TPS6507X is not set
# CONFIG_MFD_TPS65086 is not set
CONFIG_MFD_TPS65090=y
CONFIG_MFD_TI_LP873X=m
# CONFIG_MFD_TPS6586X is not set
CONFIG_MFD_TPS65910=y
CONFIG_MFD_TPS65912=y
CONFIG_MFD_TPS65912_I2C=m
CONFIG_MFD_TPS65912_SPI=y
# CONFIG_MFD_TPS80031 is not set
# CONFIG_TWL4030_CORE is not set
# CONFIG_TWL6040_CORE is not set
CONFIG_MFD_WL1273_CORE=m
CONFIG_MFD_LM3533=m
CONFIG_MFD_ARIZONA=y
CONFIG_MFD_ARIZONA_I2C=y
# CONFIG_MFD_ARIZONA_SPI is not set
# CONFIG_MFD_CS47L24 is not set
CONFIG_MFD_WM5102=y
CONFIG_MFD_WM5110=y
# CONFIG_MFD_WM8997 is not set
# CONFIG_MFD_WM8998 is not set
CONFIG_MFD_WM8400=y
CONFIG_MFD_WM831X=y
CONFIG_MFD_WM831X_I2C=y
# CONFIG_MFD_WM831X_SPI is not set
# CONFIG_MFD_WM8350_I2C is not set
CONFIG_MFD_WM8994=m
# CONFIG_RAVE_SP_CORE is not set
CONFIG_REGULATOR=y
CONFIG_REGULATOR_DEBUG=y
CONFIG_REGULATOR_FIXED_VOLTAGE=m
CONFIG_REGULATOR_VIRTUAL_CONSUMER=m
CONFIG_REGULATOR_USERSPACE_CONSUMER=y
# CONFIG_REGULATOR_88PG86X is not set
# CONFIG_REGULATOR_88PM800 is not set
# CONFIG_REGULATOR_88PM8607 is not set
CONFIG_REGULATOR_ACT8865=y
CONFIG_REGULATOR_AD5398=y
CONFIG_REGULATOR_ANATOP=m
CONFIG_REGULATOR_AB3100=m
CONFIG_REGULATOR_AXP20X=m
CONFIG_REGULATOR_BD9571MWV=m
CONFIG_REGULATOR_DA9052=y
CONFIG_REGULATOR_DA9055=m
CONFIG_REGULATOR_DA9062=m
CONFIG_REGULATOR_DA9063=m
CONFIG_REGULATOR_DA9210=m
CONFIG_REGULATOR_DA9211=m
CONFIG_REGULATOR_FAN53555=m
CONFIG_REGULATOR_GPIO=y
CONFIG_REGULATOR_ISL9305=y
CONFIG_REGULATOR_ISL6271A=y
CONFIG_REGULATOR_LP3971=m
# CONFIG_REGULATOR_LP3972 is not set
CONFIG_REGULATOR_LP872X=m
CONFIG_REGULATOR_LP8755=m
CONFIG_REGULATOR_LP8788=y
CONFIG_REGULATOR_LTC3589=m
CONFIG_REGULATOR_LTC3676=m
CONFIG_REGULATOR_MAX1586=m
CONFIG_REGULATOR_MAX8649=m
# CONFIG_REGULATOR_MAX8660 is not set
CONFIG_REGULATOR_MAX8907=m
CONFIG_REGULATOR_MAX8952=y
CONFIG_REGULATOR_MAX8998=y
CONFIG_REGULATOR_MAX77693=y
CONFIG_REGULATOR_MC13XXX_CORE=m
CONFIG_REGULATOR_MC13783=m
# CONFIG_REGULATOR_MC13892 is not set
CONFIG_REGULATOR_MT6311=m
CONFIG_REGULATOR_PALMAS=m
CONFIG_REGULATOR_PCF50633=m
CONFIG_REGULATOR_PFUZE100=m
CONFIG_REGULATOR_PV88060=y
CONFIG_REGULATOR_PV88080=m
CONFIG_REGULATOR_PV88090=m
# CONFIG_REGULATOR_S2MPA01 is not set
CONFIG_REGULATOR_S2MPS11=m
CONFIG_REGULATOR_S5M8767=m
CONFIG_REGULATOR_SKY81452=m
CONFIG_REGULATOR_TPS51632=y
CONFIG_REGULATOR_TPS62360=y
CONFIG_REGULATOR_TPS65023=m
CONFIG_REGULATOR_TPS6507X=y
CONFIG_REGULATOR_TPS65090=y
CONFIG_REGULATOR_TPS65132=m
CONFIG_REGULATOR_TPS6524X=m
# CONFIG_REGULATOR_TPS65910 is not set
CONFIG_REGULATOR_TPS65912=y
CONFIG_REGULATOR_WM831X=m
# CONFIG_REGULATOR_WM8400 is not set
CONFIG_REGULATOR_WM8994=m
CONFIG_CEC_CORE=y
# CONFIG_RC_CORE is not set
# CONFIG_MEDIA_SUPPORT is not set

#
# Graphics support
#
CONFIG_DRM=y
CONFIG_DRM_DP_AUX_CHARDEV=y
CONFIG_DRM_DEBUG_MM=y
# CONFIG_DRM_DEBUG_SELFTEST is not set
CONFIG_DRM_KMS_HELPER=y
CONFIG_DRM_KMS_FB_HELPER=y
CONFIG_DRM_FBDEV_EMULATION=y
CONFIG_DRM_FBDEV_OVERALLOC=100
# CONFIG_DRM_FBDEV_LEAK_PHYS_SMEM is not set
# CONFIG_DRM_LOAD_EDID_FIRMWARE is not set
CONFIG_DRM_DP_CEC=y
CONFIG_DRM_TTM=y
CONFIG_DRM_GEM_CMA_HELPER=y
CONFIG_DRM_KMS_CMA_HELPER=y

#
# I2C encoder or helper chips
#
CONFIG_DRM_I2C_CH7006=y
# CONFIG_DRM_I2C_SIL164 is not set
CONFIG_DRM_I2C_NXP_TDA998X=m
# CONFIG_DRM_I2C_NXP_TDA9950 is not set

#
# ACP (Audio CoProcessor) Configuration
#

#
# AMD Library routines
#
# CONFIG_DRM_VGEM is not set
# CONFIG_DRM_VKMS is not set
CONFIG_DRM_VIRTIO_GPU=y
CONFIG_DRM_PANEL=y

#
# Display Panels
#
CONFIG_DRM_BRIDGE=y
CONFIG_DRM_PANEL_BRIDGE=y

#
# Display Interface Bridges
#
CONFIG_DRM_ANALOGIX_ANX78XX=m
CONFIG_DRM_TINYDRM=m
CONFIG_TINYDRM_MIPI_DBI=m
CONFIG_TINYDRM_ILI9225=m
CONFIG_TINYDRM_REPAPER=m
CONFIG_TINYDRM_ST7586=m
# CONFIG_DRM_XEN is not set
# CONFIG_DRM_LEGACY is not set
CONFIG_DRM_PANEL_ORIENTATION_QUIRKS=y

#
# Frame buffer Devices
#
CONFIG_FB_CMDLINE=y
CONFIG_FB_NOTIFY=y
CONFIG_FB=y
# CONFIG_FIRMWARE_EDID is not set
CONFIG_FB_BOOT_VESA_SUPPORT=y
CONFIG_FB_CFB_FILLRECT=y
CONFIG_FB_CFB_COPYAREA=y
CONFIG_FB_CFB_IMAGEBLIT=y
CONFIG_FB_SYS_FILLRECT=y
CONFIG_FB_SYS_COPYAREA=y
CONFIG_FB_SYS_IMAGEBLIT=y
CONFIG_FB_FOREIGN_ENDIAN=y
# CONFIG_FB_BOTH_ENDIAN is not set
# CONFIG_FB_BIG_ENDIAN is not set
CONFIG_FB_LITTLE_ENDIAN=y
CONFIG_FB_SYS_FOPS=y
CONFIG_FB_DEFERRED_IO=y
CONFIG_FB_HECUBA=m
# CONFIG_FB_MODE_HELPERS is not set
# CONFIG_FB_TILEBLITTING is not set

#
# Frame buffer hardware drivers
#
# CONFIG_FB_ARC is not set
CONFIG_FB_VGA16=m
CONFIG_FB_VESA=y
CONFIG_FB_N411=m
CONFIG_FB_HGA=y
# CONFIG_FB_OPENCORES is not set
CONFIG_FB_S1D13XXX=y
# CONFIG_FB_IBM_GXT4500 is not set
CONFIG_FB_GOLDFISH=m
# CONFIG_FB_VIRTUAL is not set
CONFIG_XEN_FBDEV_FRONTEND=y
# CONFIG_FB_METRONOME is not set
# CONFIG_FB_SIMPLE is not set
# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
CONFIG_VGASTATE=m
CONFIG_HDMI=y

#
# Console display driver support
#
# CONFIG_VGA_CONSOLE is not set
CONFIG_DUMMY_CONSOLE=y
CONFIG_DUMMY_CONSOLE_COLUMNS=80
CONFIG_DUMMY_CONSOLE_ROWS=25
CONFIG_FRAMEBUFFER_CONSOLE=y
CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y
CONFIG_FRAMEBUFFER_CONSOLE_ROTATION=y
CONFIG_FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVER=y
# CONFIG_LOGO is not set
# CONFIG_SOUND is not set

#
# HID support
#
CONFIG_HID=m
CONFIG_HID_BATTERY_STRENGTH=y
CONFIG_HIDRAW=y
# CONFIG_UHID is not set
CONFIG_HID_GENERIC=m

#
# Special HID drivers
#
CONFIG_HID_A4TECH=m
CONFIG_HID_ACRUX=m
CONFIG_HID_ACRUX_FF=y
CONFIG_HID_APPLE=m
# CONFIG_HID_ASUS is not set
CONFIG_HID_AUREAL=m
CONFIG_HID_BELKIN=m
CONFIG_HID_CHERRY=m
CONFIG_HID_CHICONY=m
CONFIG_HID_COUGAR=m
CONFIG_HID_CMEDIA=m
CONFIG_HID_CYPRESS=m
CONFIG_HID_DRAGONRISE=m
CONFIG_DRAGONRISE_FF=y
CONFIG_HID_EMS_FF=m
CONFIG_HID_ELECOM=m
# CONFIG_HID_EZKEY is not set
CONFIG_HID_GEMBIRD=m
CONFIG_HID_GFRM=m
# CONFIG_HID_KEYTOUCH is not set
CONFIG_HID_KYE=m
# CONFIG_HID_WALTOP is not set
CONFIG_HID_GYRATION=m
CONFIG_HID_ICADE=m
CONFIG_HID_ITE=m
CONFIG_HID_JABRA=m
CONFIG_HID_TWINHAN=m
CONFIG_HID_KENSINGTON=m
# CONFIG_HID_LCPOWER is not set
CONFIG_HID_LED=m
# CONFIG_HID_LENOVO is not set
CONFIG_HID_LOGITECH=m
CONFIG_HID_LOGITECH_DJ=m
CONFIG_HID_LOGITECH_HIDPP=m
CONFIG_LOGITECH_FF=y
CONFIG_LOGIRUMBLEPAD2_FF=y
# CONFIG_LOGIG940_FF is not set
CONFIG_LOGIWHEELS_FF=y
CONFIG_HID_MAGICMOUSE=m
# CONFIG_HID_MAYFLASH is not set
CONFIG_HID_REDRAGON=m
CONFIG_HID_MICROSOFT=m
CONFIG_HID_MONTEREY=m
# CONFIG_HID_MULTITOUCH is not set
CONFIG_HID_NTI=m
CONFIG_HID_ORTEK=m
# CONFIG_HID_PANTHERLORD is not set
# CONFIG_HID_PETALYNX is not set
# CONFIG_HID_PICOLCD is not set
CONFIG_HID_PLANTRONICS=m
CONFIG_HID_PRIMAX=m
# CONFIG_HID_SAITEK is not set
CONFIG_HID_SAMSUNG=m
CONFIG_HID_SPEEDLINK=m
# CONFIG_HID_STEAM is not set
CONFIG_HID_STEELSERIES=m
CONFIG_HID_SUNPLUS=m
CONFIG_HID_RMI=m
CONFIG_HID_GREENASIA=m
# CONFIG_GREENASIA_FF is not set
CONFIG_HID_SMARTJOYPLUS=m
# CONFIG_SMARTJOYPLUS_FF is not set
# CONFIG_HID_TIVO is not set
CONFIG_HID_TOPSEED=m
# CONFIG_HID_THINGM is not set
# CONFIG_HID_THRUSTMASTER is not set
CONFIG_HID_UDRAW_PS3=m
# CONFIG_HID_WIIMOTE is not set
CONFIG_HID_XINMO=m
CONFIG_HID_ZEROPLUS=m
CONFIG_ZEROPLUS_FF=y
# CONFIG_HID_ZYDACRON is not set
CONFIG_HID_SENSOR_HUB=m
CONFIG_HID_SENSOR_CUSTOM_SENSOR=m
CONFIG_HID_ALPS=m

#
# I2C HID support
#
CONFIG_I2C_HID=m
CONFIG_USB_OHCI_LITTLE_ENDIAN=y
# CONFIG_USB_SUPPORT is not set
CONFIG_UWB=m
CONFIG_MMC=y
# CONFIG_MMC_BLOCK is not set
# CONFIG_SDIO_UART is not set
CONFIG_MMC_TEST=y

#
# MMC/SD/SDIO Host Controller Drivers
#
CONFIG_MMC_DEBUG=y
CONFIG_MMC_SDHCI=m
CONFIG_MMC_SDHCI_PLTFM=m
# CONFIG_MMC_GOLDFISH is not set
# CONFIG_MMC_SPI is not set
CONFIG_MMC_USDHI6ROL0=y
# CONFIG_MMC_CQHCI is not set
CONFIG_MMC_MTK=y
# CONFIG_MMC_SDHCI_XENON is not set
CONFIG_MEMSTICK=m
# CONFIG_MEMSTICK_DEBUG is not set

#
# MemoryStick drivers
#
# CONFIG_MEMSTICK_UNSAFE_RESUME is not set
# CONFIG_MSPRO_BLOCK is not set
CONFIG_MS_BLOCK=m

#
# MemoryStick Host Controller Drivers
#
CONFIG_NEW_LEDS=y
CONFIG_LEDS_CLASS=y
# CONFIG_LEDS_CLASS_FLASH is not set
CONFIG_LEDS_BRIGHTNESS_HW_CHANGED=y

#
# LED drivers
#
CONFIG_LEDS_88PM860X=m
CONFIG_LEDS_LM3530=m
CONFIG_LEDS_LM3533=m
CONFIG_LEDS_LM3642=m
CONFIG_LEDS_PCA9532=y
CONFIG_LEDS_PCA9532_GPIO=y
CONFIG_LEDS_GPIO=m
CONFIG_LEDS_LP3944=m
# CONFIG_LEDS_LP3952 is not set
CONFIG_LEDS_LP55XX_COMMON=y
CONFIG_LEDS_LP5521=y
# CONFIG_LEDS_LP5523 is not set
CONFIG_LEDS_LP5562=m
CONFIG_LEDS_LP8501=y
CONFIG_LEDS_LP8788=m
CONFIG_LEDS_PCA955X=y
CONFIG_LEDS_PCA955X_GPIO=y
CONFIG_LEDS_PCA963X=m
# CONFIG_LEDS_WM831X_STATUS is not set
# CONFIG_LEDS_DA9052 is not set
CONFIG_LEDS_DAC124S085=y
CONFIG_LEDS_REGULATOR=y
CONFIG_LEDS_BD2802=y
CONFIG_LEDS_LT3593=m
# CONFIG_LEDS_MC13783 is not set
CONFIG_LEDS_TCA6507=y
# CONFIG_LEDS_TLC591XX is not set
CONFIG_LEDS_LM355x=m
CONFIG_LEDS_MENF21BMC=m

#
# LED driver for blink(1) USB RGB LED is under Special HID drivers (HID_THINGM)
#
CONFIG_LEDS_BLINKM=m
# CONFIG_LEDS_MLXREG is not set
CONFIG_LEDS_USER=m

#
# LED Triggers
#
CONFIG_LEDS_TRIGGERS=y
CONFIG_LEDS_TRIGGER_TIMER=m
# CONFIG_LEDS_TRIGGER_ONESHOT is not set
# CONFIG_LEDS_TRIGGER_DISK is not set
# CONFIG_LEDS_TRIGGER_MTD is not set
# CONFIG_LEDS_TRIGGER_HEARTBEAT is not set
CONFIG_LEDS_TRIGGER_BACKLIGHT=y
CONFIG_LEDS_TRIGGER_CPU=y
# CONFIG_LEDS_TRIGGER_ACTIVITY is not set
# CONFIG_LEDS_TRIGGER_GPIO is not set
# CONFIG_LEDS_TRIGGER_DEFAULT_ON is not set

#
# iptables trigger is under Netfilter config (LED target)
#
CONFIG_LEDS_TRIGGER_TRANSIENT=y
CONFIG_LEDS_TRIGGER_CAMERA=y
# CONFIG_LEDS_TRIGGER_PANIC is not set
# CONFIG_LEDS_TRIGGER_PATTERN is not set
# CONFIG_LEDS_TRIGGER_AUDIO is not set
CONFIG_ACCESSIBILITY=y
CONFIG_A11Y_BRAILLE_CONSOLE=y
CONFIG_EDAC_ATOMIC_SCRUB=y
CONFIG_EDAC_SUPPORT=y
CONFIG_RTC_LIB=y
CONFIG_RTC_MC146818_LIB=y
CONFIG_RTC_CLASS=y
CONFIG_RTC_HCTOSYS=y
CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
# CONFIG_RTC_SYSTOHC is not set
CONFIG_RTC_DEBUG=y
CONFIG_RTC_NVMEM=y

#
# RTC interfaces
#
# CONFIG_RTC_INTF_SYSFS is not set
# CONFIG_RTC_INTF_DEV is not set
CONFIG_RTC_DRV_TEST=y

#
# I2C RTC drivers
#
# CONFIG_RTC_DRV_88PM860X is not set
CONFIG_RTC_DRV_88PM80X=m
CONFIG_RTC_DRV_ABB5ZES3=m
CONFIG_RTC_DRV_ABX80X=m
CONFIG_RTC_DRV_DS1307=y
CONFIG_RTC_DRV_DS1307_CENTURY=y
CONFIG_RTC_DRV_DS1374=y
CONFIG_RTC_DRV_DS1374_WDT=y
# CONFIG_RTC_DRV_DS1672 is not set
CONFIG_RTC_DRV_LP8788=m
# CONFIG_RTC_DRV_MAX6900 is not set
CONFIG_RTC_DRV_MAX8907=m
CONFIG_RTC_DRV_MAX8998=m
# CONFIG_RTC_DRV_RS5C372 is not set
# CONFIG_RTC_DRV_ISL1208 is not set
# CONFIG_RTC_DRV_ISL12022 is not set
CONFIG_RTC_DRV_X1205=y
# CONFIG_RTC_DRV_PCF8523 is not set
CONFIG_RTC_DRV_PCF85063=m
CONFIG_RTC_DRV_PCF85363=y
CONFIG_RTC_DRV_PCF8563=m
# CONFIG_RTC_DRV_PCF8583 is not set
# CONFIG_RTC_DRV_M41T80 is not set
# CONFIG_RTC_DRV_BQ32K is not set
CONFIG_RTC_DRV_PALMAS=m
# CONFIG_RTC_DRV_TPS65910 is not set
CONFIG_RTC_DRV_S35390A=m
# CONFIG_RTC_DRV_FM3130 is not set
# CONFIG_RTC_DRV_RX8010 is not set
CONFIG_RTC_DRV_RX8581=y
CONFIG_RTC_DRV_RX8025=m
# CONFIG_RTC_DRV_EM3027 is not set
CONFIG_RTC_DRV_RV8803=y
CONFIG_RTC_DRV_S5M=m

#
# SPI RTC drivers
#
CONFIG_RTC_DRV_M41T93=y
# CONFIG_RTC_DRV_M41T94 is not set
CONFIG_RTC_DRV_DS1302=y
CONFIG_RTC_DRV_DS1305=y
CONFIG_RTC_DRV_DS1343=m
# CONFIG_RTC_DRV_DS1347 is not set
# CONFIG_RTC_DRV_DS1390 is not set
# CONFIG_RTC_DRV_MAX6916 is not set
CONFIG_RTC_DRV_R9701=m
CONFIG_RTC_DRV_RX4581=y
CONFIG_RTC_DRV_RX6110=m
CONFIG_RTC_DRV_RS5C348=y
# CONFIG_RTC_DRV_MAX6902 is not set
CONFIG_RTC_DRV_PCF2123=m
CONFIG_RTC_DRV_MCP795=m
CONFIG_RTC_I2C_AND_SPI=y

#
# SPI and I2C RTC drivers
#
CONFIG_RTC_DRV_DS3232=y
CONFIG_RTC_DRV_DS3232_HWMON=y
CONFIG_RTC_DRV_PCF2127=y
# CONFIG_RTC_DRV_RV3029C2 is not set

#
# Platform RTC drivers
#
CONFIG_RTC_DRV_CMOS=y
CONFIG_RTC_DRV_DS1286=m
CONFIG_RTC_DRV_DS1511=m
# CONFIG_RTC_DRV_DS1553 is not set
# CONFIG_RTC_DRV_DS1685_FAMILY is not set
CONFIG_RTC_DRV_DS1742=y
CONFIG_RTC_DRV_DS2404=m
# CONFIG_RTC_DRV_DA9052 is not set
CONFIG_RTC_DRV_DA9055=m
CONFIG_RTC_DRV_DA9063=m
# CONFIG_RTC_DRV_STK17TA8 is not set
CONFIG_RTC_DRV_M48T86=y
CONFIG_RTC_DRV_M48T35=y
CONFIG_RTC_DRV_M48T59=y
CONFIG_RTC_DRV_MSM6242=m
# CONFIG_RTC_DRV_BQ4802 is not set
CONFIG_RTC_DRV_RP5C01=m
CONFIG_RTC_DRV_V3020=y
# CONFIG_RTC_DRV_WM831X is not set
# CONFIG_RTC_DRV_PCF50633 is not set
CONFIG_RTC_DRV_AB3100=y

#
# on-CPU RTC drivers
#
CONFIG_RTC_DRV_FTRTC010=y
# CONFIG_RTC_DRV_MC13XXX is not set

#
# HID Sensor RTC drivers
#
CONFIG_DMADEVICES=y
CONFIG_DMADEVICES_DEBUG=y
CONFIG_DMADEVICES_VDEBUG=y

#
# DMA Devices
#
CONFIG_DMA_ENGINE=y
# CONFIG_ALTERA_MSGDMA is not set
# CONFIG_INTEL_IDMA64 is not set
# CONFIG_QCOM_HIDMA_MGMT is not set
# CONFIG_QCOM_HIDMA is not set
CONFIG_DW_DMAC_CORE=m
CONFIG_DW_DMAC=m

#
# DMA Clients
#
# CONFIG_ASYNC_TX_DMA is not set
# CONFIG_DMATEST is not set

#
# DMABUF options
#
CONFIG_SYNC_FILE=y
CONFIG_SW_SYNC=y
# CONFIG_UDMABUF is not set
# CONFIG_AUXDISPLAY is not set
# CONFIG_PANEL is not set
# CONFIG_UIO is not set
CONFIG_VIRT_DRIVERS=y
CONFIG_VIRTIO=y
CONFIG_VIRTIO_MENU=y
CONFIG_VIRTIO_BALLOON=y
# CONFIG_VIRTIO_INPUT is not set
# CONFIG_VIRTIO_MMIO is not set

#
# Microsoft Hyper-V guest support
#

#
# Xen driver support
#
CONFIG_XEN_BALLOON=y
# CONFIG_XEN_BALLOON_MEMORY_HOTPLUG is not set
CONFIG_XEN_SCRUB_PAGES_DEFAULT=y
# CONFIG_XEN_DEV_EVTCHN is not set
# CONFIG_XEN_BACKEND is not set
# CONFIG_XENFS is not set
CONFIG_XEN_SYS_HYPERVISOR=y
CONFIG_XEN_XENBUS_FRONTEND=y
CONFIG_XEN_GNTDEV=y
CONFIG_XEN_GRANT_DEV_ALLOC=y
# CONFIG_XEN_GRANT_DMA_ALLOC is not set
CONFIG_SWIOTLB_XEN=y
CONFIG_XEN_TMEM=m
CONFIG_XEN_PRIVCMD=m
# CONFIG_STAGING is not set
# CONFIG_X86_PLATFORM_DEVICES is not set
CONFIG_GOLDFISH_PIPE=y
CONFIG_CHROME_PLATFORMS=y
# CONFIG_CHROMEOS_PSTORE is not set
CONFIG_MELLANOX_PLATFORM=y
CONFIG_MLXREG_HOTPLUG=m
CONFIG_MLXREG_IO=m
CONFIG_HWSPINLOCK=y

#
# Clock Source drivers
#
CONFIG_CLKEVT_I8253=y
CONFIG_I8253_LOCK=y
CONFIG_CLKBLD_I8253=y
CONFIG_MAILBOX=y
# CONFIG_ALTERA_MBOX is not set
CONFIG_IOMMU_SUPPORT=y

#
# Generic IOMMU Pagetable Support
#
CONFIG_IOMMU_DEBUGFS=y

#
# Remoteproc drivers
#
CONFIG_REMOTEPROC=y

#
# Rpmsg drivers
#
CONFIG_RPMSG=y
CONFIG_RPMSG_QCOM_GLINK_NATIVE=y
CONFIG_RPMSG_QCOM_GLINK_RPM=y
CONFIG_RPMSG_VIRTIO=y
CONFIG_SOUNDWIRE=y

#
# SoundWire Devices
#

#
# SOC (System On Chip) specific Drivers
#

#
# Amlogic SoC drivers
#

#
# Broadcom SoC drivers
#

#
# NXP/Freescale QorIQ SoC drivers
#

#
# i.MX SoC drivers
#

#
# Qualcomm SoC drivers
#
# CONFIG_SOC_TI is not set

#
# Xilinx SoC drivers
#
# CONFIG_XILINX_VCU is not set
CONFIG_PM_DEVFREQ=y

#
# DEVFREQ Governors
#
CONFIG_DEVFREQ_GOV_SIMPLE_ONDEMAND=y
CONFIG_DEVFREQ_GOV_PERFORMANCE=y
CONFIG_DEVFREQ_GOV_POWERSAVE=y
# CONFIG_DEVFREQ_GOV_USERSPACE is not set
# CONFIG_DEVFREQ_GOV_PASSIVE is not set

#
# DEVFREQ Drivers
#
CONFIG_PM_DEVFREQ_EVENT=y
CONFIG_EXTCON=m

#
# Extcon Device Drivers
#
CONFIG_EXTCON_ADC_JACK=m
# CONFIG_EXTCON_GPIO is not set
CONFIG_EXTCON_MAX3355=m
# CONFIG_EXTCON_MAX77693 is not set
CONFIG_EXTCON_MAX77843=m
CONFIG_EXTCON_PALMAS=m
CONFIG_EXTCON_RT8973A=m
CONFIG_EXTCON_SM5502=m
# CONFIG_EXTCON_USB_GPIO is not set
CONFIG_MEMORY=y
CONFIG_IIO=y
CONFIG_IIO_BUFFER=y
CONFIG_IIO_BUFFER_CB=y
# CONFIG_IIO_BUFFER_HW_CONSUMER is not set
CONFIG_IIO_KFIFO_BUF=y
CONFIG_IIO_TRIGGERED_BUFFER=y
CONFIG_IIO_CONFIGFS=m
CONFIG_IIO_TRIGGER=y
CONFIG_IIO_CONSUMERS_PER_TRIGGER=2
CONFIG_IIO_SW_DEVICE=m
CONFIG_IIO_SW_TRIGGER=m

#
# Accelerometers
#
# CONFIG_ADIS16201 is not set
# CONFIG_ADIS16209 is not set
# CONFIG_ADXL372_SPI is not set
# CONFIG_ADXL372_I2C is not set
CONFIG_BMA180=m
# CONFIG_BMA220 is not set
CONFIG_BMC150_ACCEL=y
CONFIG_BMC150_ACCEL_I2C=y
CONFIG_BMC150_ACCEL_SPI=y
# CONFIG_DA280 is not set
# CONFIG_DA311 is not set
CONFIG_DMARD09=m
CONFIG_DMARD10=y
CONFIG_HID_SENSOR_ACCEL_3D=m
CONFIG_IIO_CROS_EC_ACCEL_LEGACY=m
# CONFIG_IIO_ST_ACCEL_3AXIS is not set
CONFIG_KXSD9=m
# CONFIG_KXSD9_SPI is not set
CONFIG_KXSD9_I2C=m
CONFIG_KXCJK1013=m
CONFIG_MC3230=m
# CONFIG_MMA7455_I2C is not set
# CONFIG_MMA7455_SPI is not set
# CONFIG_MMA7660 is not set
CONFIG_MMA8452=y
CONFIG_MMA9551_CORE=m
CONFIG_MMA9551=m
# CONFIG_MMA9553 is not set
CONFIG_MXC4005=m
CONFIG_MXC6255=y
CONFIG_SCA3000=y
CONFIG_STK8312=m
CONFIG_STK8BA50=m

#
# Analog to digital converters
#
CONFIG_AD_SIGMA_DELTA=y
# CONFIG_AD7124 is not set
# CONFIG_AD7266 is not set
CONFIG_AD7291=m
CONFIG_AD7298=y
CONFIG_AD7476=y
CONFIG_AD7766=m
# CONFIG_AD7791 is not set
CONFIG_AD7793=y
# CONFIG_AD7887 is not set
CONFIG_AD7923=m
# CONFIG_AD7949 is not set
CONFIG_AD799X=y
# CONFIG_AXP20X_ADC is not set
CONFIG_AXP288_ADC=m
CONFIG_DA9150_GPADC=m
# CONFIG_HI8435 is not set
CONFIG_HX711=m
CONFIG_LP8788_ADC=y
CONFIG_LTC2471=y
CONFIG_LTC2485=y
CONFIG_LTC2497=m
# CONFIG_MAX1027 is not set
CONFIG_MAX11100=y
CONFIG_MAX1118=y
CONFIG_MAX1363=m
CONFIG_MAX9611=m
CONFIG_MCP320X=m
CONFIG_MCP3422=y
CONFIG_MCP3911=m
# CONFIG_MEN_Z188_ADC is not set
CONFIG_NAU7802=y
CONFIG_PALMAS_GPADC=y
CONFIG_STX104=y
CONFIG_TI_ADC081C=m
CONFIG_TI_ADC0832=y
# CONFIG_TI_ADC084S021 is not set
CONFIG_TI_ADC12138=m
# CONFIG_TI_ADC108S102 is not set
# CONFIG_TI_ADC128S052 is not set
# CONFIG_TI_ADC161S626 is not set
CONFIG_TI_ADS1015=y
# CONFIG_TI_ADS7950 is not set
# CONFIG_TI_TLC4541 is not set

#
# Analog Front Ends
#

#
# Amplifiers
#
CONFIG_AD8366=y

#
# Chemical Sensors
#
CONFIG_ATLAS_PH_SENSOR=m
CONFIG_BME680=m
CONFIG_BME680_I2C=m
CONFIG_BME680_SPI=m
# CONFIG_CCS811 is not set
CONFIG_IAQCORE=m
CONFIG_VZ89X=y

#
# Hid Sensor IIO Common
#
CONFIG_HID_SENSOR_IIO_COMMON=m
CONFIG_HID_SENSOR_IIO_TRIGGER=m
CONFIG_IIO_MS_SENSORS_I2C=y

#
# SSP Sensor Common
#
CONFIG_IIO_SSP_SENSORS_COMMONS=y
CONFIG_IIO_SSP_SENSORHUB=y
CONFIG_IIO_ST_SENSORS_I2C=y
CONFIG_IIO_ST_SENSORS_SPI=y
CONFIG_IIO_ST_SENSORS_CORE=y

#
# Counters
#
CONFIG_104_QUAD_8=y

#
# Digital to analog converters
#
CONFIG_AD5064=y
CONFIG_AD5360=y
# CONFIG_AD5380 is not set
CONFIG_AD5421=m
CONFIG_AD5446=y
CONFIG_AD5449=y
CONFIG_AD5592R_BASE=y
CONFIG_AD5592R=m
CONFIG_AD5593R=y
# CONFIG_AD5504 is not set
CONFIG_AD5624R_SPI=y
# CONFIG_LTC1660 is not set
CONFIG_LTC2632=m
# CONFIG_AD5686_SPI is not set
# CONFIG_AD5696_I2C is not set
# CONFIG_AD5755 is not set
CONFIG_AD5758=y
# CONFIG_AD5761 is not set
CONFIG_AD5764=m
CONFIG_AD5791=y
CONFIG_AD7303=m
CONFIG_CIO_DAC=m
# CONFIG_AD8801 is not set
CONFIG_DS4424=m
# CONFIG_M62332 is not set
CONFIG_MAX517=m
CONFIG_MCP4725=m
CONFIG_MCP4922=m
CONFIG_TI_DAC082S085=y
CONFIG_TI_DAC5571=y
CONFIG_TI_DAC7311=m

#
# IIO dummy driver
#
# CONFIG_IIO_SIMPLE_DUMMY is not set

#
# Frequency Synthesizers DDS/PLL
#

#
# Clock Generator/Distribution
#
# CONFIG_AD9523 is not set

#
# Phase-Locked Loop (PLL) frequency synthesizers
#
# CONFIG_ADF4350 is not set

#
# Digital gyroscope sensors
#
# CONFIG_ADIS16080 is not set
CONFIG_ADIS16130=y
# CONFIG_ADIS16136 is not set
CONFIG_ADIS16260=y
# CONFIG_ADXRS450 is not set
# CONFIG_BMG160 is not set
# CONFIG_HID_SENSOR_GYRO_3D is not set
# CONFIG_MPU3050_I2C is not set
CONFIG_IIO_ST_GYRO_3AXIS=y
CONFIG_IIO_ST_GYRO_I2C_3AXIS=y
CONFIG_IIO_ST_GYRO_SPI_3AXIS=y
CONFIG_ITG3200=m

#
# Health Sensors
#

#
# Heart Rate Monitors
#
# CONFIG_AFE4403 is not set
CONFIG_AFE4404=m
CONFIG_MAX30100=y
CONFIG_MAX30102=m

#
# Humidity sensors
#
CONFIG_AM2315=m
# CONFIG_DHT11 is not set
# CONFIG_HDC100X is not set
CONFIG_HID_SENSOR_HUMIDITY=m
# CONFIG_HTS221 is not set
CONFIG_HTU21=y
# CONFIG_SI7005 is not set
# CONFIG_SI7020 is not set

#
# Inertial measurement units
#
CONFIG_ADIS16400=y
# CONFIG_ADIS16480 is not set
CONFIG_BMI160=y
CONFIG_BMI160_I2C=y
# CONFIG_BMI160_SPI is not set
CONFIG_KMX61=m
CONFIG_INV_MPU6050_IIO=y
CONFIG_INV_MPU6050_I2C=m
CONFIG_INV_MPU6050_SPI=y
CONFIG_IIO_ST_LSM6DSX=m
CONFIG_IIO_ST_LSM6DSX_I2C=m
CONFIG_IIO_ST_LSM6DSX_SPI=m
CONFIG_IIO_ADIS_LIB=y
CONFIG_IIO_ADIS_LIB_BUFFER=y

#
# Light sensors
#
CONFIG_ADJD_S311=y
# CONFIG_AL3320A is not set
# CONFIG_APDS9300 is not set
# CONFIG_APDS9960 is not set
CONFIG_BH1750=m
CONFIG_BH1780=m
CONFIG_CM32181=y
CONFIG_CM3232=y
CONFIG_CM3323=y
# CONFIG_CM36651 is not set
CONFIG_GP2AP020A00F=y
# CONFIG_SENSORS_ISL29018 is not set
CONFIG_SENSORS_ISL29028=m
CONFIG_ISL29125=y
CONFIG_HID_SENSOR_ALS=m
CONFIG_HID_SENSOR_PROX=m
CONFIG_JSA1212=y
CONFIG_RPR0521=y
CONFIG_SENSORS_LM3533=m
CONFIG_LTR501=y
CONFIG_LV0104CS=m
CONFIG_MAX44000=y
# CONFIG_OPT3001 is not set
# CONFIG_PA12203001 is not set
CONFIG_SI1133=m
# CONFIG_SI1145 is not set
CONFIG_STK3310=y
# CONFIG_ST_UVIS25 is not set
CONFIG_TCS3414=y
CONFIG_TCS3472=y
CONFIG_SENSORS_TSL2563=y
CONFIG_TSL2583=y
# CONFIG_TSL2772 is not set
CONFIG_TSL4531=y
CONFIG_US5182D=m
CONFIG_VCNL4000=y
# CONFIG_VCNL4035 is not set
CONFIG_VEML6070=m
# CONFIG_VL6180 is not set
CONFIG_ZOPT2201=m

#
# Magnetometer sensors
#
CONFIG_AK8975=m
CONFIG_AK09911=m
CONFIG_BMC150_MAGN=y
CONFIG_BMC150_MAGN_I2C=y
# CONFIG_BMC150_MAGN_SPI is not set
CONFIG_MAG3110=m
# CONFIG_HID_SENSOR_MAGNETOMETER_3D is not set
CONFIG_MMC35240=y
CONFIG_IIO_ST_MAGN_3AXIS=m
CONFIG_IIO_ST_MAGN_I2C_3AXIS=m
CONFIG_IIO_ST_MAGN_SPI_3AXIS=m
CONFIG_SENSORS_HMC5843=y
CONFIG_SENSORS_HMC5843_I2C=y
# CONFIG_SENSORS_HMC5843_SPI is not set
# CONFIG_SENSORS_RM3100_I2C is not set
# CONFIG_SENSORS_RM3100_SPI is not set

#
# Multiplexers
#

#
# Inclinometer sensors
#
CONFIG_HID_SENSOR_INCLINOMETER_3D=m
CONFIG_HID_SENSOR_DEVICE_ROTATION=m

#
# Triggers - standalone
#
CONFIG_IIO_HRTIMER_TRIGGER=m
CONFIG_IIO_INTERRUPT_TRIGGER=y
CONFIG_IIO_TIGHTLOOP_TRIGGER=m
CONFIG_IIO_SYSFS_TRIGGER=m

#
# Digital potentiometers
#
CONFIG_AD5272=m
CONFIG_DS1803=y
CONFIG_MAX5481=m
CONFIG_MAX5487=y
# CONFIG_MCP4018 is not set
CONFIG_MCP4131=y
CONFIG_MCP4531=m
CONFIG_MCP41010=m
# CONFIG_TPL0102 is not set

#
# Digital potentiostats
#
CONFIG_LMP91000=y

#
# Pressure sensors
#
CONFIG_ABP060MG=y
# CONFIG_BMP280 is not set
# CONFIG_HID_SENSOR_PRESS is not set
CONFIG_HP03=y
# CONFIG_MPL115_I2C is not set
# CONFIG_MPL115_SPI is not set
CONFIG_MPL3115=y
# CONFIG_MS5611 is not set
# CONFIG_MS5637 is not set
CONFIG_IIO_ST_PRESS=m
CONFIG_IIO_ST_PRESS_I2C=m
CONFIG_IIO_ST_PRESS_SPI=m
CONFIG_T5403=m
CONFIG_HP206C=y
# CONFIG_ZPA2326 is not set

#
# Lightning sensors
#
CONFIG_AS3935=y

#
# Proximity and distance sensors
#
CONFIG_ISL29501=m
# CONFIG_LIDAR_LITE_V2 is not set
CONFIG_RFD77402=y
CONFIG_SRF04=m
CONFIG_SX9500=y
# CONFIG_SRF08 is not set
# CONFIG_VL53L0X_I2C is not set

#
# Resolver to digital converters
#
# CONFIG_AD2S90 is not set
# CONFIG_AD2S1200 is not set

#
# Temperature sensors
#
CONFIG_MAXIM_THERMOCOUPLE=m
# CONFIG_HID_SENSOR_TEMP is not set
CONFIG_MLX90614=m
CONFIG_MLX90632=m
# CONFIG_TMP006 is not set
CONFIG_TMP007=y
CONFIG_TSYS01=y
CONFIG_TSYS02D=m
# CONFIG_PWM is not set

#
# IRQ chip support
#
CONFIG_ARM_GIC_MAX_NR=1
CONFIG_IPACK_BUS=m
CONFIG_SERIAL_IPOCTAL=m
CONFIG_RESET_CONTROLLER=y
# CONFIG_RESET_TI_SYSCON is not set
CONFIG_FMC=m
CONFIG_FMC_FAKEDEV=m
CONFIG_FMC_TRIVIAL=m
CONFIG_FMC_WRITE_EEPROM=m
# CONFIG_FMC_CHARDEV is not set

#
# PHY Subsystem
#
CONFIG_GENERIC_PHY=y
CONFIG_BCM_KONA_USB2_PHY=m
# CONFIG_PHY_PXA_28NM_HSIC is not set
# CONFIG_PHY_PXA_28NM_USB2 is not set
CONFIG_POWERCAP=y
CONFIG_MCB=y
CONFIG_MCB_LPC=y

#
# Performance monitor support
#
# CONFIG_RAS is not set

#
# Android
#
# CONFIG_ANDROID is not set
CONFIG_LIBNVDIMM=m
CONFIG_BLK_DEV_PMEM=m
CONFIG_ND_BLK=m
# CONFIG_BTT is not set
CONFIG_NVDIMM_KEYS=y
CONFIG_DAX_DRIVER=y
CONFIG_DAX=y
CONFIG_DEV_DAX=y
CONFIG_NVMEM=y

#
# HW tracing support
#
# CONFIG_STM is not set
CONFIG_INTEL_TH=m
# CONFIG_INTEL_TH_GTH is not set
CONFIG_INTEL_TH_MSU=m
CONFIG_INTEL_TH_PTI=m
# CONFIG_INTEL_TH_DEBUG is not set
# CONFIG_FPGA is not set
CONFIG_PM_OPP=y
CONFIG_SIOX=y
# CONFIG_SIOX_BUS_GPIO is not set
CONFIG_SLIMBUS=m
CONFIG_SLIM_QCOM_CTRL=m

#
# File systems
#
CONFIG_DCACHE_WORD_ACCESS=y
CONFIG_FS_IOMAP=y
CONFIG_EXT2_FS=y
# CONFIG_EXT2_FS_XATTR is not set
CONFIG_EXT3_FS=y
# CONFIG_EXT3_FS_POSIX_ACL is not set
# CONFIG_EXT3_FS_SECURITY is not set
CONFIG_EXT4_FS=y
CONFIG_EXT4_FS_POSIX_ACL=y
CONFIG_EXT4_FS_SECURITY=y
# CONFIG_EXT4_ENCRYPTION is not set
# CONFIG_EXT4_DEBUG is not set
CONFIG_JBD2=y
CONFIG_JBD2_DEBUG=y
CONFIG_FS_MBCACHE=y
# CONFIG_REISERFS_FS is not set
CONFIG_JFS_FS=m
# CONFIG_JFS_POSIX_ACL is not set
# CONFIG_JFS_SECURITY is not set
# CONFIG_JFS_DEBUG is not set
CONFIG_JFS_STATISTICS=y
CONFIG_XFS_FS=m
# CONFIG_XFS_QUOTA is not set
CONFIG_XFS_POSIX_ACL=y
CONFIG_XFS_RT=y
# CONFIG_XFS_ONLINE_SCRUB is not set
CONFIG_XFS_DEBUG=y
CONFIG_XFS_ASSERT_FATAL=y
CONFIG_GFS2_FS=m
CONFIG_BTRFS_FS=m
# CONFIG_BTRFS_FS_POSIX_ACL is not set
# CONFIG_BTRFS_FS_CHECK_INTEGRITY is not set
# CONFIG_BTRFS_FS_RUN_SANITY_TESTS is not set
# CONFIG_BTRFS_DEBUG is not set
CONFIG_BTRFS_ASSERT=y
# CONFIG_BTRFS_FS_REF_VERIFY is not set
CONFIG_NILFS2_FS=y
CONFIG_F2FS_FS=m
CONFIG_F2FS_STAT_FS=y
CONFIG_F2FS_FS_XATTR=y
# CONFIG_F2FS_FS_POSIX_ACL is not set
# CONFIG_F2FS_FS_SECURITY is not set
# CONFIG_F2FS_CHECK_FS is not set
CONFIG_F2FS_FS_ENCRYPTION=y
# CONFIG_F2FS_IO_TRACE is not set
CONFIG_F2FS_FAULT_INJECTION=y
CONFIG_FS_DAX=y
CONFIG_FS_POSIX_ACL=y
CONFIG_EXPORTFS=m
CONFIG_EXPORTFS_BLOCK_OPS=y
CONFIG_FILE_LOCKING=y
# CONFIG_MANDATORY_FILE_LOCKING is not set
CONFIG_FS_ENCRYPTION=m
CONFIG_FSNOTIFY=y
# CONFIG_DNOTIFY is not set
CONFIG_INOTIFY_USER=y
CONFIG_FANOTIFY=y
CONFIG_QUOTA=y
# CONFIG_PRINT_QUOTA_WARNING is not set
# CONFIG_QUOTA_DEBUG is not set
CONFIG_QUOTA_TREE=m
CONFIG_QFMT_V1=y
CONFIG_QFMT_V2=m
CONFIG_QUOTACTL=y
CONFIG_AUTOFS4_FS=m
CONFIG_AUTOFS_FS=m
# CONFIG_FUSE_FS is not set
CONFIG_OVERLAY_FS=m
CONFIG_OVERLAY_FS_REDIRECT_DIR=y
CONFIG_OVERLAY_FS_REDIRECT_ALWAYS_FOLLOW=y
CONFIG_OVERLAY_FS_INDEX=y
CONFIG_OVERLAY_FS_NFS_EXPORT=y
CONFIG_OVERLAY_FS_XINO_AUTO=y
# CONFIG_OVERLAY_FS_METACOPY is not set

#
# Caches
#
CONFIG_FSCACHE=y
CONFIG_FSCACHE_DEBUG=y
CONFIG_CACHEFILES=y
# CONFIG_CACHEFILES_DEBUG is not set

#
# CD-ROM/DVD Filesystems
#
CONFIG_ISO9660_FS=m
CONFIG_JOLIET=y
# CONFIG_ZISOFS is not set
CONFIG_UDF_FS=y

#
# DOS/FAT/NT Filesystems
#
CONFIG_FAT_FS=m
CONFIG_MSDOS_FS=m
CONFIG_VFAT_FS=m
CONFIG_FAT_DEFAULT_CODEPAGE=437
CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
CONFIG_FAT_DEFAULT_UTF8=y
CONFIG_NTFS_FS=y
# CONFIG_NTFS_DEBUG is not set
# CONFIG_NTFS_RW is not set

#
# Pseudo filesystems
#
# CONFIG_PROC_FS is not set
CONFIG_PROC_CHILDREN=y
CONFIG_KERNFS=y
CONFIG_SYSFS=y
CONFIG_HUGETLBFS=y
CONFIG_HUGETLB_PAGE=y
CONFIG_MEMFD_CREATE=y
CONFIG_CONFIGFS_FS=y
CONFIG_MISC_FILESYSTEMS=y
CONFIG_ORANGEFS_FS=m
# CONFIG_ADFS_FS is not set
CONFIG_AFFS_FS=m
CONFIG_ECRYPT_FS=y
CONFIG_ECRYPT_FS_MESSAGING=y
# CONFIG_HFS_FS is not set
CONFIG_HFSPLUS_FS=y
CONFIG_BEFS_FS=m
# CONFIG_BEFS_DEBUG is not set
CONFIG_BFS_FS=y
# CONFIG_EFS_FS is not set
CONFIG_JFFS2_FS=m
CONFIG_JFFS2_FS_DEBUG=0
# CONFIG_JFFS2_FS_WRITEBUFFER is not set
# CONFIG_JFFS2_SUMMARY is not set
# CONFIG_JFFS2_FS_XATTR is not set
# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set
CONFIG_JFFS2_ZLIB=y
CONFIG_JFFS2_RTIME=y
CONFIG_UBIFS_FS=m
# CONFIG_UBIFS_FS_ADVANCED_COMPR is not set
CONFIG_UBIFS_FS_LZO=y
CONFIG_UBIFS_FS_ZLIB=y
CONFIG_UBIFS_ATIME_SUPPORT=y
CONFIG_UBIFS_FS_XATTR=y
CONFIG_UBIFS_FS_ENCRYPTION=y
# CONFIG_UBIFS_FS_SECURITY is not set
CONFIG_UBIFS_FS_AUTHENTICATION=y
CONFIG_CRAMFS=y
# CONFIG_CRAMFS_BLOCKDEV is not set
CONFIG_SQUASHFS=m
CONFIG_SQUASHFS_FILE_CACHE=y
# CONFIG_SQUASHFS_FILE_DIRECT is not set
# CONFIG_SQUASHFS_DECOMP_SINGLE is not set
CONFIG_SQUASHFS_DECOMP_MULTI=y
# CONFIG_SQUASHFS_DECOMP_MULTI_PERCPU is not set
CONFIG_SQUASHFS_XATTR=y
CONFIG_SQUASHFS_ZLIB=y
# CONFIG_SQUASHFS_LZ4 is not set
CONFIG_SQUASHFS_LZO=y
CONFIG_SQUASHFS_XZ=y
CONFIG_SQUASHFS_ZSTD=y
# CONFIG_SQUASHFS_4K_DEVBLK_SIZE is not set
CONFIG_SQUASHFS_EMBEDDED=y
CONFIG_SQUASHFS_FRAGMENT_CACHE_SIZE=3
CONFIG_VXFS_FS=y
# CONFIG_MINIX_FS is not set
CONFIG_OMFS_FS=y
CONFIG_HPFS_FS=m
CONFIG_QNX4FS_FS=y
# CONFIG_QNX6FS_FS is not set
CONFIG_ROMFS_FS=m
# CONFIG_ROMFS_BACKED_BY_BLOCK is not set
# CONFIG_ROMFS_BACKED_BY_MTD is not set
CONFIG_ROMFS_BACKED_BY_BOTH=y
CONFIG_ROMFS_ON_BLOCK=y
CONFIG_ROMFS_ON_MTD=y
# CONFIG_PSTORE is not set
CONFIG_SYSV_FS=m
# CONFIG_UFS_FS is not set
CONFIG_EXOFS_FS=m
# CONFIG_EXOFS_DEBUG is not set
CONFIG_ORE=m
CONFIG_NLS=y
CONFIG_NLS_DEFAULT="iso8859-1"
# CONFIG_NLS_CODEPAGE_437 is not set
CONFIG_NLS_CODEPAGE_737=m
CONFIG_NLS_CODEPAGE_775=y
# CONFIG_NLS_CODEPAGE_850 is not set
CONFIG_NLS_CODEPAGE_852=m
CONFIG_NLS_CODEPAGE_855=y
# CONFIG_NLS_CODEPAGE_857 is not set
# CONFIG_NLS_CODEPAGE_860 is not set
CONFIG_NLS_CODEPAGE_861=y
# CONFIG_NLS_CODEPAGE_862 is not set
CONFIG_NLS_CODEPAGE_863=m
CONFIG_NLS_CODEPAGE_864=m
# CONFIG_NLS_CODEPAGE_865 is not set
# CONFIG_NLS_CODEPAGE_866 is not set
CONFIG_NLS_CODEPAGE_869=m
# CONFIG_NLS_CODEPAGE_936 is not set
CONFIG_NLS_CODEPAGE_950=y
CONFIG_NLS_CODEPAGE_932=m
# CONFIG_NLS_CODEPAGE_949 is not set
# CONFIG_NLS_CODEPAGE_874 is not set
CONFIG_NLS_ISO8859_8=m
CONFIG_NLS_CODEPAGE_1250=m
# CONFIG_NLS_CODEPAGE_1251 is not set
CONFIG_NLS_ASCII=m
# CONFIG_NLS_ISO8859_1 is not set
CONFIG_NLS_ISO8859_2=y
CONFIG_NLS_ISO8859_3=y
CONFIG_NLS_ISO8859_4=m
CONFIG_NLS_ISO8859_5=m
CONFIG_NLS_ISO8859_6=m
# CONFIG_NLS_ISO8859_7 is not set
# CONFIG_NLS_ISO8859_9 is not set
# CONFIG_NLS_ISO8859_13 is not set
CONFIG_NLS_ISO8859_14=y
# CONFIG_NLS_ISO8859_15 is not set
CONFIG_NLS_KOI8_R=m
CONFIG_NLS_KOI8_U=y
CONFIG_NLS_MAC_ROMAN=y
# CONFIG_NLS_MAC_CELTIC is not set
CONFIG_NLS_MAC_CENTEURO=y
# CONFIG_NLS_MAC_CROATIAN is not set
CONFIG_NLS_MAC_CYRILLIC=m
CONFIG_NLS_MAC_GAELIC=m
CONFIG_NLS_MAC_GREEK=m
# CONFIG_NLS_MAC_ICELAND is not set
CONFIG_NLS_MAC_INUIT=m
CONFIG_NLS_MAC_ROMANIAN=y
CONFIG_NLS_MAC_TURKISH=y
CONFIG_NLS_UTF8=y

#
# Security options
#
CONFIG_KEYS=y
# CONFIG_PERSISTENT_KEYRINGS is not set
CONFIG_TRUSTED_KEYS=m
CONFIG_ENCRYPTED_KEYS=y
CONFIG_KEY_DH_OPERATIONS=y
CONFIG_SECURITY_DMESG_RESTRICT=y
CONFIG_SECURITYFS=y
CONFIG_PAGE_TABLE_ISOLATION=y
CONFIG_HAVE_HARDENED_USERCOPY_ALLOCATOR=y
CONFIG_HARDENED_USERCOPY=y
CONFIG_HARDENED_USERCOPY_FALLBACK=y
CONFIG_HARDENED_USERCOPY_PAGESPAN=y
# CONFIG_FORTIFY_SOURCE is not set
CONFIG_STATIC_USERMODEHELPER=y
CONFIG_STATIC_USERMODEHELPER_PATH="/sbin/usermode-helper"
CONFIG_DEFAULT_SECURITY_DAC=y
CONFIG_DEFAULT_SECURITY=""
CONFIG_XOR_BLOCKS=m
CONFIG_ASYNC_CORE=m
CONFIG_ASYNC_XOR=m
CONFIG_ASYNC_PQ=m
CONFIG_CRYPTO=y

#
# Crypto core or helper
#
# CONFIG_CRYPTO_FIPS is not set
CONFIG_CRYPTO_ALGAPI=y
CONFIG_CRYPTO_ALGAPI2=y
CONFIG_CRYPTO_AEAD=y
CONFIG_CRYPTO_AEAD2=y
CONFIG_CRYPTO_BLKCIPHER=y
CONFIG_CRYPTO_BLKCIPHER2=y
CONFIG_CRYPTO_HASH=y
CONFIG_CRYPTO_HASH2=y
CONFIG_CRYPTO_RNG=y
CONFIG_CRYPTO_RNG2=y
CONFIG_CRYPTO_RNG_DEFAULT=m
CONFIG_CRYPTO_AKCIPHER2=y
CONFIG_CRYPTO_AKCIPHER=y
CONFIG_CRYPTO_KPP2=y
CONFIG_CRYPTO_KPP=y
CONFIG_CRYPTO_ACOMP2=y
CONFIG_CRYPTO_RSA=y
CONFIG_CRYPTO_DH=y
# CONFIG_CRYPTO_ECDH is not set
CONFIG_CRYPTO_MANAGER=y
CONFIG_CRYPTO_MANAGER2=y
# CONFIG_CRYPTO_MANAGER_DISABLE_TESTS is not set
CONFIG_CRYPTO_GF128MUL=y
CONFIG_CRYPTO_NULL=y
CONFIG_CRYPTO_NULL2=y
CONFIG_CRYPTO_PCRYPT=m
CONFIG_CRYPTO_WORKQUEUE=y
CONFIG_CRYPTO_CRYPTD=y
CONFIG_CRYPTO_AUTHENC=y
CONFIG_CRYPTO_TEST=m
CONFIG_CRYPTO_SIMD=y
CONFIG_CRYPTO_GLUE_HELPER_X86=y
CONFIG_CRYPTO_ENGINE=m

#
# Authenticated Encryption with Associated Data
#
# CONFIG_CRYPTO_CCM is not set
CONFIG_CRYPTO_GCM=m
CONFIG_CRYPTO_CHACHA20POLY1305=y
# CONFIG_CRYPTO_AEGIS128 is not set
# CONFIG_CRYPTO_AEGIS128L is not set
# CONFIG_CRYPTO_AEGIS256 is not set
# CONFIG_CRYPTO_AEGIS128_AESNI_SSE2 is not set
CONFIG_CRYPTO_AEGIS128L_AESNI_SSE2=y
CONFIG_CRYPTO_AEGIS256_AESNI_SSE2=m
# CONFIG_CRYPTO_MORUS640 is not set
CONFIG_CRYPTO_MORUS640_GLUE=y
CONFIG_CRYPTO_MORUS640_SSE2=y
CONFIG_CRYPTO_MORUS1280=y
CONFIG_CRYPTO_MORUS1280_GLUE=m
# CONFIG_CRYPTO_MORUS1280_SSE2 is not set
CONFIG_CRYPTO_MORUS1280_AVX2=m
CONFIG_CRYPTO_SEQIV=m
CONFIG_CRYPTO_ECHAINIV=m

#
# Block modes
#
CONFIG_CRYPTO_CBC=y
# CONFIG_CRYPTO_CFB is not set
CONFIG_CRYPTO_CTR=m
CONFIG_CRYPTO_CTS=y
CONFIG_CRYPTO_ECB=y
CONFIG_CRYPTO_LRW=m
# CONFIG_CRYPTO_OFB is not set
CONFIG_CRYPTO_PCBC=y
CONFIG_CRYPTO_XTS=y
CONFIG_CRYPTO_KEYWRAP=m
CONFIG_CRYPTO_NHPOLY1305=y
CONFIG_CRYPTO_NHPOLY1305_SSE2=y
# CONFIG_CRYPTO_NHPOLY1305_AVX2 is not set
CONFIG_CRYPTO_ADIANTUM=y

#
# Hash modes
#
# CONFIG_CRYPTO_CMAC is not set
CONFIG_CRYPTO_HMAC=y
# CONFIG_CRYPTO_XCBC is not set
# CONFIG_CRYPTO_VMAC is not set

#
# Digest
#
CONFIG_CRYPTO_CRC32C=y
# CONFIG_CRYPTO_CRC32C_INTEL is not set
CONFIG_CRYPTO_CRC32=m
# CONFIG_CRYPTO_CRC32_PCLMUL is not set
CONFIG_CRYPTO_CRCT10DIF=y
CONFIG_CRYPTO_CRCT10DIF_PCLMUL=y
CONFIG_CRYPTO_GHASH=m
CONFIG_CRYPTO_POLY1305=y
CONFIG_CRYPTO_POLY1305_X86_64=m
# CONFIG_CRYPTO_MD4 is not set
CONFIG_CRYPTO_MD5=y
CONFIG_CRYPTO_MICHAEL_MIC=y
# CONFIG_CRYPTO_RMD128 is not set
CONFIG_CRYPTO_RMD160=y
CONFIG_CRYPTO_RMD256=m
CONFIG_CRYPTO_RMD320=y
CONFIG_CRYPTO_SHA1=m
# CONFIG_CRYPTO_SHA1_SSSE3 is not set
CONFIG_CRYPTO_SHA256_SSSE3=y
# CONFIG_CRYPTO_SHA512_SSSE3 is not set
CONFIG_CRYPTO_SHA256=y
# CONFIG_CRYPTO_SHA512 is not set
CONFIG_CRYPTO_SHA3=y
# CONFIG_CRYPTO_SM3 is not set
CONFIG_CRYPTO_STREEBOG=m
CONFIG_CRYPTO_TGR192=m
CONFIG_CRYPTO_WP512=m
CONFIG_CRYPTO_GHASH_CLMUL_NI_INTEL=m

#
# Ciphers
#
CONFIG_CRYPTO_AES=y
# CONFIG_CRYPTO_AES_TI is not set
CONFIG_CRYPTO_AES_X86_64=y
CONFIG_CRYPTO_AES_NI_INTEL=y
# CONFIG_CRYPTO_ANUBIS is not set
# CONFIG_CRYPTO_ARC4 is not set
CONFIG_CRYPTO_BLOWFISH=y
CONFIG_CRYPTO_BLOWFISH_COMMON=y
CONFIG_CRYPTO_BLOWFISH_X86_64=y
CONFIG_CRYPTO_CAMELLIA=m
CONFIG_CRYPTO_CAMELLIA_X86_64=m
CONFIG_CRYPTO_CAMELLIA_AESNI_AVX_X86_64=m
CONFIG_CRYPTO_CAMELLIA_AESNI_AVX2_X86_64=m
CONFIG_CRYPTO_CAST_COMMON=y
CONFIG_CRYPTO_CAST5=y
CONFIG_CRYPTO_CAST5_AVX_X86_64=m
CONFIG_CRYPTO_CAST6=m
# CONFIG_CRYPTO_CAST6_AVX_X86_64 is not set
CONFIG_CRYPTO_DES=y
CONFIG_CRYPTO_DES3_EDE_X86_64=y
CONFIG_CRYPTO_FCRYPT=m
CONFIG_CRYPTO_KHAZAD=m
CONFIG_CRYPTO_SALSA20=y
CONFIG_CRYPTO_CHACHA20=y
# CONFIG_CRYPTO_CHACHA20_X86_64 is not set
CONFIG_CRYPTO_SEED=m
CONFIG_CRYPTO_SERPENT=y
# CONFIG_CRYPTO_SERPENT_SSE2_X86_64 is not set
CONFIG_CRYPTO_SERPENT_AVX_X86_64=y
CONFIG_CRYPTO_SERPENT_AVX2_X86_64=y
# CONFIG_CRYPTO_SM4 is not set
# CONFIG_CRYPTO_TEA is not set
# CONFIG_CRYPTO_TWOFISH is not set
CONFIG_CRYPTO_TWOFISH_COMMON=m
CONFIG_CRYPTO_TWOFISH_X86_64=m
CONFIG_CRYPTO_TWOFISH_X86_64_3WAY=m
# CONFIG_CRYPTO_TWOFISH_AVX_X86_64 is not set

#
# Compression
#
CONFIG_CRYPTO_DEFLATE=m
CONFIG_CRYPTO_LZO=y
CONFIG_CRYPTO_842=m
# CONFIG_CRYPTO_LZ4 is not set
CONFIG_CRYPTO_LZ4HC=m
# CONFIG_CRYPTO_ZSTD is not set

#
# Random Number Generation
#
# CONFIG_CRYPTO_ANSI_CPRNG is not set
CONFIG_CRYPTO_DRBG_MENU=y
CONFIG_CRYPTO_DRBG_HMAC=y
CONFIG_CRYPTO_DRBG_HASH=y
CONFIG_CRYPTO_DRBG_CTR=y
CONFIG_CRYPTO_DRBG=y
CONFIG_CRYPTO_JITTERENTROPY=y
CONFIG_CRYPTO_HASH_INFO=y
CONFIG_CRYPTO_HW=y
# CONFIG_CRYPTO_DEV_PADLOCK is not set
CONFIG_CRYPTO_DEV_VIRTIO=m
CONFIG_ASYMMETRIC_KEY_TYPE=y
CONFIG_ASYMMETRIC_PUBLIC_KEY_SUBTYPE=y
CONFIG_ASYMMETRIC_TPM_KEY_SUBTYPE=m
CONFIG_X509_CERTIFICATE_PARSER=y
# CONFIG_PKCS8_PRIVATE_KEY_PARSER is not set
CONFIG_TPM_KEY_PARSER=m
CONFIG_PKCS7_MESSAGE_PARSER=y
CONFIG_PKCS7_TEST_KEY=y
CONFIG_SIGNED_PE_FILE_VERIFICATION=y

#
# Certificates for signature checking
#
CONFIG_MODULE_SIG_KEY="certs/signing_key.pem"
CONFIG_SYSTEM_TRUSTED_KEYRING=y
CONFIG_SYSTEM_TRUSTED_KEYS=""
# CONFIG_SYSTEM_EXTRA_CERTIFICATE is not set
# CONFIG_SECONDARY_TRUSTED_KEYRING is not set
# CONFIG_SYSTEM_BLACKLIST_KEYRING is not set
CONFIG_BINARY_PRINTF=y

#
# Library routines
#
CONFIG_RAID6_PQ=m
# CONFIG_RAID6_PQ_BENCHMARK is not set
CONFIG_BITREVERSE=y
CONFIG_GENERIC_STRNCPY_FROM_USER=y
CONFIG_GENERIC_STRNLEN_USER=y
CONFIG_GENERIC_NET_UTILS=y
CONFIG_GENERIC_FIND_FIRST_BIT=y
CONFIG_GENERIC_PCI_IOMAP=y
CONFIG_GENERIC_IOMAP=y
CONFIG_ARCH_USE_CMPXCHG_LOCKREF=y
CONFIG_ARCH_HAS_FAST_MULTIPLIER=y
CONFIG_CRC_CCITT=y
CONFIG_CRC16=y
CONFIG_CRC_T10DIF=y
CONFIG_CRC_ITU_T=y
CONFIG_CRC32=y
CONFIG_CRC32_SELFTEST=m
# CONFIG_CRC32_SLICEBY8 is not set
CONFIG_CRC32_SLICEBY4=y
# CONFIG_CRC32_SARWATE is not set
# CONFIG_CRC32_BIT is not set
CONFIG_CRC64=m
# CONFIG_CRC4 is not set
# CONFIG_CRC7 is not set
CONFIG_LIBCRC32C=m
CONFIG_CRC8=m
CONFIG_XXHASH=y
CONFIG_RANDOM32_SELFTEST=y
CONFIG_842_COMPRESS=m
CONFIG_842_DECOMPRESS=m
CONFIG_ZLIB_INFLATE=y
CONFIG_ZLIB_DEFLATE=m
CONFIG_LZO_COMPRESS=y
CONFIG_LZO_DECOMPRESS=y
CONFIG_LZ4HC_COMPRESS=m
CONFIG_LZ4_DECOMPRESS=m
CONFIG_ZSTD_COMPRESS=m
CONFIG_ZSTD_DECOMPRESS=m
CONFIG_XZ_DEC=m
# CONFIG_XZ_DEC_X86 is not set
CONFIG_XZ_DEC_POWERPC=y
# CONFIG_XZ_DEC_IA64 is not set
# CONFIG_XZ_DEC_ARM is not set
CONFIG_XZ_DEC_ARMTHUMB=y
CONFIG_XZ_DEC_SPARC=y
CONFIG_XZ_DEC_BCJ=y
CONFIG_XZ_DEC_TEST=m
CONFIG_GENERIC_ALLOCATOR=y
CONFIG_INTERVAL_TREE=y
CONFIG_XARRAY_MULTI=y
CONFIG_ASSOCIATIVE_ARRAY=y
CONFIG_HAS_IOMEM=y
CONFIG_HAS_IOPORT_MAP=y
CONFIG_HAS_DMA=y
CONFIG_NEED_SG_DMA_LENGTH=y
CONFIG_NEED_DMA_MAP_STATE=y
CONFIG_ARCH_DMA_ADDR_T_64BIT=y
CONFIG_SWIOTLB=y
CONFIG_SGL_ALLOC=y
CONFIG_CHECK_SIGNATURE=y
CONFIG_CPUMASK_OFFSTACK=y
CONFIG_GLOB=y
CONFIG_GLOB_SELFTEST=m
CONFIG_CLZ_TAB=y
CONFIG_CORDIC=y
# CONFIG_DDR is not set
# CONFIG_IRQ_POLL is not set
CONFIG_MPILIB=y
CONFIG_OID_REGISTRY=y
CONFIG_FONT_SUPPORT=y
# CONFIG_FONTS is not set
CONFIG_FONT_8x8=y
CONFIG_FONT_8x16=y
CONFIG_SG_POOL=y
CONFIG_ARCH_HAS_PMEM_API=y
CONFIG_ARCH_HAS_UACCESS_FLUSHCACHE=y
CONFIG_STACKDEPOT=y
CONFIG_SBITMAP=y
CONFIG_STRING_SELFTEST=y

#
# Kernel hacking
#

#
# printk and dmesg options
#
CONFIG_CONSOLE_LOGLEVEL_DEFAULT=7
CONFIG_CONSOLE_LOGLEVEL_QUIET=4
CONFIG_MESSAGE_LOGLEVEL_DEFAULT=4

#
# Compile-time checks and compiler options
#
CONFIG_DEBUG_INFO=y
CONFIG_DEBUG_INFO_REDUCED=y
CONFIG_DEBUG_INFO_SPLIT=y
# CONFIG_DEBUG_INFO_DWARF4 is not set
# CONFIG_GDB_SCRIPTS is not set
CONFIG_ENABLE_MUST_CHECK=y
CONFIG_FRAME_WARN=2048
# CONFIG_STRIP_ASM_SYMS is not set
# CONFIG_READABLE_ASM is not set
CONFIG_UNUSED_SYMBOLS=y
CONFIG_PAGE_OWNER=y
CONFIG_DEBUG_FS=y
# CONFIG_HEADERS_CHECK is not set
CONFIG_DEBUG_SECTION_MISMATCH=y
# CONFIG_SECTION_MISMATCH_WARN_ONLY is not set
CONFIG_FRAME_POINTER=y
CONFIG_STACK_VALIDATION=y
# CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set
CONFIG_MAGIC_SYSRQ=y
CONFIG_MAGIC_SYSRQ_DEFAULT_ENABLE=0x1
CONFIG_MAGIC_SYSRQ_SERIAL=y
CONFIG_DEBUG_KERNEL=y

#
# Memory Debugging
#
CONFIG_PAGE_EXTENSION=y
# CONFIG_DEBUG_PAGEALLOC is not set
CONFIG_PAGE_POISONING=y
CONFIG_PAGE_POISONING_NO_SANITY=y
# CONFIG_PAGE_POISONING_ZERO is not set
CONFIG_DEBUG_PAGE_REF=y
CONFIG_DEBUG_RODATA_TEST=y
# CONFIG_DEBUG_OBJECTS is not set
# CONFIG_DEBUG_SLAB is not set
CONFIG_HAVE_DEBUG_KMEMLEAK=y
CONFIG_DEBUG_KMEMLEAK=y
CONFIG_DEBUG_KMEMLEAK_EARLY_LOG_SIZE=400
CONFIG_DEBUG_KMEMLEAK_TEST=m
CONFIG_DEBUG_KMEMLEAK_DEFAULT_OFF=y
# CONFIG_DEBUG_KMEMLEAK_AUTO_SCAN is not set
# CONFIG_DEBUG_STACK_USAGE is not set
CONFIG_DEBUG_VM=y
CONFIG_DEBUG_VM_VMACACHE=y
CONFIG_DEBUG_VM_RB=y
# CONFIG_DEBUG_VM_PGFLAGS is not set
CONFIG_ARCH_HAS_DEBUG_VIRTUAL=y
# CONFIG_DEBUG_VIRTUAL is not set
CONFIG_DEBUG_MEMORY_INIT=y
# CONFIG_DEBUG_PER_CPU_MAPS is not set
CONFIG_HAVE_DEBUG_STACKOVERFLOW=y
CONFIG_DEBUG_STACKOVERFLOW=y
CONFIG_HAVE_ARCH_KASAN=y
CONFIG_CC_HAS_KASAN_GENERIC=y
# CONFIG_KASAN is not set
CONFIG_ARCH_HAS_KCOV=y
CONFIG_CC_HAS_SANCOV_TRACE_PC=y
# CONFIG_KCOV is not set
# CONFIG_DEBUG_SHIRQ is not set

#
# Debug Lockups and Hangs
#
CONFIG_LOCKUP_DETECTOR=y
CONFIG_SOFTLOCKUP_DETECTOR=y
CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC=y
CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE=1
CONFIG_HARDLOCKUP_CHECK_TIMESTAMP=y
# CONFIG_HARDLOCKUP_DETECTOR is not set
CONFIG_DETECT_HUNG_TASK=y
CONFIG_DEFAULT_HUNG_TASK_TIMEOUT=120
# CONFIG_BOOTPARAM_HUNG_TASK_PANIC is not set
CONFIG_BOOTPARAM_HUNG_TASK_PANIC_VALUE=0
# CONFIG_WQ_WATCHDOG is not set
# CONFIG_PANIC_ON_OOPS is not set
CONFIG_PANIC_ON_OOPS_VALUE=0
CONFIG_PANIC_TIMEOUT=0
CONFIG_SCHED_STACK_END_CHECK=y
CONFIG_DEBUG_TIMEKEEPING=y

#
# Lock Debugging (spinlocks, mutexes, etc...)
#
CONFIG_LOCK_DEBUGGING_SUPPORT=y
CONFIG_PROVE_LOCKING=y
CONFIG_LOCK_STAT=y
CONFIG_DEBUG_RT_MUTEXES=y
CONFIG_DEBUG_SPINLOCK=y
CONFIG_DEBUG_MUTEXES=y
CONFIG_DEBUG_WW_MUTEX_SLOWPATH=y
CONFIG_DEBUG_RWSEMS=y
CONFIG_DEBUG_LOCK_ALLOC=y
CONFIG_LOCKDEP=y
CONFIG_DEBUG_LOCKDEP=y
CONFIG_DEBUG_ATOMIC_SLEEP=y
CONFIG_DEBUG_LOCKING_API_SELFTESTS=y
CONFIG_LOCK_TORTURE_TEST=m
# CONFIG_WW_MUTEX_SELFTEST is not set
CONFIG_TRACE_IRQFLAGS=y
CONFIG_STACKTRACE=y
# CONFIG_WARN_ALL_UNSEEDED_RANDOM is not set
# CONFIG_DEBUG_KOBJECT is not set
CONFIG_DEBUG_BUGVERBOSE=y
CONFIG_DEBUG_LIST=y
# CONFIG_DEBUG_PI_LIST is not set
# CONFIG_DEBUG_SG is not set
CONFIG_DEBUG_NOTIFIERS=y
# CONFIG_DEBUG_CREDENTIALS is not set

#
# RCU Debugging
#
CONFIG_PROVE_RCU=y
CONFIG_TORTURE_TEST=m
# CONFIG_RCU_PERF_TEST is not set
CONFIG_RCU_TORTURE_TEST=m
CONFIG_RCU_CPU_STALL_TIMEOUT=21
CONFIG_RCU_TRACE=y
# CONFIG_RCU_EQS_DEBUG is not set
# CONFIG_DEBUG_WQ_FORCE_RR_CPU is not set
# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set
CONFIG_CPU_HOTPLUG_STATE_CONTROL=y
# CONFIG_NOTIFIER_ERROR_INJECTION is not set
CONFIG_FUNCTION_ERROR_INJECTION=y
# CONFIG_FAULT_INJECTION is not set
CONFIG_USER_STACKTRACE_SUPPORT=y
CONFIG_NOP_TRACER=y
CONFIG_HAVE_FUNCTION_TRACER=y
CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
CONFIG_HAVE_DYNAMIC_FTRACE=y
CONFIG_HAVE_DYNAMIC_FTRACE_WITH_REGS=y
CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
CONFIG_HAVE_SYSCALL_TRACEPOINTS=y
CONFIG_HAVE_FENTRY=y
CONFIG_HAVE_C_RECORDMCOUNT=y
CONFIG_TRACE_CLOCK=y
CONFIG_RING_BUFFER=y
CONFIG_EVENT_TRACING=y
CONFIG_CONTEXT_SWITCH_TRACER=y
CONFIG_PREEMPTIRQ_TRACEPOINTS=y
CONFIG_TRACING=y
CONFIG_GENERIC_TRACER=y
CONFIG_TRACING_SUPPORT=y
CONFIG_FTRACE=y
CONFIG_FUNCTION_TRACER=y
# CONFIG_FUNCTION_GRAPH_TRACER is not set
CONFIG_PREEMPTIRQ_EVENTS=y
# CONFIG_IRQSOFF_TRACER is not set
# CONFIG_SCHED_TRACER is not set
# CONFIG_HWLAT_TRACER is not set
# CONFIG_FTRACE_SYSCALLS is not set
# CONFIG_TRACER_SNAPSHOT is not set
CONFIG_TRACE_BRANCH_PROFILING=y
# CONFIG_BRANCH_PROFILE_NONE is not set
# CONFIG_PROFILE_ANNOTATED_BRANCHES is not set
CONFIG_PROFILE_ALL_BRANCHES=y
# CONFIG_BRANCH_TRACER is not set
CONFIG_STACK_TRACER=y
# CONFIG_BLK_DEV_IO_TRACE is not set
CONFIG_KPROBE_EVENTS=y
CONFIG_UPROBE_EVENTS=y
CONFIG_BPF_EVENTS=y
CONFIG_DYNAMIC_EVENTS=y
CONFIG_PROBE_EVENTS=y
# CONFIG_DYNAMIC_FTRACE is not set
# CONFIG_FUNCTION_PROFILER is not set
CONFIG_BPF_KPROBE_OVERRIDE=y
# CONFIG_FTRACE_STARTUP_TEST is not set
# CONFIG_HIST_TRIGGERS is not set
CONFIG_TRACEPOINT_BENCHMARK=y
CONFIG_RING_BUFFER_BENCHMARK=m
# CONFIG_RING_BUFFER_STARTUP_TEST is not set
# CONFIG_PREEMPTIRQ_DELAY_TEST is not set
# CONFIG_TRACE_EVAL_MAP_FILE is not set
CONFIG_TRACING_EVENTS_GPIO=y
CONFIG_GCOV_PROFILE_FTRACE=y
CONFIG_DMA_API_DEBUG=y
CONFIG_DMA_API_DEBUG_SG=y
CONFIG_RUNTIME_TESTING_MENU=y
CONFIG_LKDTM=m
# CONFIG_TEST_LIST_SORT is not set
CONFIG_TEST_SORT=y
# CONFIG_KPROBES_SANITY_TEST is not set
# CONFIG_BACKTRACE_SELF_TEST is not set
CONFIG_RBTREE_TEST=y
CONFIG_INTERVAL_TREE_TEST=m
CONFIG_PERCPU_TEST=m
CONFIG_ATOMIC64_SELFTEST=y
# CONFIG_TEST_HEXDUMP is not set
# CONFIG_TEST_STRING_HELPERS is not set
# CONFIG_TEST_KSTRTOX is not set
CONFIG_TEST_PRINTF=m
CONFIG_TEST_BITMAP=y
CONFIG_TEST_BITFIELD=y
CONFIG_TEST_UUID=m
CONFIG_TEST_XARRAY=y
# CONFIG_TEST_OVERFLOW is not set
CONFIG_TEST_RHASHTABLE=m
# CONFIG_TEST_HASH is not set
CONFIG_TEST_IDA=m
# CONFIG_TEST_LKM is not set
CONFIG_TEST_USER_COPY=m
# CONFIG_FIND_BIT_BENCHMARK is not set
CONFIG_TEST_FIRMWARE=m
# CONFIG_TEST_UDELAY is not set
CONFIG_TEST_STATIC_KEYS=m
CONFIG_TEST_MEMCAT_P=m
CONFIG_MEMTEST=y
# CONFIG_BUG_ON_DATA_CORRUPTION is not set
# CONFIG_SAMPLES is not set
CONFIG_HAVE_ARCH_KGDB=y
CONFIG_KGDB=y
# CONFIG_KGDB_SERIAL_CONSOLE is not set
# CONFIG_KGDB_TESTS is not set
# CONFIG_KGDB_LOW_LEVEL_TRAP is not set
CONFIG_KGDB_KDB=y
CONFIG_KDB_DEFAULT_ENABLE=0x1
# CONFIG_KDB_KEYBOARD is not set
CONFIG_KDB_CONTINUE_CATASTROPHIC=0
CONFIG_ARCH_HAS_UBSAN_SANITIZE_ALL=y
# CONFIG_UBSAN is not set
CONFIG_ARCH_HAS_DEVMEM_IS_ALLOWED=y
# CONFIG_STRICT_DEVMEM is not set
CONFIG_TRACE_IRQFLAGS_SUPPORT=y
# CONFIG_X86_VERBOSE_BOOTUP is not set
# CONFIG_EARLY_PRINTK is not set
CONFIG_X86_PTDUMP_CORE=y
# CONFIG_X86_PTDUMP is not set
CONFIG_DEBUG_WX=y
# CONFIG_DOUBLEFAULT is not set
CONFIG_DEBUG_TLBFLUSH=y
CONFIG_HAVE_MMIOTRACE_SUPPORT=y
# CONFIG_X86_DECODER_SELFTEST is not set
CONFIG_IO_DELAY_TYPE_0X80=0
CONFIG_IO_DELAY_TYPE_0XED=1
CONFIG_IO_DELAY_TYPE_UDELAY=2
CONFIG_IO_DELAY_TYPE_NONE=3
# CONFIG_IO_DELAY_0X80 is not set
# CONFIG_IO_DELAY_0XED is not set
# CONFIG_IO_DELAY_UDELAY is not set
CONFIG_IO_DELAY_NONE=y
CONFIG_DEFAULT_IO_DELAY_TYPE=3
CONFIG_DEBUG_BOOT_PARAMS=y
# CONFIG_CPA_DEBUG is not set
CONFIG_OPTIMIZE_INLINING=y
# CONFIG_DEBUG_ENTRY is not set
# CONFIG_DEBUG_NMI_SELFTEST is not set
# CONFIG_X86_DEBUG_FPU is not set
# CONFIG_UNWINDER_ORC is not set
CONFIG_UNWINDER_FRAME_POINTER=y

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 05/20] x86/uaccess/xen: Suppress SMAP warnings
  2019-03-07 11:45 ` [PATCH 05/20] x86/uaccess/xen: Suppress SMAP warnings Peter Zijlstra
@ 2019-03-07 12:22   ` Juergen Gross
  2019-03-07 12:32     ` Peter Zijlstra
  2019-03-08 19:00   ` Josh Poimboeuf
  1 sibling, 1 reply; 100+ messages in thread
From: Juergen Gross @ 2019-03-07 12:22 UTC (permalink / raw)
  To: Peter Zijlstra, torvalds, tglx, hpa, julien.thierry, will.deacon,
	luto, mingo, catalin.marinas, james.morse, valentin.schneider,
	brgerst, jpoimboe, luto, bp, dvlasenk
  Cc: linux-kernel, dvyukov, rostedt, andrew.cooper3, Boris Ostrovsky,
	Stefano Stabellini

On 07/03/2019 12:45, Peter Zijlstra wrote:
> drivers/xen/privcmd.o: warning: objtool: privcmd_ioctl()+0x1414: call to hypercall_page() with UACCESS enabled
> 
> Xen needs to do HV calls with AC=1 for hysterical raisins. Make the
> warning go away.

No, this is a hypercall with parameters passed through from user land
(Xen tools). So setting AC=1 is not related to hysterical reasons, but
to indicate that unprivileged buffers are okay here. So please change
the commit message to something like:

Some Xen hypercalls allow parameter buffers in user land, so they need
to set AC=1. Avoid the warning for those cases.

> XXX: arguably we should rename ANNOTATE_NOSPEC_ALTERNATIVE to
>      ANNOTATE_IGNORE_ALTERNATIVE.
> 
> Cc: andrew.cooper3@citrix.com
> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>

Mind Cc-ing the maintainers of the code you are touching in future
patches?

With the commit message adjusted:

Reviewed-by: Juergen Gross <jgross@suse.com>


Juergen

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 05/20] x86/uaccess/xen: Suppress SMAP warnings
  2019-03-07 12:22   ` Juergen Gross
@ 2019-03-07 12:32     ` Peter Zijlstra
  2019-03-07 12:36       ` Juergen Gross
  0 siblings, 1 reply; 100+ messages in thread
From: Peter Zijlstra @ 2019-03-07 12:32 UTC (permalink / raw)
  To: Juergen Gross
  Cc: torvalds, tglx, hpa, julien.thierry, will.deacon, luto, mingo,
	catalin.marinas, james.morse, valentin.schneider, brgerst,
	jpoimboe, luto, bp, dvlasenk, linux-kernel, dvyukov, rostedt,
	andrew.cooper3, Boris Ostrovsky, Stefano Stabellini

On Thu, Mar 07, 2019 at 01:22:52PM +0100, Juergen Gross wrote:
> On 07/03/2019 12:45, Peter Zijlstra wrote:
> > drivers/xen/privcmd.o: warning: objtool: privcmd_ioctl()+0x1414: call to hypercall_page() with UACCESS enabled
> > 
> > Xen needs to do HV calls with AC=1 for hysterical raisins. Make the
> > warning go away.
> 
> No, this is a hypercall with parameters passed through from user land
> (Xen tools). So setting AC=1 is not related to hysterical reasons, but
> to indicate that unprivileged buffers are okay here. So please change
> the commit message to something like:
> 
> Some Xen hypercalls allow parameter buffers in user land, so they need
> to set AC=1. Avoid the warning for those cases.

*yuck* that's gross...

And I understood from Andrew yesterday (but perhaps I misunderstood)
that the whole privcmd thing was a bit of a hack.

But sure, I'll change the message.

> > XXX: arguably we should rename ANNOTATE_NOSPEC_ALTERNATIVE to
> >      ANNOTATE_IGNORE_ALTERNATIVE.
> > 
> > Cc: andrew.cooper3@citrix.com
> > Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
> 
> Mind Cc-ing the maintainers of the code you are touching in future
> patches?

Sure; my bad, I forgot to ask get_maintainers about this.

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 05/20] x86/uaccess/xen: Suppress SMAP warnings
  2019-03-07 12:32     ` Peter Zijlstra
@ 2019-03-07 12:36       ` Juergen Gross
  0 siblings, 0 replies; 100+ messages in thread
From: Juergen Gross @ 2019-03-07 12:36 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: torvalds, tglx, hpa, julien.thierry, will.deacon, luto, mingo,
	catalin.marinas, james.morse, valentin.schneider, brgerst,
	jpoimboe, luto, bp, dvlasenk, linux-kernel, dvyukov, rostedt,
	andrew.cooper3, Boris Ostrovsky, Stefano Stabellini

On 07/03/2019 13:32, Peter Zijlstra wrote:
> On Thu, Mar 07, 2019 at 01:22:52PM +0100, Juergen Gross wrote:
>> On 07/03/2019 12:45, Peter Zijlstra wrote:
>>> drivers/xen/privcmd.o: warning: objtool: privcmd_ioctl()+0x1414: call to hypercall_page() with UACCESS enabled
>>>
>>> Xen needs to do HV calls with AC=1 for hysterical raisins. Make the
>>> warning go away.
>>
>> No, this is a hypercall with parameters passed through from user land
>> (Xen tools). So setting AC=1 is not related to hysterical reasons, but
>> to indicate that unprivileged buffers are okay here. So please change
>> the commit message to something like:
>>
>> Some Xen hypercalls allow parameter buffers in user land, so they need
>> to set AC=1. Avoid the warning for those cases.
> 
> *yuck* that's gross...
> 
> And I understood from Andrew yesterday (but perhaps I misunderstood)
> that the whole privcmd thing was a bit of a hack.

That was an unwise design decision in the past, yes. Changing it will
require a lot of effort.

> But sure, I'll change the message.

Thanks. :-)


Juergen

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 00/20] objtool: UACCESS validation v3
  2019-03-07 12:03 ` [PATCH 00/20] objtool: UACCESS validation v3 Peter Zijlstra
@ 2019-03-07 12:55   ` Peter Zijlstra
  2019-03-07 13:13     ` Peter Zijlstra
  2019-03-07 16:31   ` [PATCH 00/20] objtool: UACCESS validation v3 Linus Torvalds
  1 sibling, 1 reply; 100+ messages in thread
From: Peter Zijlstra @ 2019-03-07 12:55 UTC (permalink / raw)
  To: torvalds, tglx, hpa, julien.thierry, will.deacon, luto, mingo,
	catalin.marinas, james.morse, valentin.schneider, brgerst,
	jpoimboe, luto, bp, dvlasenk
  Cc: linux-kernel, dvyukov, rostedt

On Thu, Mar 07, 2019 at 01:03:17PM +0100, Peter Zijlstra wrote:


> 01c3     20d8:	77 08                	ja     20e2 <__do_sys_waitid+0x1cd>

taken:

 randconfig-build/kernel/exit.o: warning: objtool:   __do_sys_waitid()+0x1c3: (branch)

> ffffffffffffe0f5 	alternative("", __stringify(__ASM_STAC), X86_FEATURE_SMAP);
> 01c8     20dd:	90                   	nop
> 01c9     20de:	90                   	nop
> 01ca     20df:	90                   	nop

Bye-bye STAC, jumped straight over.

> 01cd     20e2:	83 f0 01             	xor    $0x1,%eax
> 01d0     20e5:	48 89 c2             	mov    %rax,%rdx
> 01d3     20e8:	83 e2 01             	and    $0x1,%edx
> 01d6     20eb:	48 83 c2 02          	add    $0x2,%rdx
> 01da     20ef:	48 ff 04 d5 00 00 00 	incq   0x0(,%rdx,8)
> 01e1     20f6:	00 
> 01de 			20f3: R_X86_64_32S	_ftrace_branch+0x148
> 01e2     20f7:	84 c0                	test   %al,%al
> 01e4     20f9:	75 2d                	jne    2128 <__do_sys_waitid+0x213>

we do not take this branch and fall-through.

> ffffffffffffe0eb 		return -EFAULT;
> ffffffffffffe0eb 
> ffffffffffffe0eb 	unsafe_put_user(signo, &infop->si_signo, Efault);
> 01e6     20fb:	44 89 33             	mov    %r14d,(%rbx)

fault, take exception:

  randconfig-build/kernel/exit.o: warning: objtool:   __do_sys_waitid()+0x1e6: (alt)

Relocation section '.rela__ex_table' at offset 0x21568 contains 18 entries:
Offset          Info           Type           Sym. Value    Sym. Name + Addend
000000000000  000200000002 R_X86_64_PC32     0000000000000000 .text + 20fb
000000000004  000200000002 R_X86_64_PC32     0000000000000000 .text + 2125

> ffffffffffffefe5 Efault:
> ffffffffffffe0eb 	user_access_end();
> 0210     2125:	90                   	nop
> 0211     2126:	90                   	nop
> 0212     2127:	90                   	nop

 randconfig-build/kernel/exit.o: warning: objtool:   __do_sys_waitid()+0x210: (alt)

000000000034  000200000002 R_X86_64_PC32     0000000000000000 .text + 2125
000000000038  00c800000002 R_X86_64_PC32     0000000000000000 .altinstr_replacement + c

0000000000000000 <.altinstr_replacement>:
c:   0f 01 ca                clac

 randconfig-build/kernel/exit.o: warning: objtool: .altinstr_replacement+0xc: redundant UACCESS disable


^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 00/20] objtool: UACCESS validation v3
  2019-03-07 12:55   ` Peter Zijlstra
@ 2019-03-07 13:13     ` Peter Zijlstra
  2019-03-07 16:47       ` Josh Poimboeuf
  0 siblings, 1 reply; 100+ messages in thread
From: Peter Zijlstra @ 2019-03-07 13:13 UTC (permalink / raw)
  To: torvalds, tglx, hpa, julien.thierry, will.deacon, luto, mingo,
	catalin.marinas, james.morse, valentin.schneider, brgerst,
	jpoimboe, luto, bp, dvlasenk
  Cc: linux-kernel, dvyukov, rostedt

On Thu, Mar 07, 2019 at 01:55:26PM +0100, Peter Zijlstra wrote:
> On Thu, Mar 07, 2019 at 01:03:17PM +0100, Peter Zijlstra wrote:


> > 01be     20d3:  31 c0                   xor    %eax,%eax
> > 01c0     20d5:  4c 39 eb                cmp    %r13,%rbx
> > 01c3     20d8:  77 08                   ja     20e2 <__do_sys_waitid+0x1cd>

randconfig-build/kernel/exit.o: warning: objtool:   __do_sys_waitid()+0x1c3: (branch)

> > 01cd     20e2:	83 f0 01             	xor    $0x1,%eax
> > 01d0     20e5:	48 89 c2             	mov    %rax,%rdx
> > 01d3     20e8:	83 e2 01             	and    $0x1,%edx
> > 01d6     20eb:	48 83 c2 02          	add    $0x2,%rdx
> > 01da     20ef:	48 ff 04 d5 00 00 00 	incq   0x0(,%rdx,8)
> > 01e1     20f6:	00 
> > 01de 			20f3: R_X86_64_32S	_ftrace_branch+0x148
> > 01e2     20f7:	84 c0                	test   %al,%al
> > 01e4     20f9:	75 2d                	jne    2128 <__do_sys_waitid+0x213>
> 
> we do not take this branch and fall-through.

And that is the error, I think. We should've taken it and went to:

  return -EFAULT;

because:

 +1be	xor  %eax,%eax	eax=0
 +1cd   xor  $0x1,%eax	eax=1
 +1e2   test %al,%al	1&1==1 -> ZF=0
 +1e4   jnz

Is an unconditional code sequence, but there's no way objtool can do
that without becoming a full blown interpreter :/

> > 0213     2128:  49 c7 c7 f2 ff ff ff    mov    $0xfffffffffffffff2,%r15
> > ffffffffffffe0eb }
> > 021a     212f:  48 8d 65 d8             lea    -0x28(%rbp),%rsp
> > 021e     2133:  4c 89 f8                mov    %r15,%rax
> > 0221     2136:  5b                      pop    %rbx
> > 0222     2137:  41 5c                   pop    %r12
> > 0224     2139:  41 5d                   pop    %r13
> > 0226     213b:  41 5e                   pop    %r14
> > 0228     213d:  41 5f                   pop    %r15
> > 022a     213f:  5d                      pop    %rbp
> > 022b     2140:  c3                      retq

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 07/20] x86/uaccess: Always inline force_valid_ss()
  2019-03-07 11:45 ` [PATCH 07/20] x86/uaccess: Always inline force_valid_ss() Peter Zijlstra
@ 2019-03-07 13:50   ` Peter Zijlstra
  2019-03-07 18:05   ` Andy Lutomirski
  1 sibling, 0 replies; 100+ messages in thread
From: Peter Zijlstra @ 2019-03-07 13:50 UTC (permalink / raw)
  To: torvalds, tglx, hpa, julien.thierry, will.deacon, luto, mingo,
	catalin.marinas, james.morse, valentin.schneider, brgerst,
	jpoimboe, luto, bp, dvlasenk
  Cc: linux-kernel, dvyukov, rostedt

On Thu, Mar 07, 2019 at 12:45:18PM +0100, Peter Zijlstra wrote:
> arch/x86/kernel/signal.o: warning: objtool: restore_sigcontext()+0x3cc: call to force_valid_ss.isra.5() with UACCESS enabled
> 
> XXX: move the callsite out of te AC=1 region instead?
> 
> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
> ---
>  arch/x86/kernel/signal.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> --- a/arch/x86/kernel/signal.c
> +++ b/arch/x86/kernel/signal.c
> @@ -71,7 +71,7 @@
>   * alone.  Using this generally makes no sense unless
>   * user_64bit_mode(regs) would return true.
>   */
> -static void force_valid_ss(struct pt_regs *regs)
> +static __always_inline void force_valid_ss(struct pt_regs *regs)
>  {
>  	u32 ar;
>  	asm volatile ("lar %[old_ss], %[ar]\n\t"

arch/x86/kernel/signal.o: warning: objtool: do_signal()+0x384: call to frame_uc_flags.isra.0() with UACCESS enabled

@@ -441,7 +441,7 @@ static int __setup_rt_frame(int sig, str
 	return 0;
 }
 #else /* !CONFIG_X86_32 */
-static unsigned long frame_uc_flags(struct pt_regs *regs)
+static __always_inline unsigned long frame_uc_flags(struct pt_regs *regs)
 {
 	unsigned long flags;
 

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 00/20] objtool: UACCESS validation v3
  2019-03-07 12:03 ` [PATCH 00/20] objtool: UACCESS validation v3 Peter Zijlstra
  2019-03-07 12:55   ` Peter Zijlstra
@ 2019-03-07 16:31   ` Linus Torvalds
  1 sibling, 0 replies; 100+ messages in thread
From: Linus Torvalds @ 2019-03-07 16:31 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: Thomas Gleixner, Peter Anvin, Julien Thierry, Will Deacon,
	Andy Lutomirski, Ingo Molnar, Catalin Marinas, James Morse,
	valentin.schneider, Brian Gerst, Josh Poimboeuf,
	Andrew Lutomirski, Borislav Petkov, Denys Vlasenko,
	Linux List Kernel Mailing, Dmitry Vyukov, Steven Rostedt

On Thu, Mar 7, 2019 at 4:03 AM Peter Zijlstra <peterz@infradead.org> wrote:
>
> Take for instance this one (.config attached); it has both
> CONFIG_PROFILE_ALL_BRANCHES=y and CONFIG_TRACE_BRANCH_PROFILING=y
> and it compiles:

How about just turning off SMAP checking for the really odd cases?

At some point it's not worth worrying about excessive debug
infrastructure, I think. Just give up and say "ok. we'll save/restore
in preempt_schedule()".

Or just make preempt_schedule() check AC and not schedule. It already
does that for IF.

                   Linus

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 18/20] objtool: Add UACCESS validation
  2019-03-07 11:45 ` [PATCH 18/20] objtool: Add UACCESS validation Peter Zijlstra
@ 2019-03-07 16:33   ` Linus Torvalds
  2019-03-07 17:10     ` hpa
  2019-03-07 17:41     ` Peter Zijlstra
  2019-03-08 21:02   ` Josh Poimboeuf
  1 sibling, 2 replies; 100+ messages in thread
From: Linus Torvalds @ 2019-03-07 16:33 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: Thomas Gleixner, Peter Anvin, Julien Thierry, Will Deacon,
	Andy Lutomirski, Ingo Molnar, Catalin Marinas, James Morse,
	valentin.schneider, Brian Gerst, Josh Poimboeuf,
	Andrew Lutomirski, Borislav Petkov, Denys Vlasenko,
	Linux List Kernel Mailing, Dmitry Vyukov, Steven Rostedt

On Thu, Mar 7, 2019 at 3:52 AM Peter Zijlstra <peterz@infradead.org> wrote:
>
> XXX: are we sure we want __memset marked AC-safe?

It's certainly one of the safer functions to call with AC set, but it
sounds wrong anyway. It's not like it's likely to leak kernel data
(most memset's are with 0, and even the non-zero ones I can't imagine
are sensitive - more like poison values etc).

What's the call site that made you go "just add __memset() to the list"?

            Linus

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 00/20] objtool: UACCESS validation v3
  2019-03-07 13:13     ` Peter Zijlstra
@ 2019-03-07 16:47       ` Josh Poimboeuf
  2019-03-07 16:50         ` Josh Poimboeuf
                           ` (3 more replies)
  0 siblings, 4 replies; 100+ messages in thread
From: Josh Poimboeuf @ 2019-03-07 16:47 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: torvalds, tglx, hpa, julien.thierry, will.deacon, luto, mingo,
	catalin.marinas, james.morse, valentin.schneider, brgerst, luto,
	bp, dvlasenk, linux-kernel, dvyukov, rostedt

On Thu, Mar 07, 2019 at 02:13:12PM +0100, Peter Zijlstra wrote:
> On Thu, Mar 07, 2019 at 01:55:26PM +0100, Peter Zijlstra wrote:
> > On Thu, Mar 07, 2019 at 01:03:17PM +0100, Peter Zijlstra wrote:
> 
> 
> > > 01be     20d3:  31 c0                   xor    %eax,%eax
> > > 01c0     20d5:  4c 39 eb                cmp    %r13,%rbx
> > > 01c3     20d8:  77 08                   ja     20e2 <__do_sys_waitid+0x1cd>
> 
> randconfig-build/kernel/exit.o: warning: objtool:   __do_sys_waitid()+0x1c3: (branch)
> 
> > > 01cd     20e2:	83 f0 01             	xor    $0x1,%eax
> > > 01d0     20e5:	48 89 c2             	mov    %rax,%rdx
> > > 01d3     20e8:	83 e2 01             	and    $0x1,%edx
> > > 01d6     20eb:	48 83 c2 02          	add    $0x2,%rdx
> > > 01da     20ef:	48 ff 04 d5 00 00 00 	incq   0x0(,%rdx,8)
> > > 01e1     20f6:	00 
> > > 01de 			20f3: R_X86_64_32S	_ftrace_branch+0x148
> > > 01e2     20f7:	84 c0                	test   %al,%al
> > > 01e4     20f9:	75 2d                	jne    2128 <__do_sys_waitid+0x213>
> > 
> > we do not take this branch and fall-through.
> 
> And that is the error, I think. We should've taken it and went to:
> 
>   return -EFAULT;
> 
> because:
> 
>  +1be	xor  %eax,%eax	eax=0
>  +1cd   xor  $0x1,%eax	eax=1
>  +1e2   test %al,%al	1&1==1 -> ZF=0
>  +1e4   jnz
> 
> Is an unconditional code sequence, but there's no way objtool can do
> that without becoming a full blown interpreter :/
> 
> > > 0213     2128:  49 c7 c7 f2 ff ff ff    mov    $0xfffffffffffffff2,%r15
> > > ffffffffffffe0eb }
> > > 021a     212f:  48 8d 65 d8             lea    -0x28(%rbp),%rsp
> > > 021e     2133:  4c 89 f8                mov    %r15,%rax
> > > 0221     2136:  5b                      pop    %rbx
> > > 0222     2137:  41 5c                   pop    %r12
> > > 0224     2139:  41 5d                   pop    %r13
> > > 0226     213b:  41 5e                   pop    %r14
> > > 0228     213d:  41 5f                   pop    %r15
> > > 022a     213f:  5d                      pop    %rbp
> > > 022b     2140:  c3                      retq

This "fixes" it, and also seems to help -Os make much code:

diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index 445348facea9..8de63db58fdd 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -67,7 +67,7 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val,
 				.line = __LINE__,			\
 			};						\
 		______r = !!(cond);					\
-		______f.miss_hit[______r]++;					\
+		if (______r) ______f.miss_hit[1]++; else ______f.miss_hit[0]++; \
 		______r;						\
 	}))
 #endif /* CONFIG_PROFILE_ALL_BRANCHES */

^ permalink raw reply related	[flat|nested] 100+ messages in thread

* Re: [PATCH 00/20] objtool: UACCESS validation v3
  2019-03-07 16:47       ` Josh Poimboeuf
@ 2019-03-07 16:50         ` Josh Poimboeuf
  2019-03-07 17:00         ` Linus Torvalds
                           ` (2 subsequent siblings)
  3 siblings, 0 replies; 100+ messages in thread
From: Josh Poimboeuf @ 2019-03-07 16:50 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: torvalds, tglx, hpa, julien.thierry, will.deacon, luto, mingo,
	catalin.marinas, james.morse, valentin.schneider, brgerst, luto,
	bp, dvlasenk, linux-kernel, dvyukov, rostedt

On Thu, Mar 07, 2019 at 10:47:05AM -0600, Josh Poimboeuf wrote:
> On Thu, Mar 07, 2019 at 02:13:12PM +0100, Peter Zijlstra wrote:
> > On Thu, Mar 07, 2019 at 01:55:26PM +0100, Peter Zijlstra wrote:
> > > On Thu, Mar 07, 2019 at 01:03:17PM +0100, Peter Zijlstra wrote:
> > 
> > 
> > > > 01be     20d3:  31 c0                   xor    %eax,%eax
> > > > 01c0     20d5:  4c 39 eb                cmp    %r13,%rbx
> > > > 01c3     20d8:  77 08                   ja     20e2 <__do_sys_waitid+0x1cd>
> > 
> > randconfig-build/kernel/exit.o: warning: objtool:   __do_sys_waitid()+0x1c3: (branch)
> > 
> > > > 01cd     20e2:	83 f0 01             	xor    $0x1,%eax
> > > > 01d0     20e5:	48 89 c2             	mov    %rax,%rdx
> > > > 01d3     20e8:	83 e2 01             	and    $0x1,%edx
> > > > 01d6     20eb:	48 83 c2 02          	add    $0x2,%rdx
> > > > 01da     20ef:	48 ff 04 d5 00 00 00 	incq   0x0(,%rdx,8)
> > > > 01e1     20f6:	00 
> > > > 01de 			20f3: R_X86_64_32S	_ftrace_branch+0x148
> > > > 01e2     20f7:	84 c0                	test   %al,%al
> > > > 01e4     20f9:	75 2d                	jne    2128 <__do_sys_waitid+0x213>
> > > 
> > > we do not take this branch and fall-through.
> > 
> > And that is the error, I think. We should've taken it and went to:
> > 
> >   return -EFAULT;
> > 
> > because:
> > 
> >  +1be	xor  %eax,%eax	eax=0
> >  +1cd   xor  $0x1,%eax	eax=1
> >  +1e2   test %al,%al	1&1==1 -> ZF=0
> >  +1e4   jnz
> > 
> > Is an unconditional code sequence, but there's no way objtool can do
> > that without becoming a full blown interpreter :/
> > 
> > > > 0213     2128:  49 c7 c7 f2 ff ff ff    mov    $0xfffffffffffffff2,%r15
> > > > ffffffffffffe0eb }
> > > > 021a     212f:  48 8d 65 d8             lea    -0x28(%rbp),%rsp
> > > > 021e     2133:  4c 89 f8                mov    %r15,%rax
> > > > 0221     2136:  5b                      pop    %rbx
> > > > 0222     2137:  41 5c                   pop    %r12
> > > > 0224     2139:  41 5d                   pop    %r13
> > > > 0226     213b:  41 5e                   pop    %r14
> > > > 0228     213d:  41 5f                   pop    %r15
> > > > 022a     213f:  5d                      pop    %rbp
> > > > 022b     2140:  c3                      retq
> 
> This "fixes" it, and also seems to help -Os make much code:

much *smaller* code

> 
> diff --git a/include/linux/compiler.h b/include/linux/compiler.h
> index 445348facea9..8de63db58fdd 100644
> --- a/include/linux/compiler.h
> +++ b/include/linux/compiler.h
> @@ -67,7 +67,7 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val,
>  				.line = __LINE__,			\
>  			};						\
>  		______r = !!(cond);					\
> -		______f.miss_hit[______r]++;					\
> +		if (______r) ______f.miss_hit[1]++; else ______f.miss_hit[0]++; \
>  		______r;						\
>  	}))
>  #endif /* CONFIG_PROFILE_ALL_BRANCHES */

-- 
Josh

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 00/20] objtool: UACCESS validation v3
  2019-03-07 16:47       ` Josh Poimboeuf
  2019-03-07 16:50         ` Josh Poimboeuf
@ 2019-03-07 17:00         ` Linus Torvalds
  2019-03-07 17:17           ` Josh Poimboeuf
  2019-03-07 17:04         ` [PATCH 00/20] objtool: UACCESS validation v3 hpa
  2019-03-07 17:43         ` Peter Zijlstra
  3 siblings, 1 reply; 100+ messages in thread
From: Linus Torvalds @ 2019-03-07 17:00 UTC (permalink / raw)
  To: Josh Poimboeuf
  Cc: Peter Zijlstra, Thomas Gleixner, Peter Anvin, Julien Thierry,
	Will Deacon, Andy Lutomirski, Ingo Molnar, Catalin Marinas,
	James Morse, valentin.schneider, Brian Gerst, Andrew Lutomirski,
	Borislav Petkov, Denys Vlasenko, Linux List Kernel Mailing,
	Dmitry Vyukov, Steven Rostedt

On Thu, Mar 7, 2019 at 8:47 AM Josh Poimboeuf <jpoimboe@redhat.com> wrote:
>
> This "fixes" it, and also seems to help -Os make much code:

Yeah, considering that this __trace_if() macro from hell is doing an
'if()' on the result of that inner thing, it makes sense to *not*  use
that "looks simpler and shorter" array sequence, but depend on the
compiler then noticing that the conditionals are the same and joining
the two branches together.

The compiler has to do much more work to either generate the actual
dynamic array thing, or notice that the _index_ of the array matches
the _conditional_ on the branch, and undo that thing.

But that macro really is the macro from hell regardless.

Do people really use CONFIG_PROFILE_ALL_BRANCHES?

                Linus

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 00/20] objtool: UACCESS validation v3
  2019-03-07 16:47       ` Josh Poimboeuf
  2019-03-07 16:50         ` Josh Poimboeuf
  2019-03-07 17:00         ` Linus Torvalds
@ 2019-03-07 17:04         ` hpa
  2019-03-07 17:18           ` Josh Poimboeuf
  2019-03-07 17:43         ` Peter Zijlstra
  3 siblings, 1 reply; 100+ messages in thread
From: hpa @ 2019-03-07 17:04 UTC (permalink / raw)
  To: Josh Poimboeuf, Peter Zijlstra
  Cc: torvalds, tglx, julien.thierry, will.deacon, luto, mingo,
	catalin.marinas, james.morse, valentin.schneider, brgerst, luto,
	bp, dvlasenk, linux-kernel, dvyukov, rostedt

On March 7, 2019 8:47:05 AM PST, Josh Poimboeuf <jpoimboe@redhat.com> wrote:
>On Thu, Mar 07, 2019 at 02:13:12PM +0100, Peter Zijlstra wrote:
>> On Thu, Mar 07, 2019 at 01:55:26PM +0100, Peter Zijlstra wrote:
>> > On Thu, Mar 07, 2019 at 01:03:17PM +0100, Peter Zijlstra wrote:
>> 
>> 
>> > > 01be     20d3:  31 c0                   xor    %eax,%eax
>> > > 01c0     20d5:  4c 39 eb                cmp    %r13,%rbx
>> > > 01c3     20d8:  77 08                   ja     20e2
><__do_sys_waitid+0x1cd>
>> 
>> randconfig-build/kernel/exit.o: warning: objtool:  
>__do_sys_waitid()+0x1c3: (branch)
>> 
>> > > 01cd     20e2:	83 f0 01             	xor    $0x1,%eax
>> > > 01d0     20e5:	48 89 c2             	mov    %rax,%rdx
>> > > 01d3     20e8:	83 e2 01             	and    $0x1,%edx
>> > > 01d6     20eb:	48 83 c2 02          	add    $0x2,%rdx
>> > > 01da     20ef:	48 ff 04 d5 00 00 00 	incq   0x0(,%rdx,8)
>> > > 01e1     20f6:	00 
>> > > 01de 			20f3: R_X86_64_32S	_ftrace_branch+0x148
>> > > 01e2     20f7:	84 c0                	test   %al,%al
>> > > 01e4     20f9:	75 2d                	jne    2128
><__do_sys_waitid+0x213>
>> > 
>> > we do not take this branch and fall-through.
>> 
>> And that is the error, I think. We should've taken it and went to:
>> 
>>   return -EFAULT;
>> 
>> because:
>> 
>>  +1be	xor  %eax,%eax	eax=0
>>  +1cd   xor  $0x1,%eax	eax=1
>>  +1e2   test %al,%al	1&1==1 -> ZF=0
>>  +1e4   jnz
>> 
>> Is an unconditional code sequence, but there's no way objtool can do
>> that without becoming a full blown interpreter :/
>> 
>> > > 0213     2128:  49 c7 c7 f2 ff ff ff    mov   
>$0xfffffffffffffff2,%r15
>> > > ffffffffffffe0eb }
>> > > 021a     212f:  48 8d 65 d8             lea    -0x28(%rbp),%rsp
>> > > 021e     2133:  4c 89 f8                mov    %r15,%rax
>> > > 0221     2136:  5b                      pop    %rbx
>> > > 0222     2137:  41 5c                   pop    %r12
>> > > 0224     2139:  41 5d                   pop    %r13
>> > > 0226     213b:  41 5e                   pop    %r14
>> > > 0228     213d:  41 5f                   pop    %r15
>> > > 022a     213f:  5d                      pop    %rbp
>> > > 022b     2140:  c3                      retq
>
>This "fixes" it, and also seems to help -Os make much code:
>
>diff --git a/include/linux/compiler.h b/include/linux/compiler.h
>index 445348facea9..8de63db58fdd 100644
>--- a/include/linux/compiler.h
>+++ b/include/linux/compiler.h
>@@ -67,7 +67,7 @@ void ftrace_likely_update(struct ftrace_likely_data
>*f, int val,
> 				.line = __LINE__,			\
> 			};						\
> 		______r = !!(cond);					\
>-		______f.miss_hit[______r]++;					\
>+		if (______r) ______f.miss_hit[1]++; else ______f.miss_hit[0]++; \
> 		______r;						\
> 	}))
> #endif /* CONFIG_PROFILE_ALL_BRANCHES */

if (cond)?  Or is ___r used elsewhere?
-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 18/20] objtool: Add UACCESS validation
  2019-03-07 16:33   ` Linus Torvalds
@ 2019-03-07 17:10     ` hpa
  2019-03-07 17:41     ` Peter Zijlstra
  1 sibling, 0 replies; 100+ messages in thread
From: hpa @ 2019-03-07 17:10 UTC (permalink / raw)
  To: Linus Torvalds, Peter Zijlstra
  Cc: Thomas Gleixner, Julien Thierry, Will Deacon, Andy Lutomirski,
	Ingo Molnar, Catalin Marinas, James Morse, valentin.schneider,
	Brian Gerst, Josh Poimboeuf, Andrew Lutomirski, Borislav Petkov,
	Denys Vlasenko, Linux List Kernel Mailing, Dmitry Vyukov,
	Steven Rostedt

On March 7, 2019 8:33:26 AM PST, Linus Torvalds <torvalds@linux-foundation.org> wrote:
>On Thu, Mar 7, 2019 at 3:52 AM Peter Zijlstra <peterz@infradead.org>
>wrote:
>>
>> XXX: are we sure we want __memset marked AC-safe?
>
>It's certainly one of the safer functions to call with AC set, but it
>sounds wrong anyway. It's not like it's likely to leak kernel data
>(most memset's are with 0, and even the non-zero ones I can't imagine
>are sensitive - more like poison values etc).
>
>What's the call site that made you go "just add __memset() to the
>list"?
>
>            Linus

Agreed... it seems fishy at least.

-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 00/20] objtool: UACCESS validation v3
  2019-03-07 11:45 [PATCH 00/20] objtool: UACCESS validation v3 Peter Zijlstra
                   ` (20 preceding siblings ...)
  2019-03-07 12:03 ` [PATCH 00/20] objtool: UACCESS validation v3 Peter Zijlstra
@ 2019-03-07 17:14 ` hpa
  21 siblings, 0 replies; 100+ messages in thread
From: hpa @ 2019-03-07 17:14 UTC (permalink / raw)
  To: Peter Zijlstra, torvalds, tglx, julien.thierry, will.deacon,
	luto, mingo, catalin.marinas, james.morse, valentin.schneider,
	brgerst, jpoimboe, luto, bp, dvlasenk
  Cc: linux-kernel, peterz, dvyukov, rostedt

On March 7, 2019 3:45:11 AM PST, Peter Zijlstra <peterz@infradead.org> wrote:
>Teach objtool to validate the UACCESS (SMAP, PAN) rules with are
>currently
>unenforced and (therefore obviously) violated.
>
>UACCESS sections should be small; we want to limit the amount of code
>that can
>touch userspace. Furthermore, UACCESS state isn't scheduled, this means
>that
>anything that directly calls into the scheduler will result in random
>code
>running with UACCESS enabled and possibly getting back into the UACCESS
>region
>with UACCESS disabled and causing faults.
>
>Forbid any CALL/RET while UACCESS is enabled; but provide a few
>exceptions.
>
>This builds x86_64-allmodconfig clean, and I've only got a few
>randconfig
>failures left (GCC-8) that I'm not quite understanding.
>
>---
> arch/x86/ia32/ia32_signal.c                |  29 ++-
> arch/x86/include/asm/asm.h                 |  24 --
> arch/x86/include/asm/nospec-branch.h       |   4 +-
> arch/x86/include/asm/smap.h                |  20 ++
> arch/x86/include/asm/uaccess.h             |   5 +-
> arch/x86/include/asm/uaccess_64.h          |   3 -
> arch/x86/include/asm/xen/hypercall.h       |  26 +-
> arch/x86/kernel/signal.c                   |   2 +-
> arch/x86/lib/copy_user_64.S                |  48 ++++
> arch/x86/lib/memcpy_64.S                   |   3 +-
> arch/x86/lib/usercopy_64.c                 |  20 --
> drivers/gpu/drm/i915/i915_gem_execbuffer.c |   6 +-
> include/linux/uaccess.h                    |   2 +
> kernel/trace/trace_branch.c                |   4 +
> lib/Makefile                               |   1 +
> lib/ubsan.c                                |   4 +
> mm/kasan/Makefile                          |   3 +
> mm/kasan/common.c                          |  10 +
> mm/kasan/report.c                          |   3 +-
> scripts/Makefile.build                     |   3 +
> tools/objtool/Makefile                     |   2 +-
> tools/objtool/arch.h                       |   8 +-
> tools/objtool/arch/x86/decode.c            |  26 +-
> tools/objtool/builtin-check.c              |   4 +-
> tools/objtool/builtin.h                    |   2 +-
>tools/objtool/check.c                      | 382
>++++++++++++++++++++++-------
> tools/objtool/check.h                      |   4 +-
> tools/objtool/elf.c                        |  15 +-
> tools/objtool/elf.h                        |   3 +-
> tools/objtool/special.c                    |  10 +-
> tools/objtool/warn.h                       |   8 +
> 31 files changed, 511 insertions(+), 173 deletions(-)
>
>
> 

This is phenomenal. Thank you so much for digging into this. I'm hoping this will greatly reduce the risk of future leakage.
-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 00/20] objtool: UACCESS validation v3
  2019-03-07 17:00         ` Linus Torvalds
@ 2019-03-07 17:17           ` Josh Poimboeuf
  2019-03-07 17:38             ` Peter Zijlstra
  0 siblings, 1 reply; 100+ messages in thread
From: Josh Poimboeuf @ 2019-03-07 17:17 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: Peter Zijlstra, Thomas Gleixner, Peter Anvin, Julien Thierry,
	Will Deacon, Andy Lutomirski, Ingo Molnar, Catalin Marinas,
	James Morse, valentin.schneider, Brian Gerst, Andrew Lutomirski,
	Borislav Petkov, Denys Vlasenko, Linux List Kernel Mailing,
	Dmitry Vyukov, Steven Rostedt

On Thu, Mar 07, 2019 at 09:00:49AM -0800, Linus Torvalds wrote:
> On Thu, Mar 7, 2019 at 8:47 AM Josh Poimboeuf <jpoimboe@redhat.com> wrote:
> >
> > This "fixes" it, and also seems to help -Os make much code:
> 
> Yeah, considering that this __trace_if() macro from hell is doing an
> 'if()' on the result of that inner thing, it makes sense to *not*  use
> that "looks simpler and shorter" array sequence, but depend on the
> compiler then noticing that the conditionals are the same and joining
> the two branches together.
> 
> The compiler has to do much more work to either generate the actual
> dynamic array thing, or notice that the _index_ of the array matches
> the _conditional_ on the branch, and undo that thing.

Yeah, agreed.  Now it doesn't have to do the funky xor thing to convert
the conditional to an int.

> But that macro really is the macro from hell regardless.
> 
> Do people really use CONFIG_PROFILE_ALL_BRANCHES?

IIRC, Steven runs it once a year or so...

-- 
Josh

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 00/20] objtool: UACCESS validation v3
  2019-03-07 17:04         ` [PATCH 00/20] objtool: UACCESS validation v3 hpa
@ 2019-03-07 17:18           ` Josh Poimboeuf
  2019-03-07 17:29             ` hpa
  0 siblings, 1 reply; 100+ messages in thread
From: Josh Poimboeuf @ 2019-03-07 17:18 UTC (permalink / raw)
  To: hpa
  Cc: Peter Zijlstra, torvalds, tglx, julien.thierry, will.deacon,
	luto, mingo, catalin.marinas, james.morse, valentin.schneider,
	brgerst, luto, bp, dvlasenk, linux-kernel, dvyukov, rostedt

On Thu, Mar 07, 2019 at 09:04:36AM -0800, hpa@zytor.com wrote:
> On March 7, 2019 8:47:05 AM PST, Josh Poimboeuf <jpoimboe@redhat.com> wrote:
> >On Thu, Mar 07, 2019 at 02:13:12PM +0100, Peter Zijlstra wrote:
> >> On Thu, Mar 07, 2019 at 01:55:26PM +0100, Peter Zijlstra wrote:
> >> > On Thu, Mar 07, 2019 at 01:03:17PM +0100, Peter Zijlstra wrote:
> >> 
> >> 
> >> > > 01be     20d3:  31 c0                   xor    %eax,%eax
> >> > > 01c0     20d5:  4c 39 eb                cmp    %r13,%rbx
> >> > > 01c3     20d8:  77 08                   ja     20e2
> ><__do_sys_waitid+0x1cd>
> >> 
> >> randconfig-build/kernel/exit.o: warning: objtool:  
> >__do_sys_waitid()+0x1c3: (branch)
> >> 
> >> > > 01cd     20e2:	83 f0 01             	xor    $0x1,%eax
> >> > > 01d0     20e5:	48 89 c2             	mov    %rax,%rdx
> >> > > 01d3     20e8:	83 e2 01             	and    $0x1,%edx
> >> > > 01d6     20eb:	48 83 c2 02          	add    $0x2,%rdx
> >> > > 01da     20ef:	48 ff 04 d5 00 00 00 	incq   0x0(,%rdx,8)
> >> > > 01e1     20f6:	00 
> >> > > 01de 			20f3: R_X86_64_32S	_ftrace_branch+0x148
> >> > > 01e2     20f7:	84 c0                	test   %al,%al
> >> > > 01e4     20f9:	75 2d                	jne    2128
> ><__do_sys_waitid+0x213>
> >> > 
> >> > we do not take this branch and fall-through.
> >> 
> >> And that is the error, I think. We should've taken it and went to:
> >> 
> >>   return -EFAULT;
> >> 
> >> because:
> >> 
> >>  +1be	xor  %eax,%eax	eax=0
> >>  +1cd   xor  $0x1,%eax	eax=1
> >>  +1e2   test %al,%al	1&1==1 -> ZF=0
> >>  +1e4   jnz
> >> 
> >> Is an unconditional code sequence, but there's no way objtool can do
> >> that without becoming a full blown interpreter :/
> >> 
> >> > > 0213     2128:  49 c7 c7 f2 ff ff ff    mov   
> >$0xfffffffffffffff2,%r15
> >> > > ffffffffffffe0eb }
> >> > > 021a     212f:  48 8d 65 d8             lea    -0x28(%rbp),%rsp
> >> > > 021e     2133:  4c 89 f8                mov    %r15,%rax
> >> > > 0221     2136:  5b                      pop    %rbx
> >> > > 0222     2137:  41 5c                   pop    %r12
> >> > > 0224     2139:  41 5d                   pop    %r13
> >> > > 0226     213b:  41 5e                   pop    %r14
> >> > > 0228     213d:  41 5f                   pop    %r15
> >> > > 022a     213f:  5d                      pop    %rbp
> >> > > 022b     2140:  c3                      retq
> >
> >This "fixes" it, and also seems to help -Os make much code:
> >
> >diff --git a/include/linux/compiler.h b/include/linux/compiler.h
> >index 445348facea9..8de63db58fdd 100644
> >--- a/include/linux/compiler.h
> >+++ b/include/linux/compiler.h
> >@@ -67,7 +67,7 @@ void ftrace_likely_update(struct ftrace_likely_data
> >*f, int val,
> > 				.line = __LINE__,			\
> > 			};						\
> > 		______r = !!(cond);					\
> >-		______f.miss_hit[______r]++;					\
> >+		if (______r) ______f.miss_hit[1]++; else ______f.miss_hit[0]++; \
> > 		______r;						\
> > 	}))
> > #endif /* CONFIG_PROFILE_ALL_BRANCHES */
> 
> if (cond)?  Or is ___r used elsewhere?

______r is also the return value.  And it's needed because cond should
only be evaluated once.

-- 
Josh

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 00/20] objtool: UACCESS validation v3
  2019-03-07 17:18           ` Josh Poimboeuf
@ 2019-03-07 17:29             ` hpa
  2019-03-07 17:45               ` Josh Poimboeuf
  0 siblings, 1 reply; 100+ messages in thread
From: hpa @ 2019-03-07 17:29 UTC (permalink / raw)
  To: Josh Poimboeuf
  Cc: Peter Zijlstra, torvalds, tglx, julien.thierry, will.deacon,
	luto, mingo, catalin.marinas, james.morse, valentin.schneider,
	brgerst, luto, bp, dvlasenk, linux-kernel, dvyukov, rostedt

On March 7, 2019 9:18:29 AM PST, Josh Poimboeuf <jpoimboe@redhat.com> wrote:
>On Thu, Mar 07, 2019 at 09:04:36AM -0800, hpa@zytor.com wrote:
>> On March 7, 2019 8:47:05 AM PST, Josh Poimboeuf <jpoimboe@redhat.com>
>wrote:
>> >On Thu, Mar 07, 2019 at 02:13:12PM +0100, Peter Zijlstra wrote:
>> >> On Thu, Mar 07, 2019 at 01:55:26PM +0100, Peter Zijlstra wrote:
>> >> > On Thu, Mar 07, 2019 at 01:03:17PM +0100, Peter Zijlstra wrote:
>> >> 
>> >> 
>> >> > > 01be     20d3:  31 c0                   xor    %eax,%eax
>> >> > > 01c0     20d5:  4c 39 eb                cmp    %r13,%rbx
>> >> > > 01c3     20d8:  77 08                   ja     20e2
>> ><__do_sys_waitid+0x1cd>
>> >> 
>> >> randconfig-build/kernel/exit.o: warning: objtool:  
>> >__do_sys_waitid()+0x1c3: (branch)
>> >> 
>> >> > > 01cd     20e2:	83 f0 01             	xor    $0x1,%eax
>> >> > > 01d0     20e5:	48 89 c2             	mov    %rax,%rdx
>> >> > > 01d3     20e8:	83 e2 01             	and    $0x1,%edx
>> >> > > 01d6     20eb:	48 83 c2 02          	add    $0x2,%rdx
>> >> > > 01da     20ef:	48 ff 04 d5 00 00 00 	incq   0x0(,%rdx,8)
>> >> > > 01e1     20f6:	00 
>> >> > > 01de 			20f3: R_X86_64_32S	_ftrace_branch+0x148
>> >> > > 01e2     20f7:	84 c0                	test   %al,%al
>> >> > > 01e4     20f9:	75 2d                	jne    2128
>> ><__do_sys_waitid+0x213>
>> >> > 
>> >> > we do not take this branch and fall-through.
>> >> 
>> >> And that is the error, I think. We should've taken it and went to:
>> >> 
>> >>   return -EFAULT;
>> >> 
>> >> because:
>> >> 
>> >>  +1be	xor  %eax,%eax	eax=0
>> >>  +1cd   xor  $0x1,%eax	eax=1
>> >>  +1e2   test %al,%al	1&1==1 -> ZF=0
>> >>  +1e4   jnz
>> >> 
>> >> Is an unconditional code sequence, but there's no way objtool can
>do
>> >> that without becoming a full blown interpreter :/
>> >> 
>> >> > > 0213     2128:  49 c7 c7 f2 ff ff ff    mov   
>> >$0xfffffffffffffff2,%r15
>> >> > > ffffffffffffe0eb }
>> >> > > 021a     212f:  48 8d 65 d8             lea   
>-0x28(%rbp),%rsp
>> >> > > 021e     2133:  4c 89 f8                mov    %r15,%rax
>> >> > > 0221     2136:  5b                      pop    %rbx
>> >> > > 0222     2137:  41 5c                   pop    %r12
>> >> > > 0224     2139:  41 5d                   pop    %r13
>> >> > > 0226     213b:  41 5e                   pop    %r14
>> >> > > 0228     213d:  41 5f                   pop    %r15
>> >> > > 022a     213f:  5d                      pop    %rbp
>> >> > > 022b     2140:  c3                      retq
>> >
>> >This "fixes" it, and also seems to help -Os make much code:
>> >
>> >diff --git a/include/linux/compiler.h b/include/linux/compiler.h
>> >index 445348facea9..8de63db58fdd 100644
>> >--- a/include/linux/compiler.h
>> >+++ b/include/linux/compiler.h
>> >@@ -67,7 +67,7 @@ void ftrace_likely_update(struct
>ftrace_likely_data
>> >*f, int val,
>> > 				.line = __LINE__,			\
>> > 			};						\
>> > 		______r = !!(cond);					\
>> >-		______f.miss_hit[______r]++;					\
>> >+		if (______r) ______f.miss_hit[1]++; else ______f.miss_hit[0]++; \
>> > 		______r;						\
>> > 	}))
>> > #endif /* CONFIG_PROFILE_ALL_BRANCHES */
>> 
>> if (cond)?  Or is ___r used elsewhere?
>
>______r is also the return value.  And it's needed because cond should
>only be evaluated once.

So put a true; and false; inside the if.
-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 00/20] objtool: UACCESS validation v3
  2019-03-07 17:17           ` Josh Poimboeuf
@ 2019-03-07 17:38             ` Peter Zijlstra
  2019-03-07 17:45               ` Linus Torvalds
  0 siblings, 1 reply; 100+ messages in thread
From: Peter Zijlstra @ 2019-03-07 17:38 UTC (permalink / raw)
  To: Josh Poimboeuf
  Cc: Linus Torvalds, Thomas Gleixner, Peter Anvin, Julien Thierry,
	Will Deacon, Andy Lutomirski, Ingo Molnar, Catalin Marinas,
	James Morse, valentin.schneider, Brian Gerst, Andrew Lutomirski,
	Borislav Petkov, Denys Vlasenko, Linux List Kernel Mailing,
	Dmitry Vyukov, Steven Rostedt

On Thu, Mar 07, 2019 at 11:17:09AM -0600, Josh Poimboeuf wrote:
> On Thu, Mar 07, 2019 at 09:00:49AM -0800, Linus Torvalds wrote:
> > But that macro really is the macro from hell regardless.
> > 
> > Do people really use CONFIG_PROFILE_ALL_BRANCHES?
> 
> IIRC, Steven runs it once a year or so...

That's TRACE_BRANCH_PROFILING; PROFILE_ALL_BRANCHES I don't know, that
mostly just gets in the way I think.

Also; it seems to me that something PT, or maybe even simply:

  perf -e branches -e branch-misses

would get you similar or sufficient information.

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 18/20] objtool: Add UACCESS validation
  2019-03-07 16:33   ` Linus Torvalds
  2019-03-07 17:10     ` hpa
@ 2019-03-07 17:41     ` Peter Zijlstra
  2019-03-07 17:54       ` Linus Torvalds
  2019-03-07 20:15       ` Andrey Ryabinin
  1 sibling, 2 replies; 100+ messages in thread
From: Peter Zijlstra @ 2019-03-07 17:41 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: Thomas Gleixner, Peter Anvin, Julien Thierry, Will Deacon,
	Andy Lutomirski, Ingo Molnar, Catalin Marinas, James Morse,
	valentin.schneider, Brian Gerst, Josh Poimboeuf,
	Andrew Lutomirski, Borislav Petkov, Denys Vlasenko,
	Linux List Kernel Mailing, Dmitry Vyukov, Steven Rostedt

On Thu, Mar 07, 2019 at 08:33:26AM -0800, Linus Torvalds wrote:
> On Thu, Mar 7, 2019 at 3:52 AM Peter Zijlstra <peterz@infradead.org> wrote:
> >
> > XXX: are we sure we want __memset marked AC-safe?
> 
> It's certainly one of the safer functions to call with AC set, but it
> sounds wrong anyway. It's not like it's likely to leak kernel data
> (most memset's are with 0, and even the non-zero ones I can't imagine
> are sensitive - more like poison values etc).
> 
> What's the call site that made you go "just add __memset() to the list"?

__asan_{,un}poinson_stack_memory()
  kasan_{,un}poison_shadow()
    __memset()



^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 00/20] objtool: UACCESS validation v3
  2019-03-07 16:47       ` Josh Poimboeuf
                           ` (2 preceding siblings ...)
  2019-03-07 17:04         ` [PATCH 00/20] objtool: UACCESS validation v3 hpa
@ 2019-03-07 17:43         ` Peter Zijlstra
  2019-03-07 17:48           ` Josh Poimboeuf
  3 siblings, 1 reply; 100+ messages in thread
From: Peter Zijlstra @ 2019-03-07 17:43 UTC (permalink / raw)
  To: Josh Poimboeuf
  Cc: torvalds, tglx, hpa, julien.thierry, will.deacon, luto, mingo,
	catalin.marinas, james.morse, valentin.schneider, brgerst, luto,
	bp, dvlasenk, linux-kernel, dvyukov, rostedt

On Thu, Mar 07, 2019 at 10:47:05AM -0600, Josh Poimboeuf wrote:

> This "fixes" it, and also seems to help -Os make much code:
> 
> diff --git a/include/linux/compiler.h b/include/linux/compiler.h
> index 445348facea9..8de63db58fdd 100644
> --- a/include/linux/compiler.h
> +++ b/include/linux/compiler.h
> @@ -67,7 +67,7 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val,
>  				.line = __LINE__,			\
>  			};						\
>  		______r = !!(cond);					\
> -		______f.miss_hit[______r]++;					\
> +		if (______r) ______f.miss_hit[1]++; else ______f.miss_hit[0]++; \
>  		______r;						\
>  	}))
>  #endif /* CONFIG_PROFILE_ALL_BRANCHES */

Excellen; let me put the kids to bed and then I'll have a poke.

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 00/20] objtool: UACCESS validation v3
  2019-03-07 17:38             ` Peter Zijlstra
@ 2019-03-07 17:45               ` Linus Torvalds
  2019-03-07 18:18                 ` Steven Rostedt
  0 siblings, 1 reply; 100+ messages in thread
From: Linus Torvalds @ 2019-03-07 17:45 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: Josh Poimboeuf, Thomas Gleixner, Peter Anvin, Julien Thierry,
	Will Deacon, Andy Lutomirski, Ingo Molnar, Catalin Marinas,
	James Morse, valentin.schneider, Brian Gerst, Andrew Lutomirski,
	Borislav Petkov, Denys Vlasenko, Linux List Kernel Mailing,
	Dmitry Vyukov, Steven Rostedt

On Thu, Mar 7, 2019 at 9:38 AM Peter Zijlstra <peterz@infradead.org> wrote:
>
> Also; it seems to me that something PT, or maybe even simply:
>
>   perf -e branches -e branch-misses
>
> would get you similar or sufficient information.

Yeah, I'm not really seeing a lot of upside to PROFILE_ALL_BRANCHES.

Particularly since it doesn't actually profile all branches at all. It
only basically profiles "if ()" statements, which obviously misses
loops etc, but then also _does_ hit things where people turned loops
into "if (unlikely()) loop()", which happens in (for example)
low-level locking code etc that often has a fast-case "first try"
thing followed by a slow-case "ok, let's loop for it" thing.

So I think PROFILE_ALL_BRANCHES tends to have very random coverage.
I'd love to get rid of it, because it seems so random.

               Linus

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 00/20] objtool: UACCESS validation v3
  2019-03-07 17:29             ` hpa
@ 2019-03-07 17:45               ` Josh Poimboeuf
  2019-03-07 17:48                 ` Linus Torvalds
  0 siblings, 1 reply; 100+ messages in thread
From: Josh Poimboeuf @ 2019-03-07 17:45 UTC (permalink / raw)
  To: hpa
  Cc: Peter Zijlstra, torvalds, tglx, julien.thierry, will.deacon,
	luto, mingo, catalin.marinas, james.morse, valentin.schneider,
	brgerst, luto, bp, dvlasenk, linux-kernel, dvyukov, rostedt

On Thu, Mar 07, 2019 at 09:29:17AM -0800, hpa@zytor.com wrote:
> On March 7, 2019 9:18:29 AM PST, Josh Poimboeuf <jpoimboe@redhat.com> wrote:
> >On Thu, Mar 07, 2019 at 09:04:36AM -0800, hpa@zytor.com wrote:
> >> On March 7, 2019 8:47:05 AM PST, Josh Poimboeuf <jpoimboe@redhat.com>
> >wrote:
> >> >On Thu, Mar 07, 2019 at 02:13:12PM +0100, Peter Zijlstra wrote:
> >> >> On Thu, Mar 07, 2019 at 01:55:26PM +0100, Peter Zijlstra wrote:
> >> >> > On Thu, Mar 07, 2019 at 01:03:17PM +0100, Peter Zijlstra wrote:
> >> >> 
> >> >> 
> >> >> > > 01be     20d3:  31 c0                   xor    %eax,%eax
> >> >> > > 01c0     20d5:  4c 39 eb                cmp    %r13,%rbx
> >> >> > > 01c3     20d8:  77 08                   ja     20e2
> >> ><__do_sys_waitid+0x1cd>
> >> >> 
> >> >> randconfig-build/kernel/exit.o: warning: objtool:  
> >> >__do_sys_waitid()+0x1c3: (branch)
> >> >> 
> >> >> > > 01cd     20e2:	83 f0 01             	xor    $0x1,%eax
> >> >> > > 01d0     20e5:	48 89 c2             	mov    %rax,%rdx
> >> >> > > 01d3     20e8:	83 e2 01             	and    $0x1,%edx
> >> >> > > 01d6     20eb:	48 83 c2 02          	add    $0x2,%rdx
> >> >> > > 01da     20ef:	48 ff 04 d5 00 00 00 	incq   0x0(,%rdx,8)
> >> >> > > 01e1     20f6:	00 
> >> >> > > 01de 			20f3: R_X86_64_32S	_ftrace_branch+0x148
> >> >> > > 01e2     20f7:	84 c0                	test   %al,%al
> >> >> > > 01e4     20f9:	75 2d                	jne    2128
> >> ><__do_sys_waitid+0x213>
> >> >> > 
> >> >> > we do not take this branch and fall-through.
> >> >> 
> >> >> And that is the error, I think. We should've taken it and went to:
> >> >> 
> >> >>   return -EFAULT;
> >> >> 
> >> >> because:
> >> >> 
> >> >>  +1be	xor  %eax,%eax	eax=0
> >> >>  +1cd   xor  $0x1,%eax	eax=1
> >> >>  +1e2   test %al,%al	1&1==1 -> ZF=0
> >> >>  +1e4   jnz
> >> >> 
> >> >> Is an unconditional code sequence, but there's no way objtool can
> >do
> >> >> that without becoming a full blown interpreter :/
> >> >> 
> >> >> > > 0213     2128:  49 c7 c7 f2 ff ff ff    mov   
> >> >$0xfffffffffffffff2,%r15
> >> >> > > ffffffffffffe0eb }
> >> >> > > 021a     212f:  48 8d 65 d8             lea   
> >-0x28(%rbp),%rsp
> >> >> > > 021e     2133:  4c 89 f8                mov    %r15,%rax
> >> >> > > 0221     2136:  5b                      pop    %rbx
> >> >> > > 0222     2137:  41 5c                   pop    %r12
> >> >> > > 0224     2139:  41 5d                   pop    %r13
> >> >> > > 0226     213b:  41 5e                   pop    %r14
> >> >> > > 0228     213d:  41 5f                   pop    %r15
> >> >> > > 022a     213f:  5d                      pop    %rbp
> >> >> > > 022b     2140:  c3                      retq
> >> >
> >> >This "fixes" it, and also seems to help -Os make much code:
> >> >
> >> >diff --git a/include/linux/compiler.h b/include/linux/compiler.h
> >> >index 445348facea9..8de63db58fdd 100644
> >> >--- a/include/linux/compiler.h
> >> >+++ b/include/linux/compiler.h
> >> >@@ -67,7 +67,7 @@ void ftrace_likely_update(struct
> >ftrace_likely_data
> >> >*f, int val,
> >> > 				.line = __LINE__,			\
> >> > 			};						\
> >> > 		______r = !!(cond);					\
> >> >-		______f.miss_hit[______r]++;					\
> >> >+		if (______r) ______f.miss_hit[1]++; else ______f.miss_hit[0]++; \
> >> > 		______r;						\
> >> > 	}))
> >> > #endif /* CONFIG_PROFILE_ALL_BRANCHES */
> >> 
> >> if (cond)?  Or is ___r used elsewhere?
> >
> >______r is also the return value.  And it's needed because cond should
> >only be evaluated once.
> 
> So put a true; and false; inside the if.

Is that possible to do in a C macro?  Doesn't seem to work for me...

-- 
Josh

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 00/20] objtool: UACCESS validation v3
  2019-03-07 17:43         ` Peter Zijlstra
@ 2019-03-07 17:48           ` Josh Poimboeuf
  2019-04-03  8:21             ` [tip:core/objtool] tracing: Improve "if" macro code generation tip-bot for Josh Poimboeuf
  0 siblings, 1 reply; 100+ messages in thread
From: Josh Poimboeuf @ 2019-03-07 17:48 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: torvalds, tglx, hpa, julien.thierry, will.deacon, luto, mingo,
	catalin.marinas, james.morse, valentin.schneider, brgerst, luto,
	bp, dvlasenk, linux-kernel, dvyukov, rostedt

On Thu, Mar 07, 2019 at 06:43:22PM +0100, Peter Zijlstra wrote:
> On Thu, Mar 07, 2019 at 10:47:05AM -0600, Josh Poimboeuf wrote:
> 
> > This "fixes" it, and also seems to help -Os make much code:
> > 
> > diff --git a/include/linux/compiler.h b/include/linux/compiler.h
> > index 445348facea9..8de63db58fdd 100644
> > --- a/include/linux/compiler.h
> > +++ b/include/linux/compiler.h
> > @@ -67,7 +67,7 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val,
> >  				.line = __LINE__,			\
> >  			};						\
> >  		______r = !!(cond);					\
> > -		______f.miss_hit[______r]++;					\
> > +		if (______r) ______f.miss_hit[1]++; else ______f.miss_hit[0]++; \
> >  		______r;						\
> >  	}))
> >  #endif /* CONFIG_PROFILE_ALL_BRANCHES */
> 
> Excellen; let me put the kids to bed and then I'll have a poke.

Here's a proper patch.

From: Josh Poimboeuf <jpoimboe@redhat.com>
Subject: [PATCH] tracing: Improve "if" macro code generation

With CONFIG_PROFILE_ALL_BRANCHES, the "if" macro converts the
conditional to an array index.  This can cause GCC to create horrible
code.  When there are nested ifs, the generated code uses register
values to encode branching decisions.

Make it easier for GCC to optimize by keeping the conditional as a
conditional rather than converting it to an integer.  This shrinks the
generated code quite a bit, and also makes the code sane enough for
objtool to understand.

Reported-by: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
---
 include/linux/compiler.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index 445348facea9..d58aa0db05f9 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -67,7 +67,7 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val,
 				.line = __LINE__,			\
 			};						\
 		______r = !!(cond);					\
-		______f.miss_hit[______r]++;					\
+		______r ? ______f.miss_hit[1]++ : ______f.miss_hit[0]++;\
 		______r;						\
 	}))
 #endif /* CONFIG_PROFILE_ALL_BRANCHES */
-- 
2.17.2


^ permalink raw reply related	[flat|nested] 100+ messages in thread

* Re: [PATCH 00/20] objtool: UACCESS validation v3
  2019-03-07 17:45               ` Josh Poimboeuf
@ 2019-03-07 17:48                 ` Linus Torvalds
  0 siblings, 0 replies; 100+ messages in thread
From: Linus Torvalds @ 2019-03-07 17:48 UTC (permalink / raw)
  To: Josh Poimboeuf
  Cc: Peter Anvin, Peter Zijlstra, Thomas Gleixner, Julien Thierry,
	Will Deacon, Andy Lutomirski, Ingo Molnar, Catalin Marinas,
	James Morse, valentin.schneider, Brian Gerst, Andrew Lutomirski,
	Borislav Petkov, Denys Vlasenko, Linux List Kernel Mailing,
	Dmitry Vyukov, Steven Rostedt

On Thu, Mar 7, 2019 at 9:46 AM Josh Poimboeuf <jpoimboe@redhat.com> wrote:
>
> Is that possible to do in a C macro?  Doesn't seem to work for me...

The meat of that macro could easily be done as a helper inline function.

But as mentioned, I think a better option would be to remove it
entirely, if at all possible.

The best part about that config option is the comment, and while cute
I don't think that's really worth saving it for...

               Linus

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 18/20] objtool: Add UACCESS validation
  2019-03-07 17:41     ` Peter Zijlstra
@ 2019-03-07 17:54       ` Linus Torvalds
  2019-03-07 18:48         ` Peter Zijlstra
  2019-03-07 20:15       ` Andrey Ryabinin
  1 sibling, 1 reply; 100+ messages in thread
From: Linus Torvalds @ 2019-03-07 17:54 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: Thomas Gleixner, Peter Anvin, Julien Thierry, Will Deacon,
	Andy Lutomirski, Ingo Molnar, Catalin Marinas, James Morse,
	valentin.schneider, Brian Gerst, Josh Poimboeuf,
	Andrew Lutomirski, Borislav Petkov, Denys Vlasenko,
	Linux List Kernel Mailing, Dmitry Vyukov, Steven Rostedt

On Thu, Mar 7, 2019 at 9:41 AM Peter Zijlstra <peterz@infradead.org> wrote:
> >
> > What's the call site that made you go "just add __memset() to the list"?
>
> __asan_{,un}poinson_stack_memory()
>   kasan_{,un}poison_shadow()
>     __memset()

Ugh. I think I almost just agree with your decision to just let that
memset go unchecked.

I'm not saying it's right, but it doesn't seem to be a fight worth fighting.

Again, maybe we could avoid the static checking entirely for the
complex configs, and just make preempt_schedule() not do it for AC
regions.

Because AC vs KASAN in general ends up smelling like "not a fight
worth fighting" to me. You've done a herculean job, but..

                 Linus

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 07/20] x86/uaccess: Always inline force_valid_ss()
  2019-03-07 11:45 ` [PATCH 07/20] x86/uaccess: Always inline force_valid_ss() Peter Zijlstra
  2019-03-07 13:50   ` Peter Zijlstra
@ 2019-03-07 18:05   ` Andy Lutomirski
  2019-03-07 18:59     ` Peter Zijlstra
  1 sibling, 1 reply; 100+ messages in thread
From: Andy Lutomirski @ 2019-03-07 18:05 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: Linus Torvalds, Thomas Gleixner, H. Peter Anvin, Julien Thierry,
	Will Deacon, Ingo Molnar, Catalin Marinas, James Morse,
	valentin.schneider, Brian Gerst, Josh Poimboeuf,
	Andrew Lutomirski, Borislav Petkov, Denys Vlasenko, LKML,
	Dmitry Vyukov, Steven Rostedt

On Thu, Mar 7, 2019 at 3:52 AM Peter Zijlstra <peterz@infradead.org> wrote:
>
> arch/x86/kernel/signal.o: warning: objtool: restore_sigcontext()+0x3cc: call to force_valid_ss.isra.5() with UACCESS enabled
>
> XXX: move the callsite out of te AC=1 region instead?

Let's move it instead.  I looked at the code and it should be fine.

--Andy

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 00/20] objtool: UACCESS validation v3
  2019-03-07 17:45               ` Linus Torvalds
@ 2019-03-07 18:18                 ` Steven Rostedt
  2019-03-10 13:16                   ` Peter Zijlstra
  0 siblings, 1 reply; 100+ messages in thread
From: Steven Rostedt @ 2019-03-07 18:18 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: Peter Zijlstra, Josh Poimboeuf, Thomas Gleixner, Peter Anvin,
	Julien Thierry, Will Deacon, Andy Lutomirski, Ingo Molnar,
	Catalin Marinas, James Morse, valentin.schneider, Brian Gerst,
	Andrew Lutomirski, Borislav Petkov, Denys Vlasenko,
	Linux List Kernel Mailing, Dmitry Vyukov, Slavomir Kaslev

On Thu, 7 Mar 2019 09:45:35 -0800
Linus Torvalds <torvalds@linux-foundation.org> wrote:

> On Thu, Mar 7, 2019 at 9:38 AM Peter Zijlstra <peterz@infradead.org> wrote:
> >
> > Also; it seems to me that something PT, or maybe even simply:
> >
> >   perf -e branches -e branch-misses
> >
> > would get you similar or sufficient information.  
> 
> Yeah, I'm not really seeing a lot of upside to PROFILE_ALL_BRANCHES.
> 
> Particularly since it doesn't actually profile all branches at all. It
> only basically profiles "if ()" statements, which obviously misses
> loops etc, but then also _does_ hit things where people turned loops
> into "if (unlikely()) loop()", which happens in (for example)
> low-level locking code etc that often has a fast-case "first try"
> thing followed by a slow-case "ok, let's loop for it" thing.
> 
> So I think PROFILE_ALL_BRANCHES tends to have very random coverage.
> I'd love to get rid of it, because it seems so random.
>

As Josh said, I run it once a year on two production (real use)
machines for 2 to 4 weeks and collect the data to see if there are
places that can be optimized better.

I currently have one of my engineers looking at the data and may be
sending patches soon. It's basically an entry level way to get into
kernel development. Note, no patch will be sent just because of the
data from the profiling. The task is to look at and understand the
code, and see if it can be optimized (with likely/unlikely or flow
changes). It's a way to get a better understanding of the kernel in
various locations. It is by no means "profiler said this, lets change
it." All changes must be rational, and make sense. The profiler is only
used to help find those places.

The data that was run at the end of January can be found here:

 http://rostedt.homelinux.com/branches/mammoth-branches-2019/
 http://rostedt.homelinux.com/branches/gandalf-branches-2019/

-- Steve

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 18/20] objtool: Add UACCESS validation
  2019-03-07 17:54       ` Linus Torvalds
@ 2019-03-07 18:48         ` Peter Zijlstra
  2019-03-07 18:51           ` hpa
                             ` (2 more replies)
  0 siblings, 3 replies; 100+ messages in thread
From: Peter Zijlstra @ 2019-03-07 18:48 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: Thomas Gleixner, Peter Anvin, Julien Thierry, Will Deacon,
	Andy Lutomirski, Ingo Molnar, Catalin Marinas, James Morse,
	valentin.schneider, Brian Gerst, Josh Poimboeuf,
	Andrew Lutomirski, Borislav Petkov, Denys Vlasenko,
	Linux List Kernel Mailing, Dmitry Vyukov, Steven Rostedt

On Thu, Mar 07, 2019 at 09:54:14AM -0800, Linus Torvalds wrote:
> On Thu, Mar 7, 2019 at 9:41 AM Peter Zijlstra <peterz@infradead.org> wrote:
> > >
> > > What's the call site that made you go "just add __memset() to the list"?
> >
> > __asan_{,un}poinson_stack_memory()
> >   kasan_{,un}poison_shadow()
> >     __memset()
> 
> Ugh. I think I almost just agree with your decision to just let that
> memset go unchecked.
> 
> I'm not saying it's right, but it doesn't seem to be a fight worth fighting.

One think I could do; is add a filter to each function and only allow
__memset from the kasan code, and not from anywhere else.

Another thing I need to look at is why objtool only found memset_orig
(from __memset) but not memset_erms, which if I read the code right, is
a possible alternative there.

> Because AC vs KASAN in general ends up smelling like "not a fight
> worth fighting" to me. You've done a herculean job, but..

I know,.. I've been so close to doing that so many times, but it
seems like defeat, esp. since I'm so close now :-)


^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 18/20] objtool: Add UACCESS validation
  2019-03-07 18:48         ` Peter Zijlstra
@ 2019-03-07 18:51           ` hpa
  2019-03-07 19:03           ` Peter Zijlstra
  2019-03-07 20:23           ` Peter Zijlstra
  2 siblings, 0 replies; 100+ messages in thread
From: hpa @ 2019-03-07 18:51 UTC (permalink / raw)
  To: Peter Zijlstra, Linus Torvalds
  Cc: Thomas Gleixner, Julien Thierry, Will Deacon, Andy Lutomirski,
	Ingo Molnar, Catalin Marinas, James Morse, valentin.schneider,
	Brian Gerst, Josh Poimboeuf, Andrew Lutomirski, Borislav Petkov,
	Denys Vlasenko, Linux List Kernel Mailing, Dmitry Vyukov,
	Steven Rostedt

On March 7, 2019 10:48:13 AM PST, Peter Zijlstra <peterz@infradead.org> wrote:
>On Thu, Mar 07, 2019 at 09:54:14AM -0800, Linus Torvalds wrote:
>> On Thu, Mar 7, 2019 at 9:41 AM Peter Zijlstra <peterz@infradead.org>
>wrote:
>> > >
>> > > What's the call site that made you go "just add __memset() to the
>list"?
>> >
>> > __asan_{,un}poinson_stack_memory()
>> >   kasan_{,un}poison_shadow()
>> >     __memset()
>> 
>> Ugh. I think I almost just agree with your decision to just let that
>> memset go unchecked.
>> 
>> I'm not saying it's right, but it doesn't seem to be a fight worth
>fighting.
>
>One think I could do; is add a filter to each function and only allow
>__memset from the kasan code, and not from anywhere else.
>
>Another thing I need to look at is why objtool only found memset_orig
>(from __memset) but not memset_erms, which if I read the code right, is
>a possible alternative there.
>
>> Because AC vs KASAN in general ends up smelling like "not a fight
>> worth fighting" to me. You've done a herculean job, but..
>
>I know,.. I've been so close to doing that so many times, but it
>seems like defeat, esp. since I'm so close now :-)

___memset_kasan()?
-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 07/20] x86/uaccess: Always inline force_valid_ss()
  2019-03-07 18:05   ` Andy Lutomirski
@ 2019-03-07 18:59     ` Peter Zijlstra
  2019-03-07 19:06       ` Andy Lutomirski
  0 siblings, 1 reply; 100+ messages in thread
From: Peter Zijlstra @ 2019-03-07 18:59 UTC (permalink / raw)
  To: Andy Lutomirski
  Cc: Linus Torvalds, Thomas Gleixner, H. Peter Anvin, Julien Thierry,
	Will Deacon, Ingo Molnar, Catalin Marinas, James Morse,
	valentin.schneider, Brian Gerst, Josh Poimboeuf,
	Andrew Lutomirski, Borislav Petkov, Denys Vlasenko, LKML,
	Dmitry Vyukov, Steven Rostedt

On Thu, Mar 07, 2019 at 10:05:43AM -0800, Andy Lutomirski wrote:
> On Thu, Mar 7, 2019 at 3:52 AM Peter Zijlstra <peterz@infradead.org> wrote:
> >
> > arch/x86/kernel/signal.o: warning: objtool: restore_sigcontext()+0x3cc: call to force_valid_ss.isra.5() with UACCESS enabled
> >
> > XXX: move the callsite out of te AC=1 region instead?
> 
> Let's move it instead.  I looked at the code and it should be fine.

Something like so; or did I miss something subtle?

--- a/arch/x86/kernel/signal.c
+++ b/arch/x86/kernel/signal.c
@@ -132,16 +132,6 @@ static int restore_sigcontext(struct pt_
 		COPY_SEG_CPL3(cs);
 		COPY_SEG_CPL3(ss);
 
-#ifdef CONFIG_X86_64
-		/*
-		 * Fix up SS if needed for the benefit of old DOSEMU and
-		 * CRIU.
-		 */
-		if (unlikely(!(uc_flags & UC_STRICT_RESTORE_SS) &&
-			     user_64bit_mode(regs)))
-			force_valid_ss(regs);
-#endif
-
 		get_user_ex(tmpflags, &sc->flags);
 		regs->flags = (regs->flags & ~FIX_EFLAGS) | (tmpflags & FIX_EFLAGS);
 		regs->orig_ax = -1;		/* disable syscall checks */
@@ -150,6 +140,15 @@ static int restore_sigcontext(struct pt_
 		buf = (void __user *)buf_val;
 	} get_user_catch(err);
 
+#ifdef CONFIG_X86_64
+	/*
+	 * Fix up SS if needed for the benefit of old DOSEMU and
+	 * CRIU.
+	 */
+	if (unlikely(!(uc_flags & UC_STRICT_RESTORE_SS) && user_64bit_mode(regs)))
+		force_valid_ss(regs);
+#endif
+
 	err |= fpu__restore_sig(buf, IS_ENABLED(CONFIG_X86_32));
 
 	force_iret();
@@ -441,7 +440,7 @@ static int __setup_rt_frame(int sig, str
 	return 0;
 }
 #else /* !CONFIG_X86_32 */
-static unsigned long frame_uc_flags(struct pt_regs *regs)
+static __always_inline unsigned long frame_uc_flags(struct pt_regs *regs)
 {
 	unsigned long flags;
 
@@ -461,6 +460,7 @@ static int __setup_rt_frame(int sig, str
 {
 	struct rt_sigframe __user *frame;
 	void __user *fp = NULL;
+	unsigned long uc_flags;
 	int err = 0;
 
 	frame = get_sigframe(&ksig->ka, regs, sizeof(struct rt_sigframe), &fp);
@@ -473,9 +473,11 @@ static int __setup_rt_frame(int sig, str
 			return -EFAULT;
 	}
 
+	uc_flags = frame_uc_flags(regs);
+
 	put_user_try {
 		/* Create the ucontext.  */
-		put_user_ex(frame_uc_flags(regs), &frame->uc.uc_flags);
+		put_user_ex(uc_flags, &frame->uc.uc_flags);
 		put_user_ex(0, &frame->uc.uc_link);
 		save_altstack_ex(&frame->uc.uc_stack, regs->sp);
 


^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 18/20] objtool: Add UACCESS validation
  2019-03-07 18:48         ` Peter Zijlstra
  2019-03-07 18:51           ` hpa
@ 2019-03-07 19:03           ` Peter Zijlstra
  2019-03-08 15:01             ` Josh Poimboeuf
  2019-03-07 20:23           ` Peter Zijlstra
  2 siblings, 1 reply; 100+ messages in thread
From: Peter Zijlstra @ 2019-03-07 19:03 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: Thomas Gleixner, Peter Anvin, Julien Thierry, Will Deacon,
	Andy Lutomirski, Ingo Molnar, Catalin Marinas, James Morse,
	valentin.schneider, Brian Gerst, Josh Poimboeuf,
	Andrew Lutomirski, Borislav Petkov, Denys Vlasenko,
	Linux List Kernel Mailing, Dmitry Vyukov, Steven Rostedt

On Thu, Mar 07, 2019 at 07:48:13PM +0100, Peter Zijlstra wrote:
> On Thu, Mar 07, 2019 at 09:54:14AM -0800, Linus Torvalds wrote:
> > On Thu, Mar 7, 2019 at 9:41 AM Peter Zijlstra <peterz@infradead.org> wrote:
> > > >
> > > > What's the call site that made you go "just add __memset() to the list"?
> > >
> > > __asan_{,un}poinson_stack_memory()
> > >   kasan_{,un}poison_shadow()
> > >     __memset()
> > 
> > Ugh. I think I almost just agree with your decision to just let that
> > memset go unchecked.
> > 
> > I'm not saying it's right, but it doesn't seem to be a fight worth fighting.
> 
> One think I could do; is add a filter to each function and only allow
> __memset from the kasan code, and not from anywhere else.

Ah.. how about I feed objtool a text file with all these symbol names;
and I have Makefile compose file that from fragments.

Then only KASAN builds will have memset whitelisted, and any other build
will still flag memset abuse.

Now I only have to figure out how to make Makefile do something like
that :-)

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 07/20] x86/uaccess: Always inline force_valid_ss()
  2019-03-07 18:59     ` Peter Zijlstra
@ 2019-03-07 19:06       ` Andy Lutomirski
  0 siblings, 0 replies; 100+ messages in thread
From: Andy Lutomirski @ 2019-03-07 19:06 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: Linus Torvalds, Thomas Gleixner, H. Peter Anvin, Julien Thierry,
	Will Deacon, Ingo Molnar, Catalin Marinas, James Morse,
	valentin.schneider, Brian Gerst, Josh Poimboeuf,
	Andrew Lutomirski, Borislav Petkov, Denys Vlasenko, LKML,
	Dmitry Vyukov, Steven Rostedt

On Thu, Mar 7, 2019 at 10:59 AM Peter Zijlstra <peterz@infradead.org> wrote:
>
> On Thu, Mar 07, 2019 at 10:05:43AM -0800, Andy Lutomirski wrote:
> > On Thu, Mar 7, 2019 at 3:52 AM Peter Zijlstra <peterz@infradead.org> wrote:
> > >
> > > arch/x86/kernel/signal.o: warning: objtool: restore_sigcontext()+0x3cc: call to force_valid_ss.isra.5() with UACCESS enabled
> > >
> > > XXX: move the callsite out of te AC=1 region instead?
> >
> > Let's move it instead.  I looked at the code and it should be fine.
>
> Something like so; or did I miss something subtle?

Reviewed-by: Andy Lutomirski <luto@kernel.org>

Also, this stuff is pretty well covered by the x86 selftests, mostly
because getting it right in the first place was way too subtle for
comfort.

--Andy

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 18/20] objtool: Add UACCESS validation
  2019-03-07 17:41     ` Peter Zijlstra
  2019-03-07 17:54       ` Linus Torvalds
@ 2019-03-07 20:15       ` Andrey Ryabinin
  2019-03-07 20:33         ` Peter Zijlstra
  1 sibling, 1 reply; 100+ messages in thread
From: Andrey Ryabinin @ 2019-03-07 20:15 UTC (permalink / raw)
  To: Peter Zijlstra, Linus Torvalds
  Cc: Thomas Gleixner, Peter Anvin, Julien Thierry, Will Deacon,
	Andy Lutomirski, Ingo Molnar, Catalin Marinas, James Morse,
	valentin.schneider, Brian Gerst, Josh Poimboeuf,
	Andrew Lutomirski, Borislav Petkov, Denys Vlasenko,
	Linux List Kernel Mailing, Dmitry Vyukov, Steven Rostedt



On 3/7/19 8:41 PM, Peter Zijlstra wrote:
> On Thu, Mar 07, 2019 at 08:33:26AM -0800, Linus Torvalds wrote:
>> On Thu, Mar 7, 2019 at 3:52 AM Peter Zijlstra <peterz@infradead.org> wrote:
>>>
>>> XXX: are we sure we want __memset marked AC-safe?
>>
>> It's certainly one of the safer functions to call with AC set, but it
>> sounds wrong anyway. It's not like it's likely to leak kernel data
>> (most memset's are with 0, and even the non-zero ones I can't imagine
>> are sensitive - more like poison values etc).
>>
>> What's the call site that made you go "just add __memset() to the list"?
> 
> __asan_{,un}poinson_stack_memory()

These two can be called only with CONFIG_KASAN_EXTRA=y which 
was removed very recently, so it should be safe to delete these functions.

>   kasan_{,un}poison_shadow()
>     __memset()
> 
> 

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 18/20] objtool: Add UACCESS validation
  2019-03-07 18:48         ` Peter Zijlstra
  2019-03-07 18:51           ` hpa
  2019-03-07 19:03           ` Peter Zijlstra
@ 2019-03-07 20:23           ` Peter Zijlstra
  2019-03-07 20:40             ` Peter Zijlstra
  2 siblings, 1 reply; 100+ messages in thread
From: Peter Zijlstra @ 2019-03-07 20:23 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: Thomas Gleixner, Peter Anvin, Julien Thierry, Will Deacon,
	Andy Lutomirski, Ingo Molnar, Catalin Marinas, James Morse,
	valentin.schneider, Brian Gerst, Josh Poimboeuf,
	Andrew Lutomirski, Borislav Petkov, Denys Vlasenko,
	Linux List Kernel Mailing, Dmitry Vyukov, Steven Rostedt

On Thu, Mar 07, 2019 at 07:48:13PM +0100, Peter Zijlstra wrote:
> Another thing I need to look at is why objtool only found memset_orig
> (from __memset) but not memset_erms, which if I read the code right, is
> a possible alternative there.

Turns out we only look for sibling calls in the original instruction
stream, not in any alternatives; which in general seems like a fair
enough assumption.

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 18/20] objtool: Add UACCESS validation
  2019-03-07 20:15       ` Andrey Ryabinin
@ 2019-03-07 20:33         ` Peter Zijlstra
  2019-03-07 20:40           ` Andrey Ryabinin
  2019-03-07 20:42           ` Peter Zijlstra
  0 siblings, 2 replies; 100+ messages in thread
From: Peter Zijlstra @ 2019-03-07 20:33 UTC (permalink / raw)
  To: Andrey Ryabinin
  Cc: Linus Torvalds, Thomas Gleixner, Peter Anvin, Julien Thierry,
	Will Deacon, Andy Lutomirski, Ingo Molnar, Catalin Marinas,
	James Morse, valentin.schneider, Brian Gerst, Josh Poimboeuf,
	Andrew Lutomirski, Borislav Petkov, Denys Vlasenko,
	Linux List Kernel Mailing, Dmitry Vyukov, Steven Rostedt

On Thu, Mar 07, 2019 at 11:15:42PM +0300, Andrey Ryabinin wrote:
> 
> 
> On 3/7/19 8:41 PM, Peter Zijlstra wrote:
> > On Thu, Mar 07, 2019 at 08:33:26AM -0800, Linus Torvalds wrote:
> >> On Thu, Mar 7, 2019 at 3:52 AM Peter Zijlstra <peterz@infradead.org> wrote:
> >>>
> >>> XXX: are we sure we want __memset marked AC-safe?
> >>
> >> It's certainly one of the safer functions to call with AC set, but it
> >> sounds wrong anyway. It's not like it's likely to leak kernel data
> >> (most memset's are with 0, and even the non-zero ones I can't imagine
> >> are sensitive - more like poison values etc).
> >>
> >> What's the call site that made you go "just add __memset() to the list"?
> > 
> > __asan_{,un}poinson_stack_memory()
> 
> These two can be called only with CONFIG_KASAN_EXTRA=y which 
> was removed very recently, so it should be safe to delete these functions.

Ooh shiny. Clearly my tree still has them; what commit do I need to look
for?

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 18/20] objtool: Add UACCESS validation
  2019-03-07 20:33         ` Peter Zijlstra
@ 2019-03-07 20:40           ` Andrey Ryabinin
  2019-03-07 20:42           ` Peter Zijlstra
  1 sibling, 0 replies; 100+ messages in thread
From: Andrey Ryabinin @ 2019-03-07 20:40 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: Linus Torvalds, Thomas Gleixner, Peter Anvin, Julien Thierry,
	Will Deacon, Andy Lutomirski, Ingo Molnar, Catalin Marinas,
	James Morse, valentin.schneider, Brian Gerst, Josh Poimboeuf,
	Andrew Lutomirski, Borislav Petkov, Denys Vlasenko,
	Linux List Kernel Mailing, Dmitry Vyukov, Steven Rostedt



On 3/7/19 11:33 PM, Peter Zijlstra wrote:
> On Thu, Mar 07, 2019 at 11:15:42PM +0300, Andrey Ryabinin wrote:
>>
>>
>> On 3/7/19 8:41 PM, Peter Zijlstra wrote:
>>> On Thu, Mar 07, 2019 at 08:33:26AM -0800, Linus Torvalds wrote:
>>>> On Thu, Mar 7, 2019 at 3:52 AM Peter Zijlstra <peterz@infradead.org> wrote:
>>>>>
>>>>> XXX: are we sure we want __memset marked AC-safe?
>>>>
>>>> It's certainly one of the safer functions to call with AC set, but it
>>>> sounds wrong anyway. It's not like it's likely to leak kernel data
>>>> (most memset's are with 0, and even the non-zero ones I can't imagine
>>>> are sensitive - more like poison values etc).
>>>>
>>>> What's the call site that made you go "just add __memset() to the list"?
>>>
>>> __asan_{,un}poinson_stack_memory()
>>
>> These two can be called only with CONFIG_KASAN_EXTRA=y which 
>> was removed very recently, so it should be safe to delete these functions.
> 
> Ooh shiny. Clearly my tree still has them; what commit do I need to look
> for?
> 


commit 7771bdbbfd3d6f204631b6fd9e1bbc30cd15918e

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 18/20] objtool: Add UACCESS validation
  2019-03-07 20:23           ` Peter Zijlstra
@ 2019-03-07 20:40             ` Peter Zijlstra
  2019-03-08 15:07               ` Josh Poimboeuf
  0 siblings, 1 reply; 100+ messages in thread
From: Peter Zijlstra @ 2019-03-07 20:40 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: Thomas Gleixner, Peter Anvin, Julien Thierry, Will Deacon,
	Andy Lutomirski, Ingo Molnar, Catalin Marinas, James Morse,
	valentin.schneider, Brian Gerst, Josh Poimboeuf,
	Andrew Lutomirski, Borislav Petkov, Denys Vlasenko,
	Linux List Kernel Mailing, Dmitry Vyukov, Steven Rostedt

On Thu, Mar 07, 2019 at 09:23:19PM +0100, Peter Zijlstra wrote:
> On Thu, Mar 07, 2019 at 07:48:13PM +0100, Peter Zijlstra wrote:
> > Another thing I need to look at is why objtool only found memset_orig
> > (from __memset) but not memset_erms, which if I read the code right, is
> > a possible alternative there.
> 
> Turns out we only look for sibling calls in the original instruction
> stream, not in any alternatives; which in general seems like a fair
> enough assumption.

And while I'm looking at memset_64.S, why are memset_erms and
memset_orig global functions? At the very least they should be local,
and ideally not even functions.

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 18/20] objtool: Add UACCESS validation
  2019-03-07 20:33         ` Peter Zijlstra
  2019-03-07 20:40           ` Andrey Ryabinin
@ 2019-03-07 20:42           ` Peter Zijlstra
  1 sibling, 0 replies; 100+ messages in thread
From: Peter Zijlstra @ 2019-03-07 20:42 UTC (permalink / raw)
  To: Andrey Ryabinin
  Cc: Linus Torvalds, Thomas Gleixner, Peter Anvin, Julien Thierry,
	Will Deacon, Andy Lutomirski, Ingo Molnar, Catalin Marinas,
	James Morse, valentin.schneider, Brian Gerst, Josh Poimboeuf,
	Andrew Lutomirski, Borislav Petkov, Denys Vlasenko,
	Linux List Kernel Mailing, Dmitry Vyukov, Steven Rostedt

On Thu, Mar 07, 2019 at 09:33:18PM +0100, Peter Zijlstra wrote:

> Ooh shiny. Clearly my tree still has them; what commit do I need to look
> for?

30be39d1e1dc ("kasan: remove use after scope bugs detection.")

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 18/20] objtool: Add UACCESS validation
  2019-03-07 19:03           ` Peter Zijlstra
@ 2019-03-08 15:01             ` Josh Poimboeuf
  2019-03-08 15:07               ` Peter Zijlstra
  0 siblings, 1 reply; 100+ messages in thread
From: Josh Poimboeuf @ 2019-03-08 15:01 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: Linus Torvalds, Thomas Gleixner, Peter Anvin, Julien Thierry,
	Will Deacon, Andy Lutomirski, Ingo Molnar, Catalin Marinas,
	James Morse, valentin.schneider, Brian Gerst, Andrew Lutomirski,
	Borislav Petkov, Denys Vlasenko, Linux List Kernel Mailing,
	Dmitry Vyukov, Steven Rostedt

On Thu, Mar 07, 2019 at 08:03:13PM +0100, Peter Zijlstra wrote:
> On Thu, Mar 07, 2019 at 07:48:13PM +0100, Peter Zijlstra wrote:
> > On Thu, Mar 07, 2019 at 09:54:14AM -0800, Linus Torvalds wrote:
> > > On Thu, Mar 7, 2019 at 9:41 AM Peter Zijlstra <peterz@infradead.org> wrote:
> > > > >
> > > > > What's the call site that made you go "just add __memset() to the list"?
> > > >
> > > > __asan_{,un}poinson_stack_memory()
> > > >   kasan_{,un}poison_shadow()
> > > >     __memset()
> > > 
> > > Ugh. I think I almost just agree with your decision to just let that
> > > memset go unchecked.
> > > 
> > > I'm not saying it's right, but it doesn't seem to be a fight worth fighting.
> > 
> > One think I could do; is add a filter to each function and only allow
> > __memset from the kasan code, and not from anywhere else.
> 
> Ah.. how about I feed objtool a text file with all these symbol names;
> and I have Makefile compose file that from fragments.
> 
> Then only KASAN builds will have memset whitelisted, and any other build
> will still flag memset abuse.
> 
> Now I only have to figure out how to make Makefile do something like
> that :-)

Instead of adding all those additional moving parts, I would much rather
either:

a) have kasan call a special whitelisted version of memset (like hpa
   suggested); or

b) just don't use the objtool --uaccess flag for KASAN builds.

-- 
Josh

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 18/20] objtool: Add UACCESS validation
  2019-03-07 20:40             ` Peter Zijlstra
@ 2019-03-08 15:07               ` Josh Poimboeuf
  2019-03-08 15:23                 ` Peter Zijlstra
  0 siblings, 1 reply; 100+ messages in thread
From: Josh Poimboeuf @ 2019-03-08 15:07 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: Linus Torvalds, Thomas Gleixner, Peter Anvin, Julien Thierry,
	Will Deacon, Andy Lutomirski, Ingo Molnar, Catalin Marinas,
	James Morse, valentin.schneider, Brian Gerst, Andrew Lutomirski,
	Borislav Petkov, Denys Vlasenko, Linux List Kernel Mailing,
	Dmitry Vyukov, Steven Rostedt

On Thu, Mar 07, 2019 at 09:40:21PM +0100, Peter Zijlstra wrote:
> On Thu, Mar 07, 2019 at 09:23:19PM +0100, Peter Zijlstra wrote:
> > On Thu, Mar 07, 2019 at 07:48:13PM +0100, Peter Zijlstra wrote:
> > > Another thing I need to look at is why objtool only found memset_orig
> > > (from __memset) but not memset_erms, which if I read the code right, is
> > > a possible alternative there.
> > 
> > Turns out we only look for sibling calls in the original instruction
> > stream, not in any alternatives; which in general seems like a fair
> > enough assumption.
> 
> And while I'm looking at memset_64.S, why are memset_erms and
> memset_orig global functions? At the very least they should be local,
> and ideally not even functions.

I think the only benefit is that they would show up better on stack
traces, but that could also be solved by just making them local labels
inside memset.  Which is what I think they should be.

The general rule is that ENDPROC is only used for callable functions, so
yeah, I think the current setup isn't ideal, and also prevents objtool
from properly doing the AC analysis as you pointed out earlier.

-- 
Josh

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 18/20] objtool: Add UACCESS validation
  2019-03-08 15:01             ` Josh Poimboeuf
@ 2019-03-08 15:07               ` Peter Zijlstra
  0 siblings, 0 replies; 100+ messages in thread
From: Peter Zijlstra @ 2019-03-08 15:07 UTC (permalink / raw)
  To: Josh Poimboeuf
  Cc: Linus Torvalds, Thomas Gleixner, Peter Anvin, Julien Thierry,
	Will Deacon, Andy Lutomirski, Ingo Molnar, Catalin Marinas,
	James Morse, valentin.schneider, Brian Gerst, Andrew Lutomirski,
	Borislav Petkov, Denys Vlasenko, Linux List Kernel Mailing,
	Dmitry Vyukov, Steven Rostedt

On Fri, Mar 08, 2019 at 09:01:11AM -0600, Josh Poimboeuf wrote:
> On Thu, Mar 07, 2019 at 08:03:13PM +0100, Peter Zijlstra wrote:

> > Ah.. how about I feed objtool a text file with all these symbol names;
> > and I have Makefile compose file that from fragments.
> > 
> > Then only KASAN builds will have memset whitelisted, and any other build
> > will still flag memset abuse.
> > 
> > Now I only have to figure out how to make Makefile do something like
> > that :-)
> 
> Instead of adding all those additional moving parts, I would much rather
> either:

The problem went away. That is, the problematic part of KASAN just got
removed in this merge window.

Also; I just about had hpa's __memset_kasan implemented when I got that
email.

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 18/20] objtool: Add UACCESS validation
  2019-03-08 15:07               ` Josh Poimboeuf
@ 2019-03-08 15:23                 ` Peter Zijlstra
  0 siblings, 0 replies; 100+ messages in thread
From: Peter Zijlstra @ 2019-03-08 15:23 UTC (permalink / raw)
  To: Josh Poimboeuf
  Cc: Linus Torvalds, Thomas Gleixner, Peter Anvin, Julien Thierry,
	Will Deacon, Andy Lutomirski, Ingo Molnar, Catalin Marinas,
	James Morse, valentin.schneider, Brian Gerst, Andrew Lutomirski,
	Borislav Petkov, Denys Vlasenko, Linux List Kernel Mailing,
	Dmitry Vyukov, Steven Rostedt

On Fri, Mar 08, 2019 at 09:07:03AM -0600, Josh Poimboeuf wrote:
> On Thu, Mar 07, 2019 at 09:40:21PM +0100, Peter Zijlstra wrote:
> > On Thu, Mar 07, 2019 at 09:23:19PM +0100, Peter Zijlstra wrote:
> > > On Thu, Mar 07, 2019 at 07:48:13PM +0100, Peter Zijlstra wrote:
> > > > Another thing I need to look at is why objtool only found memset_orig
> > > > (from __memset) but not memset_erms, which if I read the code right, is
> > > > a possible alternative there.
> > > 
> > > Turns out we only look for sibling calls in the original instruction
> > > stream, not in any alternatives; which in general seems like a fair
> > > enough assumption.
> > 
> > And while I'm looking at memset_64.S, why are memset_erms and
> > memset_orig global functions? At the very least they should be local,
> > and ideally not even functions.
> 
> I think the only benefit is that they would show up better on stack
> traces, but that could also be solved by just making them local labels
> inside memset.  Which is what I think they should be.

Boris wanted to use alternative_call_2, just like copy_user_generic().
Which makes more sense to me still.

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 03/20] x86/uaccess: Move copy_user_handle_tail into asm
  2019-03-07 11:45 ` [PATCH 03/20] x86/uaccess: Move copy_user_handle_tail into asm Peter Zijlstra
@ 2019-03-08 18:53   ` Josh Poimboeuf
  2019-03-08 19:48     ` Peter Zijlstra
  0 siblings, 1 reply; 100+ messages in thread
From: Josh Poimboeuf @ 2019-03-08 18:53 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: torvalds, tglx, hpa, julien.thierry, will.deacon, luto, mingo,
	catalin.marinas, james.morse, valentin.schneider, brgerst, luto,
	bp, dvlasenk, linux-kernel, dvyukov, rostedt

On Thu, Mar 07, 2019 at 12:45:14PM +0100, Peter Zijlstra wrote:
>  /*
> + * Try to copy last bytes and clear the rest if needed.
> + * Since protection fault in copy_from/to_user is not a normal situation,
> + * it is not necessary to optimize tail handling.
> + *
> + * Input:
> + * rdi destination
> + * rsi source
> + * rdx count
> + *
> + * Output:
> + * eax uncopied bytes or 0 if successful.
> + */
> +ALIGN;
> +copy_user_handle_tail:
> +	movl %edx,%ecx
> +1:	rep movsb
> +2:	mov %ecx,%eax
> +	ASM_CLAC
> +	ret
> +
> +	_ASM_EXTABLE_UA(1b, 2b)
> +ENDPROC(copy_user_handle_tail)

This is an unstructured piece of code rather than a callable function,
END would probably be more appropriate.  Or maybe it should just be a
local label (.Lcopy_user_handle_tail) because I don't think the
alignment and ELF symbol size are even needed.

-- 
Josh

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 05/20] x86/uaccess/xen: Suppress SMAP warnings
  2019-03-07 11:45 ` [PATCH 05/20] x86/uaccess/xen: Suppress SMAP warnings Peter Zijlstra
  2019-03-07 12:22   ` Juergen Gross
@ 2019-03-08 19:00   ` Josh Poimboeuf
  2019-03-08 19:03     ` Josh Poimboeuf
  2019-03-08 19:50     ` Peter Zijlstra
  1 sibling, 2 replies; 100+ messages in thread
From: Josh Poimboeuf @ 2019-03-08 19:00 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: torvalds, tglx, hpa, julien.thierry, will.deacon, luto, mingo,
	catalin.marinas, james.morse, valentin.schneider, brgerst, luto,
	bp, dvlasenk, linux-kernel, dvyukov, rostedt, andrew.cooper3

On Thu, Mar 07, 2019 at 12:45:16PM +0100, Peter Zijlstra wrote:
> drivers/xen/privcmd.o: warning: objtool: privcmd_ioctl()+0x1414: call to hypercall_page() with UACCESS enabled
> 
> Xen needs to do HV calls with AC=1 for hysterical raisins. Make the
> warning go away.
> 
> XXX: arguably we should rename ANNOTATE_NOSPEC_ALTERNATIVE to
>      ANNOTATE_IGNORE_ALTERNATIVE.
> 
> Cc: andrew.cooper3@citrix.com
> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
> ---
>  arch/x86/include/asm/xen/hypercall.h |   26 ++++++++++++++++++++++----
>  1 file changed, 22 insertions(+), 4 deletions(-)
> 
> --- a/arch/x86/include/asm/xen/hypercall.h
> +++ b/arch/x86/include/asm/xen/hypercall.h
> @@ -214,6 +214,24 @@ xen_single_call(unsigned int call,
>  	return (long)__res;
>  }
>  
> +static __always_inline void __xen_stac(void)
> +{
> +	/*
> +	 * This is just about as horrible as this interface; we abuse the
> +	 * nospec alternative annotation to supress objtool seeing the
> +	 * STAC/CLAC and getting confused about it calling random code with
> +	 * AC=1.
> +	 */
> +	asm volatile(ANNOTATE_NOSPEC_ALTERNATIVE
> +		     ASM_STAC ::: "memory", "flags");
> +}
> +
> +static __always_inline void __xen_clac(void)
> +{
> +	asm volatile(ANNOTATE_NOSPEC_ALTERNATIVE
> +		     ASM_CLAC ::: "memory", "flags");
> +}
> +

Shouldn't these be using SMAP-based alternatives like stac()/clac() do?

-- 
Josh

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 05/20] x86/uaccess/xen: Suppress SMAP warnings
  2019-03-08 19:00   ` Josh Poimboeuf
@ 2019-03-08 19:03     ` Josh Poimboeuf
  2019-03-10 13:19       ` Peter Zijlstra
  2019-03-08 19:50     ` Peter Zijlstra
  1 sibling, 1 reply; 100+ messages in thread
From: Josh Poimboeuf @ 2019-03-08 19:03 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: torvalds, tglx, hpa, julien.thierry, will.deacon, luto, mingo,
	catalin.marinas, james.morse, valentin.schneider, brgerst, luto,
	bp, dvlasenk, linux-kernel, dvyukov, rostedt, andrew.cooper3

On Fri, Mar 08, 2019 at 01:00:38PM -0600, Josh Poimboeuf wrote:
> On Thu, Mar 07, 2019 at 12:45:16PM +0100, Peter Zijlstra wrote:
> > drivers/xen/privcmd.o: warning: objtool: privcmd_ioctl()+0x1414: call to hypercall_page() with UACCESS enabled
> > 
> > Xen needs to do HV calls with AC=1 for hysterical raisins. Make the
> > warning go away.
> > 
> > XXX: arguably we should rename ANNOTATE_NOSPEC_ALTERNATIVE to
> >      ANNOTATE_IGNORE_ALTERNATIVE.
> > 
> > Cc: andrew.cooper3@citrix.com
> > Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
> > ---
> >  arch/x86/include/asm/xen/hypercall.h |   26 ++++++++++++++++++++++----
> >  1 file changed, 22 insertions(+), 4 deletions(-)
> > 
> > --- a/arch/x86/include/asm/xen/hypercall.h
> > +++ b/arch/x86/include/asm/xen/hypercall.h
> > @@ -214,6 +214,24 @@ xen_single_call(unsigned int call,
> >  	return (long)__res;
> >  }
> >  
> > +static __always_inline void __xen_stac(void)
> > +{
> > +	/*
> > +	 * This is just about as horrible as this interface; we abuse the
> > +	 * nospec alternative annotation to supress objtool seeing the
> > +	 * STAC/CLAC and getting confused about it calling random code with
> > +	 * AC=1.
> > +	 */
> > +	asm volatile(ANNOTATE_NOSPEC_ALTERNATIVE
> > +		     ASM_STAC ::: "memory", "flags");
> > +}
> > +
> > +static __always_inline void __xen_clac(void)
> > +{
> > +	asm volatile(ANNOTATE_NOSPEC_ALTERNATIVE
> > +		     ASM_CLAC ::: "memory", "flags");
> > +}
> > +
> 
> Shouldn't these be using SMAP-based alternatives like stac()/clac() do?

Also this you could get rid of the comment if there were an
ANNOTATE_AC_SAFE macro which does a similar thing.

-- 
Josh

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 12/20] objtool: Set insn->func for alternatives
  2019-03-07 11:45 ` [PATCH 12/20] objtool: Set insn->func for alternatives Peter Zijlstra
@ 2019-03-08 19:16   ` Josh Poimboeuf
  2019-03-08 19:51     ` Peter Zijlstra
  0 siblings, 1 reply; 100+ messages in thread
From: Josh Poimboeuf @ 2019-03-08 19:16 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: torvalds, tglx, hpa, julien.thierry, will.deacon, luto, mingo,
	catalin.marinas, james.morse, valentin.schneider, brgerst, luto,
	bp, dvlasenk, linux-kernel, dvyukov, rostedt

On Thu, Mar 07, 2019 at 12:45:23PM +0100, Peter Zijlstra wrote:
> Make sure we set the function association for alternative instruction
> sequences; they are after all still part of the function.

Can you also say _why_?  I presume it's so the warning messages will be
saner.

> 
> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
> ---
>  tools/objtool/check.c |    1 +
>  1 file changed, 1 insertion(+)
> 
> --- a/tools/objtool/check.c
> +++ b/tools/objtool/check.c
> @@ -695,6 +695,7 @@ static int handle_group_alt(struct objto
>  		last_new_insn = insn;
>  
>  		insn->ignore = orig_insn->ignore_alts;
> +		insn->func = orig_insn->func;
>  
>  		if (insn->type != INSN_JUMP_CONDITIONAL &&
>  		    insn->type != INSN_JUMP_UNCONDITIONAL)
> 
> 

-- 
Josh

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 13/20] objtool: Hande function aliases
  2019-03-07 11:45 ` [PATCH 13/20] objtool: Hande function aliases Peter Zijlstra
@ 2019-03-08 19:23   ` Josh Poimboeuf
  2019-03-08 19:52     ` Peter Zijlstra
  0 siblings, 1 reply; 100+ messages in thread
From: Josh Poimboeuf @ 2019-03-08 19:23 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: torvalds, tglx, hpa, julien.thierry, will.deacon, luto, mingo,
	catalin.marinas, james.morse, valentin.schneider, brgerst, luto,
	bp, dvlasenk, linux-kernel, dvyukov, rostedt


On Thu, Mar 07, 2019 at 12:45:24PM +0100, Peter Zijlstra wrote:
> Function aliases result in different symbols for the same set of
> instructions; track a canonical symbol so there is a unique point of
> access.
> 
> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>

s/Hande/Handle/ in $SUBJECT

Also you can clarify why we need to track aliases?

-- 
Josh

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 14/20] objtool: Rewrite add_ignores()
  2019-03-07 11:45 ` [PATCH 14/20] objtool: Rewrite add_ignores() Peter Zijlstra
@ 2019-03-08 19:29   ` Josh Poimboeuf
  0 siblings, 0 replies; 100+ messages in thread
From: Josh Poimboeuf @ 2019-03-08 19:29 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: torvalds, tglx, hpa, julien.thierry, will.deacon, luto, mingo,
	catalin.marinas, james.morse, valentin.schneider, brgerst, luto,
	bp, dvlasenk, linux-kernel, dvyukov, rostedt

On Thu, Mar 07, 2019 at 12:45:25PM +0100, Peter Zijlstra wrote:
> @@ -436,18 +413,31 @@ static void add_ignores(struct objtool_f
>  	struct instruction *insn;
>  	struct section *sec;
>  	struct symbol *func;
> +	struct rela *rela;
>  
> -	for_each_sec(file, sec) {
> -		list_for_each_entry(func, &sec->symbol_list, list) {
> -			if (func->type != STT_FUNC)
> -				continue;
> +	sec = find_section_by_name(file->elf, ".rela.discard.func_stack_frame_non_standard");
> +	if (!sec)
> +		return;
>  
> -			if (!ignore_func(file, func))
> +	list_for_each_entry(rela, &sec->rela_list, list) {
> +		switch (rela->sym->type) {
> +		case STT_FUNC:
> +			func = rela->sym;
> +			break;
> +
> +		case STT_SECTION:
> +			func = find_symbol_by_offset(rela->sym->sec, rela->addend);
> +			if (!func || func->type != STT_FUNC)
>  				continue;
> +			break;
>  
> -			func_for_each_insn_all(file, func, insn)
> -				insn->ignore = true;
> +		default:
> +			WARN("unexpected relation symbol type in %s: %d", sec->name, rela->sym->type);
> +			continue;

s/relation/relocation

-- 
Josh

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 15/20] objtool: Add --backtrace support
  2019-03-07 11:45 ` [PATCH 15/20] objtool: Add --backtrace support Peter Zijlstra
@ 2019-03-08 19:33   ` Josh Poimboeuf
  0 siblings, 0 replies; 100+ messages in thread
From: Josh Poimboeuf @ 2019-03-08 19:33 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: torvalds, tglx, hpa, julien.thierry, will.deacon, luto, mingo,
	catalin.marinas, james.morse, valentin.schneider, brgerst, luto,
	bp, dvlasenk, linux-kernel, dvyukov, rostedt

On Thu, Mar 07, 2019 at 12:45:26PM +0100, Peter Zijlstra wrote:
> For when you want to know the path that reached your fail state.
> 
> $ ./objtool check --no-fp --backtrace arch/x86/lib/usercopy_64.o
> arch/x86/lib/usercopy_64.o: warning: objtool: .altinstr_replacement+0x3: UACCESS disable without MEMOPs: __clear_user()
> arch/x86/lib/usercopy_64.o: warning: objtool:   __clear_user()+0x3a: (alt)
> arch/x86/lib/usercopy_64.o: warning: objtool:   __clear_user()+0x2e: (branch)
> arch/x86/lib/usercopy_64.o: warning: objtool:   __clear_user()+0x18: (branch)
> arch/x86/lib/usercopy_64.o: warning: objtool:   .altinstr_replacement+0xffffffffffffffff: (branch)
> arch/x86/lib/usercopy_64.o: warning: objtool:   __clear_user()+0x5: (alt)
> arch/x86/lib/usercopy_64.o: warning: objtool:   __clear_user()+0x0: <=== (func)

We should have done this a long time ago.  Thank you for this!

-- 
Josh

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 03/20] x86/uaccess: Move copy_user_handle_tail into asm
  2019-03-08 18:53   ` Josh Poimboeuf
@ 2019-03-08 19:48     ` Peter Zijlstra
  2019-03-08 19:53       ` Josh Poimboeuf
  0 siblings, 1 reply; 100+ messages in thread
From: Peter Zijlstra @ 2019-03-08 19:48 UTC (permalink / raw)
  To: Josh Poimboeuf
  Cc: torvalds, tglx, hpa, julien.thierry, will.deacon, luto, mingo,
	catalin.marinas, james.morse, valentin.schneider, brgerst, luto,
	bp, dvlasenk, linux-kernel, dvyukov, rostedt

On Fri, Mar 08, 2019 at 12:53:21PM -0600, Josh Poimboeuf wrote:
> On Thu, Mar 07, 2019 at 12:45:14PM +0100, Peter Zijlstra wrote:
> >  /*
> > + * Try to copy last bytes and clear the rest if needed.
> > + * Since protection fault in copy_from/to_user is not a normal situation,
> > + * it is not necessary to optimize tail handling.
> > + *
> > + * Input:
> > + * rdi destination
> > + * rsi source
> > + * rdx count
> > + *
> > + * Output:
> > + * eax uncopied bytes or 0 if successful.
> > + */
> > +ALIGN;
> > +copy_user_handle_tail:
> > +	movl %edx,%ecx
> > +1:	rep movsb
> > +2:	mov %ecx,%eax
> > +	ASM_CLAC
> > +	ret
> > +
> > +	_ASM_EXTABLE_UA(1b, 2b)
> > +ENDPROC(copy_user_handle_tail)
> 
> This is an unstructured piece of code rather than a callable function,
> END would probably be more appropriate.  Or maybe it should just be a
> local label (.Lcopy_user_handle_tail) because I don't think the
> alignment and ELF symbol size are even needed.

ENDPROC makes it STT_FUNC and gets us stricter AC tests.

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 05/20] x86/uaccess/xen: Suppress SMAP warnings
  2019-03-08 19:00   ` Josh Poimboeuf
  2019-03-08 19:03     ` Josh Poimboeuf
@ 2019-03-08 19:50     ` Peter Zijlstra
  1 sibling, 0 replies; 100+ messages in thread
From: Peter Zijlstra @ 2019-03-08 19:50 UTC (permalink / raw)
  To: Josh Poimboeuf
  Cc: torvalds, tglx, hpa, julien.thierry, will.deacon, luto, mingo,
	catalin.marinas, james.morse, valentin.schneider, brgerst, luto,
	bp, dvlasenk, linux-kernel, dvyukov, rostedt, andrew.cooper3

On Fri, Mar 08, 2019 at 01:00:38PM -0600, Josh Poimboeuf wrote:
> On Thu, Mar 07, 2019 at 12:45:16PM +0100, Peter Zijlstra wrote:
> > drivers/xen/privcmd.o: warning: objtool: privcmd_ioctl()+0x1414: call to hypercall_page() with UACCESS enabled
> > 
> > Xen needs to do HV calls with AC=1 for hysterical raisins. Make the
> > warning go away.
> > 
> > XXX: arguably we should rename ANNOTATE_NOSPEC_ALTERNATIVE to
> >      ANNOTATE_IGNORE_ALTERNATIVE.
> > 
> > Cc: andrew.cooper3@citrix.com
> > Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
> > ---
> >  arch/x86/include/asm/xen/hypercall.h |   26 ++++++++++++++++++++++----
> >  1 file changed, 22 insertions(+), 4 deletions(-)
> > 
> > --- a/arch/x86/include/asm/xen/hypercall.h
> > +++ b/arch/x86/include/asm/xen/hypercall.h
> > @@ -214,6 +214,24 @@ xen_single_call(unsigned int call,
> >  	return (long)__res;
> >  }
> >  
> > +static __always_inline void __xen_stac(void)
> > +{
> > +	/*
> > +	 * This is just about as horrible as this interface; we abuse the
> > +	 * nospec alternative annotation to supress objtool seeing the
> > +	 * STAC/CLAC and getting confused about it calling random code with
> > +	 * AC=1.
> > +	 */
> > +	asm volatile(ANNOTATE_NOSPEC_ALTERNATIVE
> > +		     ASM_STAC ::: "memory", "flags");
> > +}
> > +
> > +static __always_inline void __xen_clac(void)
> > +{
> > +	asm volatile(ANNOTATE_NOSPEC_ALTERNATIVE
> > +		     ASM_CLAC ::: "memory", "flags");
> > +}
> > +
> 
> Shouldn't these be using SMAP-based alternatives like stac()/clac() do?

They are, __ASM_{ST,CL}AC are the raw instructions ASM_{ST,CL}AC are the
alternatives.

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 12/20] objtool: Set insn->func for alternatives
  2019-03-08 19:16   ` Josh Poimboeuf
@ 2019-03-08 19:51     ` Peter Zijlstra
  0 siblings, 0 replies; 100+ messages in thread
From: Peter Zijlstra @ 2019-03-08 19:51 UTC (permalink / raw)
  To: Josh Poimboeuf
  Cc: torvalds, tglx, hpa, julien.thierry, will.deacon, luto, mingo,
	catalin.marinas, james.morse, valentin.schneider, brgerst, luto,
	bp, dvlasenk, linux-kernel, dvyukov, rostedt

On Fri, Mar 08, 2019 at 01:16:29PM -0600, Josh Poimboeuf wrote:
> On Thu, Mar 07, 2019 at 12:45:23PM +0100, Peter Zijlstra wrote:
> > Make sure we set the function association for alternative instruction
> > sequences; they are after all still part of the function.
> 
> Can you also say _why_?  I presume it's so the warning messages will be
> saner.

Right; because I'll introduce function attributes later on, so it
becomes important to know what function an instruction belongs to.

I'll update the Changelog.

> > Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
> > ---
> >  tools/objtool/check.c |    1 +
> >  1 file changed, 1 insertion(+)
> > 
> > --- a/tools/objtool/check.c
> > +++ b/tools/objtool/check.c
> > @@ -695,6 +695,7 @@ static int handle_group_alt(struct objto
> >  		last_new_insn = insn;
> >  
> >  		insn->ignore = orig_insn->ignore_alts;
> > +		insn->func = orig_insn->func;
> >  
> >  		if (insn->type != INSN_JUMP_CONDITIONAL &&
> >  		    insn->type != INSN_JUMP_UNCONDITIONAL)
> > 
> > 
> 
> -- 
> Josh

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 13/20] objtool: Hande function aliases
  2019-03-08 19:23   ` Josh Poimboeuf
@ 2019-03-08 19:52     ` Peter Zijlstra
  2019-03-08 20:00       ` Josh Poimboeuf
  0 siblings, 1 reply; 100+ messages in thread
From: Peter Zijlstra @ 2019-03-08 19:52 UTC (permalink / raw)
  To: Josh Poimboeuf
  Cc: torvalds, tglx, hpa, julien.thierry, will.deacon, luto, mingo,
	catalin.marinas, james.morse, valentin.schneider, brgerst, luto,
	bp, dvlasenk, linux-kernel, dvyukov, rostedt

On Fri, Mar 08, 2019 at 01:23:58PM -0600, Josh Poimboeuf wrote:
> 
> On Thu, Mar 07, 2019 at 12:45:24PM +0100, Peter Zijlstra wrote:
> > Function aliases result in different symbols for the same set of
> > instructions; track a canonical symbol so there is a unique point of
> > access.
> > 
> > Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
> 
> s/Hande/Handle/ in $SUBJECT

Whoops :-)

> Also you can clarify why we need to track aliases?

Function attributes (as per that previous patch) and: git grep "alias"
mm/kasan.

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 03/20] x86/uaccess: Move copy_user_handle_tail into asm
  2019-03-08 19:48     ` Peter Zijlstra
@ 2019-03-08 19:53       ` Josh Poimboeuf
  2019-03-10 13:22         ` Peter Zijlstra
  0 siblings, 1 reply; 100+ messages in thread
From: Josh Poimboeuf @ 2019-03-08 19:53 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: torvalds, tglx, hpa, julien.thierry, will.deacon, luto, mingo,
	catalin.marinas, james.morse, valentin.schneider, brgerst, luto,
	bp, dvlasenk, linux-kernel, dvyukov, rostedt

On Fri, Mar 08, 2019 at 08:48:35PM +0100, Peter Zijlstra wrote:
> On Fri, Mar 08, 2019 at 12:53:21PM -0600, Josh Poimboeuf wrote:
> > On Thu, Mar 07, 2019 at 12:45:14PM +0100, Peter Zijlstra wrote:
> > >  /*
> > > + * Try to copy last bytes and clear the rest if needed.
> > > + * Since protection fault in copy_from/to_user is not a normal situation,
> > > + * it is not necessary to optimize tail handling.
> > > + *
> > > + * Input:
> > > + * rdi destination
> > > + * rsi source
> > > + * rdx count
> > > + *
> > > + * Output:
> > > + * eax uncopied bytes or 0 if successful.
> > > + */
> > > +ALIGN;
> > > +copy_user_handle_tail:
> > > +	movl %edx,%ecx
> > > +1:	rep movsb
> > > +2:	mov %ecx,%eax
> > > +	ASM_CLAC
> > > +	ret
> > > +
> > > +	_ASM_EXTABLE_UA(1b, 2b)
> > > +ENDPROC(copy_user_handle_tail)
> > 
> > This is an unstructured piece of code rather than a callable function,
> > END would probably be more appropriate.  Or maybe it should just be a
> > local label (.Lcopy_user_handle_tail) because I don't think the
> > alignment and ELF symbol size are even needed.
> 
> ENDPROC makes it STT_FUNC and gets us stricter AC tests.

How so?  I would have thought the opposite.  Doesn't objtool only follow
a jump if its destination is to a non-function?  Otherwise it's
considered a sibling call.

-- 
Josh

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 13/20] objtool: Hande function aliases
  2019-03-08 19:52     ` Peter Zijlstra
@ 2019-03-08 20:00       ` Josh Poimboeuf
  0 siblings, 0 replies; 100+ messages in thread
From: Josh Poimboeuf @ 2019-03-08 20:00 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: torvalds, tglx, hpa, julien.thierry, will.deacon, luto, mingo,
	catalin.marinas, james.morse, valentin.schneider, brgerst, luto,
	bp, dvlasenk, linux-kernel, dvyukov, rostedt

On Fri, Mar 08, 2019 at 08:52:54PM +0100, Peter Zijlstra wrote:
> On Fri, Mar 08, 2019 at 01:23:58PM -0600, Josh Poimboeuf wrote:
> > 
> > On Thu, Mar 07, 2019 at 12:45:24PM +0100, Peter Zijlstra wrote:
> > > Function aliases result in different symbols for the same set of
> > > instructions; track a canonical symbol so there is a unique point of
> > > access.
> > > 
> > > Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
> > 
> > s/Hande/Handle/ in $SUBJECT
> 
> Whoops :-)
> 
> > Also you can clarify why we need to track aliases?
> 
> Function attributes (as per that previous patch) and: git grep "alias"
> mm/kasan.

Ok, such details would be good in the patch description.

-- 
Josh

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 16/20] objtool: Rewrite alt->skip_orig
  2019-03-07 11:45 ` [PATCH 16/20] objtool: Rewrite alt->skip_orig Peter Zijlstra
@ 2019-03-08 20:15   ` Josh Poimboeuf
  2019-03-08 21:34     ` Peter Zijlstra
  0 siblings, 1 reply; 100+ messages in thread
From: Josh Poimboeuf @ 2019-03-08 20:15 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: torvalds, tglx, hpa, julien.thierry, will.deacon, luto, mingo,
	catalin.marinas, james.morse, valentin.schneider, brgerst, luto,
	bp, dvlasenk, linux-kernel, dvyukov, rostedt

On Thu, Mar 07, 2019 at 12:45:27PM +0100, Peter Zijlstra wrote:
> Really skip the original instruction flow, instead of letting it
> continue with NOPs.
> 
> Since the alternative code flow already continues after the original
> instructions, only the alt-original is skipped.

I like this approach.  I wonder if we can do something similar to get
rid of the nasty fake jumps.

-- 
Josh

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 17/20] objtool: Fix sibling call detection
  2019-03-07 11:45 ` [PATCH 17/20] objtool: Fix sibling call detection Peter Zijlstra
@ 2019-03-08 20:22   ` Josh Poimboeuf
  0 siblings, 0 replies; 100+ messages in thread
From: Josh Poimboeuf @ 2019-03-08 20:22 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: torvalds, tglx, hpa, julien.thierry, will.deacon, luto, mingo,
	catalin.marinas, james.morse, valentin.schneider, brgerst, luto,
	bp, dvlasenk, linux-kernel, dvyukov, rostedt

On Thu, Mar 07, 2019 at 12:45:28PM +0100, Peter Zijlstra wrote:
> It turned out that we failed to detect some sibling calls;
> specifically those without relocation records; like:
> 
> $ ./objdump-func.sh defconfig-build/mm/kasan/generic.o __asan_loadN
> 0000 0000000000000840 <__asan_loadN>:
> 0000  840:      48 8b 0c 24             mov    (%rsp),%rcx
> 0004  844:      31 d2                   xor    %edx,%edx
> 0006  846:      e9 45 fe ff ff          jmpq   690 <check_memory_region>
> 
> So extend the cross-function jump to also consider those that are not
> between known (or newly detected) parent/child functions, as
> sibling-cals when they jump to the start of the function.
> 
> The second part of that condition is to deal with random jumps to the
> middle of other function, as can be found in
> arch/x86/lib/copy_user_64.S for example.
> 
> This then (with later patches applied) makes the above recognise the
> sibling call:
> 
> mm/kasan/generic.o: warning: objtool: __asan_loadN()+0x6: call to check_memory_region() with UACCESS enabled
> 
> Also make sure to set insn->call_dest for sibling calls so we can know
> who we're calling.

and we need to know who we're calling because...

>  		if (insn->func && insn->jump_dest->func &&
> -		    insn->func != insn->jump_dest->func &&
> -		    !strstr(insn->func->name, ".cold.") &&
> -		    strstr(insn->jump_dest->func->name, ".cold.")) {
> -			insn->func->cfunc = insn->jump_dest->func;
> -			insn->jump_dest->func->pfunc = insn->func;
> +		    insn->func != insn->jump_dest->func) {
> +
> +			/*
> +			 * For GCC 8+, create parent/child links for any cold
> +			 * subfunctions.  This is _mostly_ redundant with a
> +			 * similar initialization in read_symbols().
> +			 *
> +			 * If a function has aliases, we want the *first* such
> +			 * function in the symbol table to be the subfunction's
> +			 * parent.  In that case we overwrite the
> +			 * initialization done in read_symbols().
> +			 *
> +			 * However this code can't completely replace the
> +			 * read_symbols() code because this doesn't detect the
> +			 * case where the parent function's only reference to a
> +			 * subfunction is through a switch table.
> +			 */
> +			if (!strstr(insn->func->name, ".cold.") &&
> +			    strstr(insn->jump_dest->func->name, ".cold.")) {
> +				insn->func->cfunc = insn->jump_dest->func;
> +				insn->jump_dest->func->pfunc = insn->func;
> +
> +			} else if (insn->jump_dest->func->pfunc != insn->func->pfunc &&
> +				   insn->jump_dest->offset == insn->jump_dest->func->offset) {
> +
> +				/* sibling class */

s/class/call/

> +				insn->call_dest = insn->jump_dest->func;
> +				insn->jump_dest = NULL;
> +			}
>  		}
>  	}
>  
> @@ -1935,9 +1949,16 @@ static int validate_branch(struct objtoo
>  
>  		case INSN_JUMP_CONDITIONAL:
>  		case INSN_JUMP_UNCONDITIONAL:
> -			if (insn->jump_dest &&
> -			    (!func || !insn->jump_dest->func ||
> -			     insn->jump_dest->func->pfunc == func)) {
> +			if (func && !insn->jump_dest) {
> +do_sibling_call:
> +				if (has_modified_stack_frame(&state)) {
> +					WARN_FUNC("sibling call from callable instruction with modified stack frame",
> +							sec, insn->offset);
> +					return 1;
> +				}
> +			} else if (insn->jump_dest &&
> +				   (!func || !insn->jump_dest->func ||
> +				    insn->jump_dest->func->pfunc == func)) {
>  				ret = validate_branch(file, insn->jump_dest,
>  						      state);
>  				if (ret) {
> @@ -1945,25 +1966,17 @@ static int validate_branch(struct objtoo
>  						BT_FUNC("(branch)", insn);
>  					return ret;
>  				}
> -
> -			} else if (func && has_modified_stack_frame(&state)) {
> -				WARN_FUNC("sibling call from callable instruction with modified stack frame",
> -					  sec, insn->offset);
> -				return 1;
>  			}
>  
> -			if (insn->type == INSN_JUMP_UNCONDITIONAL)
> +			if (insn->type == INSN_JUMP_UNCONDITIONAL ||
> +			    insn->type == INSN_JUMP_DYNAMIC)
>  				return 0;
>  
>  			break;
>  
>  		case INSN_JUMP_DYNAMIC:
> -			if (func && list_empty(&insn->alts) &&
> -			    has_modified_stack_frame(&state)) {
> -				WARN_FUNC("sibling call from callable instruction with modified stack frame",
> -					  sec, insn->offset);
> -				return 1;
> -			}
> +			if (func && list_empty(&insn->alts))
> +				goto do_sibling_call;

I would rather have 2-3 duplicated lines of code than complicating the
control flow like this.

-- 
Josh

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 18/20] objtool: Add UACCESS validation
  2019-03-07 11:45 ` [PATCH 18/20] objtool: Add UACCESS validation Peter Zijlstra
  2019-03-07 16:33   ` Linus Torvalds
@ 2019-03-08 21:02   ` Josh Poimboeuf
  2019-03-08 21:31     ` Peter Zijlstra
  2019-03-10 13:10     ` Peter Zijlstra
  1 sibling, 2 replies; 100+ messages in thread
From: Josh Poimboeuf @ 2019-03-08 21:02 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: torvalds, tglx, hpa, julien.thierry, will.deacon, luto, mingo,
	catalin.marinas, james.morse, valentin.schneider, brgerst, luto,
	bp, dvlasenk, linux-kernel, dvyukov, rostedt

On Thu, Mar 07, 2019 at 12:45:29PM +0100, Peter Zijlstra wrote:
> --- a/tools/objtool/arch/x86/decode.c
> +++ b/tools/objtool/arch/x86/decode.c
> @@ -369,7 +369,19 @@ int arch_decode_instruction(struct elf *
>  
>  	case 0x0f:
>  
> -		if (op2 >= 0x80 && op2 <= 0x8f) {
> +		if (op2 == 0x01) {
> +
> +			if (modrm == 0xca) {
> +
> +				*type = INSN_CLAC;
> +
> +			} else if (modrm == 0xcb) {
> +
> +				*type = INSN_STAC;
> +
> +			}

Style nit, no need for all those brackets and newlines.

> --- a/tools/objtool/check.c
> +++ b/tools/objtool/check.c
> @@ -442,6 +442,81 @@ static void add_ignores(struct objtool_f
>  	}
>  }
>  
> +static const char *uaccess_safe_builtin[] = {
> +	/* KASAN */

A short comment would be good here, something describing why a function
might be added to the list.

> +	"memset_orig", /* XXX why not memset_erms */
> +	"__memset",
> +	"kasan_poison_shadow",
> +	"kasan_unpoison_shadow",
> +	"__asan_poison_stack_memory",
> +	"__asan_unpoison_stack_memory",
> +	"kasan_report",
> +	"check_memory_region",
> +	/* KASAN out-of-line */
> +	"__asan_loadN_noabort",
> +	"__asan_load1_noabort",
> +	"__asan_load2_noabort",
> +	"__asan_load4_noabort",
> +	"__asan_load8_noabort",
> +	"__asan_load16_noabort",
> +	"__asan_storeN_noabort",
> +	"__asan_store1_noabort",
> +	"__asan_store2_noabort",
> +	"__asan_store4_noabort",
> +	"__asan_store8_noabort",
> +	"__asan_store16_noabort",
> +	/* KASAN in-line */
> +	"__asan_report_load_n_noabort",
> +	"__asan_report_load1_noabort",
> +	"__asan_report_load2_noabort",
> +	"__asan_report_load4_noabort",
> +	"__asan_report_load8_noabort",
> +	"__asan_report_load16_noabort",
> +	"__asan_report_store_n_noabort",
> +	"__asan_report_store1_noabort",
> +	"__asan_report_store2_noabort",
> +	"__asan_report_store4_noabort",
> +	"__asan_report_store8_noabort",
> +	"__asan_report_store16_noabort",
> +	/* KCOV */
> +	"write_comp_data",
> +	"__sanitizer_cov_trace_pc",
> +	"__sanitizer_cov_trace_const_cmp1",
> +	"__sanitizer_cov_trace_const_cmp2",
> +	"__sanitizer_cov_trace_const_cmp4",
> +	"__sanitizer_cov_trace_const_cmp8",
> +	"__sanitizer_cov_trace_cmp1",
> +	"__sanitizer_cov_trace_cmp2",
> +	"__sanitizer_cov_trace_cmp4",
> +	"__sanitizer_cov_trace_cmp8",
> +	/* UBSAN */
> +	"ubsan_type_mismatch_common",
> +	"__ubsan_handle_type_mismatch",
> +	"__ubsan_handle_type_mismatch_v1",
> +	/* misc */
> +	"csum_partial_copy_generic",
> +	"__memcpy_mcsafe",
> +	"ftrace_likely_update", /* CONFIG_TRACE_BRANCH_PROFILING */
> +	NULL
> +};
> +
> +static void add_uaccess_safe(struct objtool_file *file)
> +{
> +	struct symbol *func;
> +	const char **name;
> +
> +	if (!uaccess)
> +		return;
> +
> +	for (name = uaccess_safe_builtin; *name; name++) {
> +		func = find_symbol_by_name(file->elf, *name);
> +		if (!func)
> +			continue;

This won't work if the function name changes due to IPA optimizations.
I assume these are all global functions so maybe it's fine?

> @@ -1914,6 +2008,16 @@ static int validate_branch(struct objtoo
>  		switch (insn->type) {
>  
>  		case INSN_RETURN:
> +			if (state.uaccess && !func_uaccess_safe(func)) {
> +				WARN_FUNC("return with UACCESS enabled", sec, insn->offset);
> +				return 1;
> +			}
> +
> +			if (!state.uaccess && func_uaccess_safe(func)) {
> +				WARN_FUNC("return with UACCESS disabled from a UACCESS-safe function", sec, insn->offset);
> +				return 1;
> +			}
> +
>  			if (func && has_modified_stack_frame(&state)) {
>  				WARN_FUNC("return with modified stack frame",
>  					  sec, insn->offset);
> @@ -1929,17 +2033,32 @@ static int validate_branch(struct objtoo
>  			return 0;
>  
>  		case INSN_CALL:
> -			if (is_fentry_call(insn))
> -				break;
> +		case INSN_CALL_DYNAMIC:
> +do_call:
> +			if (state.uaccess && !func_uaccess_safe(insn->call_dest)) {
> +				WARN_FUNC("call to %s() with UACCESS enabled",
> +					  sec, insn->offset, insn_dest_name(insn));
> +				return 1;
> +			}
>  
> -			ret = dead_end_function(file, insn->call_dest);
> -			if (ret == 1)
> +			if (insn->type == INSN_JUMP_UNCONDITIONAL ||
> +			    insn->type == INSN_JUMP_DYNAMIC)
>  				return 0;
> -			if (ret == -1)
> -				return 1;
>  
> -			/* fallthrough */
> -		case INSN_CALL_DYNAMIC:
> +			if (insn->type == INSN_JUMP_CONDITIONAL)
> +				break;
> +
> +			if (insn->type == INSN_CALL) {
> +				if (is_fentry_call(insn))
> +					break;
> +
> +				ret = dead_end_function(file, insn->call_dest);
> +				if (ret == 1)
> +					return 0;
> +				if (ret == -1)
> +					return 1;
> +			}
> +
>  			if (!no_fp && func && !has_valid_stack_frame(&state)) {
>  				WARN_FUNC("call without frame pointer save/setup",
>  					  sec, insn->offset);
> @@ -1956,6 +2075,8 @@ static int validate_branch(struct objtoo
>  							sec, insn->offset);
>  					return 1;
>  				}
> +				goto do_call;
> +

These gotos make my head spin.  Again I would much prefer a small amount
of code duplication over this.

> +++ b/tools/objtool/special.c
> @@ -42,6 +42,7 @@
>  #define ALT_NEW_LEN_OFFSET	11
>  
>  #define X86_FEATURE_POPCNT (4*32+23)
> +#define X86_FEATURE_SMAP   (9*32+20)
>  
>  struct special_entry {
>  	const char *sec;
> @@ -107,8 +108,15 @@ static int get_alt_entry(struct elf *elf
>  		 * It has been requested that we don't validate the !POPCNT
>  		 * feature path which is a "very very small percentage of
>  		 * machines".
> +		 *
> +		 * Also, unconditionally enable SMAP; this avoids seeing paths
> +		 * that pass through the STAC alternative and through the CLAC
> +		 * NOPs.

Why is this a problem?

> +		 *
> +		 * XXX: We could do this for all binary NOP/single-INSN
> +		 * alternatives.

Same question here.

>  		 */
> -		if (feature == X86_FEATURE_POPCNT)
> +		if (feature == X86_FEATURE_POPCNT || feature == X86_FEATURE_SMAP)
>  			alt->skip_orig = true;
>  	}
>  
> 
> 

-- 
Josh

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 19/20] objtool: uaccess PUSHF/POPF support
  2019-03-07 11:45 ` [PATCH 19/20] objtool: uaccess PUSHF/POPF support Peter Zijlstra
@ 2019-03-08 21:11   ` Josh Poimboeuf
  2019-03-10 13:12     ` Peter Zijlstra
  0 siblings, 1 reply; 100+ messages in thread
From: Josh Poimboeuf @ 2019-03-08 21:11 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: torvalds, tglx, hpa, julien.thierry, will.deacon, luto, mingo,
	catalin.marinas, james.morse, valentin.schneider, brgerst, luto,
	bp, dvlasenk, linux-kernel, dvyukov, rostedt

On Thu, Mar 07, 2019 at 12:45:30PM +0100, Peter Zijlstra wrote:
> Add PUSHF / POPF state.uaccess restore logic.
> 
> XXX: should possibly be merged with the previous patch such that KASAN
> doesn't explode in between. Split for review.

Needs more description -- namely, what and why.

-- 
Josh

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 20/20] objtool: Add Direction Flag validation
  2019-03-07 11:45 ` [PATCH 20/20] objtool: Add Direction Flag validation Peter Zijlstra
@ 2019-03-08 21:16   ` Josh Poimboeuf
  2019-03-08 21:33     ` Peter Zijlstra
  0 siblings, 1 reply; 100+ messages in thread
From: Josh Poimboeuf @ 2019-03-08 21:16 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: torvalds, tglx, hpa, julien.thierry, will.deacon, luto, mingo,
	catalin.marinas, james.morse, valentin.schneider, brgerst, luto,
	bp, dvlasenk, linux-kernel, dvyukov, rostedt

On Thu, Mar 07, 2019 at 12:45:31PM +0100, Peter Zijlstra wrote:
> Having DF escape is BAD(tm).
> 
> Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>

Can you elaborate on why (in the patch description)?  Did this actually
find any occurrences?

-- 
Josh

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 18/20] objtool: Add UACCESS validation
  2019-03-08 21:02   ` Josh Poimboeuf
@ 2019-03-08 21:31     ` Peter Zijlstra
  2019-03-08 21:54       ` Josh Poimboeuf
  2019-03-10 13:10     ` Peter Zijlstra
  1 sibling, 1 reply; 100+ messages in thread
From: Peter Zijlstra @ 2019-03-08 21:31 UTC (permalink / raw)
  To: Josh Poimboeuf
  Cc: torvalds, tglx, hpa, julien.thierry, will.deacon, luto, mingo,
	catalin.marinas, james.morse, valentin.schneider, brgerst, luto,
	bp, dvlasenk, linux-kernel, dvyukov, rostedt

On Fri, Mar 08, 2019 at 03:02:09PM -0600, Josh Poimboeuf wrote:
> > +static const char *uaccess_safe_builtin[] = {
> > +	/* KASAN */
> 
> A short comment would be good here, something describing why a function
> might be added to the list.

There is; but I'm thinking it might be too short?

> > +	"memset_orig", /* XXX why not memset_erms */
> > +	"__memset",
> > +	"kasan_poison_shadow",
> > +	"kasan_unpoison_shadow",
> > +	"__asan_poison_stack_memory",
> > +	"__asan_unpoison_stack_memory",

Those are gone.

> > +	"kasan_report",

That is the main kasan_report function, and is for, as the comment says:
kasan :-)

> > +	"check_memory_region",

for __asan_{load,store}N

> > +	/* KASAN out-of-line */
> > +	"__asan_loadN_noabort",
> > +	"__asan_load1_noabort",
> > +	"__asan_load2_noabort",
> > +	"__asan_load4_noabort",
> > +	"__asan_load8_noabort",
> > +	"__asan_load16_noabort",
> > +	"__asan_storeN_noabort",
> > +	"__asan_store1_noabort",
> > +	"__asan_store2_noabort",
> > +	"__asan_store4_noabort",
> > +	"__asan_store8_noabort",
> > +	"__asan_store16_noabort",

These, are, again as the comment suggests, the out-of-line KASAN ABI
calls.

> > +	/* KASAN in-line */
> > +	"__asan_report_load_n_noabort",
> > +	"__asan_report_load1_noabort",
> > +	"__asan_report_load2_noabort",
> > +	"__asan_report_load4_noabort",
> > +	"__asan_report_load8_noabort",
> > +	"__asan_report_load16_noabort",
> > +	"__asan_report_store_n_noabort",
> > +	"__asan_report_store1_noabort",
> > +	"__asan_report_store2_noabort",
> > +	"__asan_report_store4_noabort",
> > +	"__asan_report_store8_noabort",
> > +	"__asan_report_store16_noabort",

The in-line KASAN ABI

Also, can I just say that {load,store}N vs {load,store}_n bugs the
hell out of me?

> > +	/* KCOV */
> > +	"write_comp_data",

the logger function

> > +	"__sanitizer_cov_trace_pc",
> > +	"__sanitizer_cov_trace_const_cmp1",
> > +	"__sanitizer_cov_trace_const_cmp2",
> > +	"__sanitizer_cov_trace_const_cmp4",
> > +	"__sanitizer_cov_trace_const_cmp8",
> > +	"__sanitizer_cov_trace_cmp1",
> > +	"__sanitizer_cov_trace_cmp2",
> > +	"__sanitizer_cov_trace_cmp4",
> > +	"__sanitizer_cov_trace_cmp8",

KCOV ABI

> > +	/* UBSAN */
> > +	"ubsan_type_mismatch_common",

implementation

> > +	"__ubsan_handle_type_mismatch",
> > +	"__ubsan_handle_type_mismatch_v1",

UBSAN ABI

> > +	/* misc */
> > +	"csum_partial_copy_generic",
> > +	"__memcpy_mcsafe",
> > +	"ftrace_likely_update", /* CONFIG_TRACE_BRANCH_PROFILING */
> > +	NULL
> > +};

> > +		func = find_symbol_by_name(file->elf, *name);
> 
> This won't work if the function name changes due to IPA optimizations.
> I assume these are all global functions so maybe it's fine?

With one or two exceptions, yep.

> These gotos make my head spin.  Again I would much prefer a small amount
> of code duplication over this.

I didn't think the code was that bad once you see the end result, but
sure, I can try something else.

> > +++ b/tools/objtool/special.c
> > @@ -42,6 +42,7 @@
> >  #define ALT_NEW_LEN_OFFSET	11
> >  
> >  #define X86_FEATURE_POPCNT (4*32+23)
> > +#define X86_FEATURE_SMAP   (9*32+20)
> >  
> >  struct special_entry {
> >  	const char *sec;
> > @@ -107,8 +108,15 @@ static int get_alt_entry(struct elf *elf
> >  		 * It has been requested that we don't validate the !POPCNT
> >  		 * feature path which is a "very very small percentage of
> >  		 * machines".
> > +		 *
> > +		 * Also, unconditionally enable SMAP; this avoids seeing paths
> > +		 * that pass through the STAC alternative and through the CLAC
> > +		 * NOPs.
> 
> Why is this a problem?

'obvious' violation?

STAC; .... RET; # an AC=1 leak

.... CLAC; # spurious CLAC

If we do the STAC we must also do the CLAC. If we don't do the STAC we
must also not do the CLAC.


> > +		 *
> > +		 * XXX: We could do this for all binary NOP/single-INSN
> > +		 * alternatives.
> 
> Same question here.

In general, validating NOPs isn't too interesting, so all NOP/INSN
binary alternatives could be forced on.

> >  		 */
> > -		if (feature == X86_FEATURE_POPCNT)
> > +		if (feature == X86_FEATURE_POPCNT || feature == X86_FEATURE_SMAP)
> >  			alt->skip_orig = true;
> >  	}

I've actually changed this to depend on --uaccess, when set we force on
FEATURE_SMAP, otherwise we force off.

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 20/20] objtool: Add Direction Flag validation
  2019-03-08 21:16   ` Josh Poimboeuf
@ 2019-03-08 21:33     ` Peter Zijlstra
  2019-03-08 21:56       ` Josh Poimboeuf
  0 siblings, 1 reply; 100+ messages in thread
From: Peter Zijlstra @ 2019-03-08 21:33 UTC (permalink / raw)
  To: Josh Poimboeuf
  Cc: torvalds, tglx, hpa, julien.thierry, will.deacon, luto, mingo,
	catalin.marinas, james.morse, valentin.schneider, brgerst, luto,
	bp, dvlasenk, linux-kernel, dvyukov, rostedt

On Fri, Mar 08, 2019 at 03:16:03PM -0600, Josh Poimboeuf wrote:
> On Thu, Mar 07, 2019 at 12:45:31PM +0100, Peter Zijlstra wrote:
> > Having DF escape is BAD(tm).
> > 
> > Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
> > Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
> 
> Can you elaborate on why (in the patch description)?  Did this actually
> find any occurrences?

Nope, didn't find anything. Also, all DF users are in asm so I didn't
really expect any. Having it escape would probably result in fairly
instant wreckage though.

DF=1 results in things like rep mov going _backwards_.


^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 16/20] objtool: Rewrite alt->skip_orig
  2019-03-08 20:15   ` Josh Poimboeuf
@ 2019-03-08 21:34     ` Peter Zijlstra
  2019-03-08 22:27       ` Josh Poimboeuf
  0 siblings, 1 reply; 100+ messages in thread
From: Peter Zijlstra @ 2019-03-08 21:34 UTC (permalink / raw)
  To: Josh Poimboeuf
  Cc: torvalds, tglx, hpa, julien.thierry, will.deacon, luto, mingo,
	catalin.marinas, james.morse, valentin.schneider, brgerst, luto,
	bp, dvlasenk, linux-kernel, dvyukov, rostedt

On Fri, Mar 08, 2019 at 02:15:56PM -0600, Josh Poimboeuf wrote:
> On Thu, Mar 07, 2019 at 12:45:27PM +0100, Peter Zijlstra wrote:
> > Really skip the original instruction flow, instead of letting it
> > continue with NOPs.
> > 
> > Since the alternative code flow already continues after the original
> > instructions, only the alt-original is skipped.
> 
> I like this approach.  I wonder if we can do something similar to get
> rid of the nasty fake jumps.

This actually hard relies on those fake jumps. Or am I missing the
point?

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 18/20] objtool: Add UACCESS validation
  2019-03-08 21:31     ` Peter Zijlstra
@ 2019-03-08 21:54       ` Josh Poimboeuf
  0 siblings, 0 replies; 100+ messages in thread
From: Josh Poimboeuf @ 2019-03-08 21:54 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: torvalds, tglx, hpa, julien.thierry, will.deacon, luto, mingo,
	catalin.marinas, james.morse, valentin.schneider, brgerst, luto,
	bp, dvlasenk, linux-kernel, dvyukov, rostedt

On Fri, Mar 08, 2019 at 10:31:56PM +0100, Peter Zijlstra wrote:
> On Fri, Mar 08, 2019 at 03:02:09PM -0600, Josh Poimboeuf wrote:
> > > +static const char *uaccess_safe_builtin[] = {
> > > +	/* KASAN */
> > 
> > A short comment would be good here, something describing why a function
> > might be added to the list.
> 
> There is; but I'm thinking it might be too short?

I actually just meant a comment above uaccess_safe_builtin describing
what the purpose of the list is and what the expectations are for the
listed functions.  i.e. these are functions which are allowed to be
called with the AC flag on, and they should not clear it unless they're
saving/restoring.

> > > +++ b/tools/objtool/special.c
> > > @@ -42,6 +42,7 @@
> > >  #define ALT_NEW_LEN_OFFSET	11
> > >  
> > >  #define X86_FEATURE_POPCNT (4*32+23)
> > > +#define X86_FEATURE_SMAP   (9*32+20)
> > >  
> > >  struct special_entry {
> > >  	const char *sec;
> > > @@ -107,8 +108,15 @@ static int get_alt_entry(struct elf *elf
> > >  		 * It has been requested that we don't validate the !POPCNT
> > >  		 * feature path which is a "very very small percentage of
> > >  		 * machines".
> > > +		 *
> > > +		 * Also, unconditionally enable SMAP; this avoids seeing paths
> > > +		 * that pass through the STAC alternative and through the CLAC
> > > +		 * NOPs.
> > 
> > Why is this a problem?
> 
> 'obvious' violation?
> 
> STAC; .... RET; # an AC=1 leak
> 
> .... CLAC; # spurious CLAC
> 
> If we do the STAC we must also do the CLAC. If we don't do the STAC we
> must also not do the CLAC.

Makes sense now, can you add that last sentence to the paragraph?

> > > +		 *
> > > +		 * XXX: We could do this for all binary NOP/single-INSN
> > > +		 * alternatives.
> > 
> > Same question here.
> 
> In general, validating NOPs isn't too interesting, so all NOP/INSN
> binary alternatives could be forced on.

Right, but it doesn't sound like there's any real benefit to adding
extra logic.

> > >  		 */
> > > -		if (feature == X86_FEATURE_POPCNT)
> > > +		if (feature == X86_FEATURE_POPCNT || feature == X86_FEATURE_SMAP)
> > >  			alt->skip_orig = true;
> > >  	}
> 
> I've actually changed this to depend on --uaccess, when set we force on
> FEATURE_SMAP, otherwise we force off.

Ok.

-- 
Josh

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 20/20] objtool: Add Direction Flag validation
  2019-03-08 21:33     ` Peter Zijlstra
@ 2019-03-08 21:56       ` Josh Poimboeuf
  2019-03-10 13:13         ` Peter Zijlstra
  0 siblings, 1 reply; 100+ messages in thread
From: Josh Poimboeuf @ 2019-03-08 21:56 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: torvalds, tglx, hpa, julien.thierry, will.deacon, luto, mingo,
	catalin.marinas, james.morse, valentin.schneider, brgerst, luto,
	bp, dvlasenk, linux-kernel, dvyukov, rostedt

On Fri, Mar 08, 2019 at 10:33:43PM +0100, Peter Zijlstra wrote:
> On Fri, Mar 08, 2019 at 03:16:03PM -0600, Josh Poimboeuf wrote:
> > On Thu, Mar 07, 2019 at 12:45:31PM +0100, Peter Zijlstra wrote:
> > > Having DF escape is BAD(tm).
> > > 
> > > Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
> > > Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
> > 
> > Can you elaborate on why (in the patch description)?  Did this actually
> > find any occurrences?
> 
> Nope, didn't find anything. Also, all DF users are in asm so I didn't
> really expect any. Having it escape would probably result in fairly
> instant wreckage though.
> 
> DF=1 results in things like rep mov going _backwards_.

Ok, I wonder if we really need to add this then.

-- 
Josh

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 16/20] objtool: Rewrite alt->skip_orig
  2019-03-08 21:34     ` Peter Zijlstra
@ 2019-03-08 22:27       ` Josh Poimboeuf
  0 siblings, 0 replies; 100+ messages in thread
From: Josh Poimboeuf @ 2019-03-08 22:27 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: torvalds, tglx, hpa, julien.thierry, will.deacon, luto, mingo,
	catalin.marinas, james.morse, valentin.schneider, brgerst, luto,
	bp, dvlasenk, linux-kernel, dvyukov, rostedt

On Fri, Mar 08, 2019 at 10:34:18PM +0100, Peter Zijlstra wrote:
> On Fri, Mar 08, 2019 at 02:15:56PM -0600, Josh Poimboeuf wrote:
> > On Thu, Mar 07, 2019 at 12:45:27PM +0100, Peter Zijlstra wrote:
> > > Really skip the original instruction flow, instead of letting it
> > > continue with NOPs.
> > > 
> > > Since the alternative code flow already continues after the original
> > > instructions, only the alt-original is skipped.
> > 
> > I like this approach.  I wonder if we can do something similar to get
> > rid of the nasty fake jumps.
> 
> This actually hard relies on those fake jumps. Or am I missing the
> point?

I was just wondering out loud if we could somehow keep the same "fake
jump" functionality, but do it in a cleaner way that doesn't require
creating fake instructions.  I'll might give it a try.

-- 
Josh

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 18/20] objtool: Add UACCESS validation
  2019-03-08 21:02   ` Josh Poimboeuf
  2019-03-08 21:31     ` Peter Zijlstra
@ 2019-03-10 13:10     ` Peter Zijlstra
  2019-03-11 18:01       ` Josh Poimboeuf
  1 sibling, 1 reply; 100+ messages in thread
From: Peter Zijlstra @ 2019-03-10 13:10 UTC (permalink / raw)
  To: Josh Poimboeuf
  Cc: torvalds, tglx, hpa, julien.thierry, will.deacon, luto, mingo,
	catalin.marinas, james.morse, valentin.schneider, brgerst, luto,
	bp, dvlasenk, linux-kernel, dvyukov, rostedt

On Fri, Mar 08, 2019 at 03:02:09PM -0600, Josh Poimboeuf wrote:

> These gotos make my head spin.  Again I would much prefer a small amount
> of code duplication over this.

something like so then?

--- a/tools/objtool/check.c
+++ b/tools/objtool/check.c
@@ -1888,6 +1888,23 @@ static inline const char *insn_dest_name
 	return "{dynamic}";
 }
 
+static int validate_call(struct instruction *insn, struct insn_state *state)
+{
+	if (state->uaccess && !func_uaccess_safe(insn->call_dest)) {
+		WARN_FUNC("call to %s() with UACCESS enabled",
+				insn->sec, insn->offset, insn_dest_name(insn));
+		return 1;
+	}
+
+	if (state->df) {
+		WARN_FUNC("call to %s() with DF set",
+				insn->sec, insn->offset, insn_dest_name(insn));
+		return 1;
+	}
+
+	return 0;
+}
+
 /*
  * Follow the branch starting at the given instruction, and recursively follow
  * any other branches (jumps).  Meanwhile, track the frame pointer state at
@@ -2036,25 +2053,9 @@ static int validate_branch(struct objtoo
 
 		case INSN_CALL:
 		case INSN_CALL_DYNAMIC:
-do_call:
-			if (state.uaccess && !func_uaccess_safe(insn->call_dest)) {
-				WARN_FUNC("call to %s() with UACCESS enabled",
-					  sec, insn->offset, insn_dest_name(insn));
-				return 1;
-			}
-
-			if (state.df) {
-				WARN_FUNC("call to %s() with DF set",
-					  sec, insn->offset, insn_dest_name(insn));
-				return 1;
-			}
-
-			if (insn->type == INSN_JUMP_UNCONDITIONAL ||
-			    insn->type == INSN_JUMP_DYNAMIC)
-				return 0;
-
-			if (insn->type == INSN_JUMP_CONDITIONAL)
-				break;
+			ret = validate_call(insn, &state);
+			if (ret)
+				return ret;
 
 			if (insn->type == INSN_CALL) {
 				if (is_fentry_call(insn))
@@ -2077,13 +2078,15 @@ static int validate_branch(struct objtoo
 		case INSN_JUMP_CONDITIONAL:
 		case INSN_JUMP_UNCONDITIONAL:
 			if (func && !insn->jump_dest) {
-do_sibling_call:
+				/* sibling call */
 				if (has_modified_stack_frame(&state)) {
 					WARN_FUNC("sibling call from callable instruction with modified stack frame",
 							sec, insn->offset);
 					return 1;
 				}
-				goto do_call;
+				ret = validate_call(insn, &state);
+				if (ret)
+					return ret;
 
 			} else if (insn->jump_dest &&
 				   (!func || !insn->jump_dest->func ||
@@ -2104,8 +2107,17 @@ static int validate_branch(struct objtoo
 			break;
 
 		case INSN_JUMP_DYNAMIC:
-			if (func && list_empty(&insn->alts))
-				goto do_sibling_call;
+			if (func && list_empty(&insn->alts)) {
+				/* sibling call */
+				if (has_modified_stack_frame(&state)) {
+					WARN_FUNC("sibling call from callable instruction with modified stack frame",
+							sec, insn->offset);
+					return 1;
+				}
+				ret = validate_call(insn, &state);
+				if (ret)
+					return ret;
+			}
 
 			return 0;
 


^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 19/20] objtool: uaccess PUSHF/POPF support
  2019-03-08 21:11   ` Josh Poimboeuf
@ 2019-03-10 13:12     ` Peter Zijlstra
  0 siblings, 0 replies; 100+ messages in thread
From: Peter Zijlstra @ 2019-03-10 13:12 UTC (permalink / raw)
  To: Josh Poimboeuf
  Cc: torvalds, tglx, hpa, julien.thierry, will.deacon, luto, mingo,
	catalin.marinas, james.morse, valentin.schneider, brgerst, luto,
	bp, dvlasenk, linux-kernel, dvyukov, rostedt

On Fri, Mar 08, 2019 at 03:11:22PM -0600, Josh Poimboeuf wrote:
> On Thu, Mar 07, 2019 at 12:45:30PM +0100, Peter Zijlstra wrote:
> > Add PUSHF / POPF state.uaccess restore logic.
> > 
> > XXX: should possibly be merged with the previous patch such that KASAN
> > doesn't explode in between. Split for review.
> 
> Needs more description -- namely, what and why.

See patch 8. This really should be folded back in the previous patch,
but it is easier to look at without all that mixed in.

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 20/20] objtool: Add Direction Flag validation
  2019-03-08 21:56       ` Josh Poimboeuf
@ 2019-03-10 13:13         ` Peter Zijlstra
  2019-03-11 18:00           ` Josh Poimboeuf
  0 siblings, 1 reply; 100+ messages in thread
From: Peter Zijlstra @ 2019-03-10 13:13 UTC (permalink / raw)
  To: Josh Poimboeuf
  Cc: torvalds, tglx, hpa, julien.thierry, will.deacon, luto, mingo,
	catalin.marinas, james.morse, valentin.schneider, brgerst, luto,
	bp, dvlasenk, linux-kernel, dvyukov, rostedt

On Fri, Mar 08, 2019 at 03:56:02PM -0600, Josh Poimboeuf wrote:
> On Fri, Mar 08, 2019 at 10:33:43PM +0100, Peter Zijlstra wrote:
> > On Fri, Mar 08, 2019 at 03:16:03PM -0600, Josh Poimboeuf wrote:

> > > Can you elaborate on why (in the patch description)?  Did this actually
> > > find any occurrences?
> > 
> > Nope, didn't find anything. Also, all DF users are in asm so I didn't
> > really expect any. Having it escape would probably result in fairly
> > instant wreckage though.
> > 
> > DF=1 results in things like rep mov going _backwards_.
> 
> Ok, I wonder if we really need to add this then.

Well, Linus asked for it, and it was a fairly trivial add-on :-)

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 00/20] objtool: UACCESS validation v3
  2019-03-07 18:18                 ` Steven Rostedt
@ 2019-03-10 13:16                   ` Peter Zijlstra
  2019-04-19 10:08                     ` [PATCH] compiler.h, tracing: Remove CONFIG_PROFILE_ALL_BRANCHES Ingo Molnar
  0 siblings, 1 reply; 100+ messages in thread
From: Peter Zijlstra @ 2019-03-10 13:16 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: Linus Torvalds, Josh Poimboeuf, Thomas Gleixner, Peter Anvin,
	Julien Thierry, Will Deacon, Andy Lutomirski, Ingo Molnar,
	Catalin Marinas, James Morse, valentin.schneider, Brian Gerst,
	Andrew Lutomirski, Borislav Petkov, Denys Vlasenko,
	Linux List Kernel Mailing, Dmitry Vyukov, Slavomir Kaslev

On Thu, Mar 07, 2019 at 01:18:41PM -0500, Steven Rostedt wrote:
> On Thu, 7 Mar 2019 09:45:35 -0800
> Linus Torvalds <torvalds@linux-foundation.org> wrote:
> 
> > On Thu, Mar 7, 2019 at 9:38 AM Peter Zijlstra <peterz@infradead.org> wrote:
> > >
> > > Also; it seems to me that something PT, or maybe even simply:
> > >
> > >   perf -e branches -e branch-misses
> > >
> > > would get you similar or sufficient information.  

> I currently have one of my engineers looking at the data and may be
> sending patches soon. It's basically an entry level way to get into
> kernel development. Note, no patch will be sent just because of the
> data from the profiling. The task is to look at and understand the
> code, and see if it can be optimized (with likely/unlikely or flow
> changes). It's a way to get a better understanding of the kernel in
> various locations. It is by no means "profiler said this, lets change
> it." All changes must be rational, and make sense. The profiler is only
> used to help find those places.

Can't you just have those same engineers look at perf data? This seems
like a very expensive and convoluted way of getting something.


^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 05/20] x86/uaccess/xen: Suppress SMAP warnings
  2019-03-08 19:03     ` Josh Poimboeuf
@ 2019-03-10 13:19       ` Peter Zijlstra
  2019-03-11 17:59         ` Josh Poimboeuf
  0 siblings, 1 reply; 100+ messages in thread
From: Peter Zijlstra @ 2019-03-10 13:19 UTC (permalink / raw)
  To: Josh Poimboeuf
  Cc: torvalds, tglx, hpa, julien.thierry, will.deacon, luto, mingo,
	catalin.marinas, james.morse, valentin.schneider, brgerst, luto,
	bp, dvlasenk, linux-kernel, dvyukov, rostedt, andrew.cooper3

On Fri, Mar 08, 2019 at 01:03:34PM -0600, Josh Poimboeuf wrote:
> On Fri, Mar 08, 2019 at 01:00:38PM -0600, Josh Poimboeuf wrote:
> > On Thu, Mar 07, 2019 at 12:45:16PM +0100, Peter Zijlstra wrote:

> > > XXX: arguably we should rename ANNOTATE_NOSPEC_ALTERNATIVE to
> > >      ANNOTATE_IGNORE_ALTERNATIVE.

> Also this you could get rid of the comment if there were an
> ANNOTATE_AC_SAFE macro which does a similar thing.

How about we just rename the one annotation we have? I figured it was a
waste of LoC to do yet another annotation that does the very same thing.

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 03/20] x86/uaccess: Move copy_user_handle_tail into asm
  2019-03-08 19:53       ` Josh Poimboeuf
@ 2019-03-10 13:22         ` Peter Zijlstra
  0 siblings, 0 replies; 100+ messages in thread
From: Peter Zijlstra @ 2019-03-10 13:22 UTC (permalink / raw)
  To: Josh Poimboeuf
  Cc: torvalds, tglx, hpa, julien.thierry, will.deacon, luto, mingo,
	catalin.marinas, james.morse, valentin.schneider, brgerst, luto,
	bp, dvlasenk, linux-kernel, dvyukov, rostedt

On Fri, Mar 08, 2019 at 01:53:02PM -0600, Josh Poimboeuf wrote:
> On Fri, Mar 08, 2019 at 08:48:35PM +0100, Peter Zijlstra wrote:
> > On Fri, Mar 08, 2019 at 12:53:21PM -0600, Josh Poimboeuf wrote:
> > > On Thu, Mar 07, 2019 at 12:45:14PM +0100, Peter Zijlstra wrote:
> > > >  /*
> > > > + * Try to copy last bytes and clear the rest if needed.
> > > > + * Since protection fault in copy_from/to_user is not a normal situation,
> > > > + * it is not necessary to optimize tail handling.
> > > > + *
> > > > + * Input:
> > > > + * rdi destination
> > > > + * rsi source
> > > > + * rdx count
> > > > + *
> > > > + * Output:
> > > > + * eax uncopied bytes or 0 if successful.
> > > > + */
> > > > +ALIGN;
> > > > +copy_user_handle_tail:
> > > > +	movl %edx,%ecx
> > > > +1:	rep movsb
> > > > +2:	mov %ecx,%eax
> > > > +	ASM_CLAC
> > > > +	ret
> > > > +
> > > > +	_ASM_EXTABLE_UA(1b, 2b)
> > > > +ENDPROC(copy_user_handle_tail)
> > > 
> > > This is an unstructured piece of code rather than a callable function,
> > > END would probably be more appropriate.  Or maybe it should just be a
> > > local label (.Lcopy_user_handle_tail) because I don't think the
> > > alignment and ELF symbol size are even needed.
> > 
> > ENDPROC makes it STT_FUNC and gets us stricter AC tests.
> 
> How so?  I would have thought the opposite.  Doesn't objtool only follow
> a jump if its destination is to a non-function?  Otherwise it's
> considered a sibling call.

Normally yes, but we don't do that for .fixup I think. And by setting
STT_FUNC we enable the 'redundant CLAC' warning, which is ignored for
!STT_FUNC.

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 05/20] x86/uaccess/xen: Suppress SMAP warnings
  2019-03-10 13:19       ` Peter Zijlstra
@ 2019-03-11 17:59         ` Josh Poimboeuf
  0 siblings, 0 replies; 100+ messages in thread
From: Josh Poimboeuf @ 2019-03-11 17:59 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: torvalds, tglx, hpa, julien.thierry, will.deacon, luto, mingo,
	catalin.marinas, james.morse, valentin.schneider, brgerst, luto,
	bp, dvlasenk, linux-kernel, dvyukov, rostedt, andrew.cooper3

On Sun, Mar 10, 2019 at 02:19:29PM +0100, Peter Zijlstra wrote:
> On Fri, Mar 08, 2019 at 01:03:34PM -0600, Josh Poimboeuf wrote:
> > On Fri, Mar 08, 2019 at 01:00:38PM -0600, Josh Poimboeuf wrote:
> > > On Thu, Mar 07, 2019 at 12:45:16PM +0100, Peter Zijlstra wrote:
> 
> > > > XXX: arguably we should rename ANNOTATE_NOSPEC_ALTERNATIVE to
> > > >      ANNOTATE_IGNORE_ALTERNATIVE.
> 
> > Also this you could get rid of the comment if there were an
> > ANNOTATE_AC_SAFE macro which does a similar thing.
> 
> How about we just rename the one annotation we have? I figured it was a
> waste of LoC to do yet another annotation that does the very same thing.

I think ANNOTATE_IGNORE_ALTERNATIVE would hurt readability too.  How
about just

  #define ANNOTATE_UACCESS_SAFE ANNOTATE_NOSPEC_ALTERNATIVE

or, make both ANNOTATE_UACCESS_SAFE and ANNOTATE_NOSPEC_ALTERNATIVE
defined to the same OBJTOOL_IGNORE_ALTERNATIVE macro.

-- 
Josh

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 20/20] objtool: Add Direction Flag validation
  2019-03-10 13:13         ` Peter Zijlstra
@ 2019-03-11 18:00           ` Josh Poimboeuf
  0 siblings, 0 replies; 100+ messages in thread
From: Josh Poimboeuf @ 2019-03-11 18:00 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: torvalds, tglx, hpa, julien.thierry, will.deacon, luto, mingo,
	catalin.marinas, james.morse, valentin.schneider, brgerst, luto,
	bp, dvlasenk, linux-kernel, dvyukov, rostedt

On Sun, Mar 10, 2019 at 02:13:31PM +0100, Peter Zijlstra wrote:
> On Fri, Mar 08, 2019 at 03:56:02PM -0600, Josh Poimboeuf wrote:
> > On Fri, Mar 08, 2019 at 10:33:43PM +0100, Peter Zijlstra wrote:
> > > On Fri, Mar 08, 2019 at 03:16:03PM -0600, Josh Poimboeuf wrote:
> 
> > > > Can you elaborate on why (in the patch description)?  Did this actually
> > > > find any occurrences?
> > > 
> > > Nope, didn't find anything. Also, all DF users are in asm so I didn't
> > > really expect any. Having it escape would probably result in fairly
> > > instant wreckage though.
> > > 
> > > DF=1 results in things like rep mov going _backwards_.
> > 
> > Ok, I wonder if we really need to add this then.
> 
> Well, Linus asked for it, and it was a fairly trivial add-on :-)

If it doesn't matter much either way, I'd rather err on the side of less
code.  Your call though.

-- 
Josh

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 18/20] objtool: Add UACCESS validation
  2019-03-10 13:10     ` Peter Zijlstra
@ 2019-03-11 18:01       ` Josh Poimboeuf
  0 siblings, 0 replies; 100+ messages in thread
From: Josh Poimboeuf @ 2019-03-11 18:01 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: torvalds, tglx, hpa, julien.thierry, will.deacon, luto, mingo,
	catalin.marinas, james.morse, valentin.schneider, brgerst, luto,
	bp, dvlasenk, linux-kernel, dvyukov, rostedt

On Sun, Mar 10, 2019 at 02:10:46PM +0100, Peter Zijlstra wrote:
> On Fri, Mar 08, 2019 at 03:02:09PM -0600, Josh Poimboeuf wrote:
> 
> > These gotos make my head spin.  Again I would much prefer a small amount
> > of code duplication over this.
> 
> something like so then?

Yeah, that looks a lot nicer to me.  Thanks.

> 
> --- a/tools/objtool/check.c
> +++ b/tools/objtool/check.c
> @@ -1888,6 +1888,23 @@ static inline const char *insn_dest_name
>  	return "{dynamic}";
>  }
>  
> +static int validate_call(struct instruction *insn, struct insn_state *state)
> +{
> +	if (state->uaccess && !func_uaccess_safe(insn->call_dest)) {
> +		WARN_FUNC("call to %s() with UACCESS enabled",
> +				insn->sec, insn->offset, insn_dest_name(insn));
> +		return 1;
> +	}
> +
> +	if (state->df) {
> +		WARN_FUNC("call to %s() with DF set",
> +				insn->sec, insn->offset, insn_dest_name(insn));
> +		return 1;
> +	}
> +
> +	return 0;
> +}
> +
>  /*
>   * Follow the branch starting at the given instruction, and recursively follow
>   * any other branches (jumps).  Meanwhile, track the frame pointer state at
> @@ -2036,25 +2053,9 @@ static int validate_branch(struct objtoo
>  
>  		case INSN_CALL:
>  		case INSN_CALL_DYNAMIC:
> -do_call:
> -			if (state.uaccess && !func_uaccess_safe(insn->call_dest)) {
> -				WARN_FUNC("call to %s() with UACCESS enabled",
> -					  sec, insn->offset, insn_dest_name(insn));
> -				return 1;
> -			}
> -
> -			if (state.df) {
> -				WARN_FUNC("call to %s() with DF set",
> -					  sec, insn->offset, insn_dest_name(insn));
> -				return 1;
> -			}
> -
> -			if (insn->type == INSN_JUMP_UNCONDITIONAL ||
> -			    insn->type == INSN_JUMP_DYNAMIC)
> -				return 0;
> -
> -			if (insn->type == INSN_JUMP_CONDITIONAL)
> -				break;
> +			ret = validate_call(insn, &state);
> +			if (ret)
> +				return ret;
>  
>  			if (insn->type == INSN_CALL) {
>  				if (is_fentry_call(insn))
> @@ -2077,13 +2078,15 @@ static int validate_branch(struct objtoo
>  		case INSN_JUMP_CONDITIONAL:
>  		case INSN_JUMP_UNCONDITIONAL:
>  			if (func && !insn->jump_dest) {
> -do_sibling_call:
> +				/* sibling call */
>  				if (has_modified_stack_frame(&state)) {
>  					WARN_FUNC("sibling call from callable instruction with modified stack frame",
>  							sec, insn->offset);
>  					return 1;
>  				}
> -				goto do_call;
> +				ret = validate_call(insn, &state);
> +				if (ret)
> +					return ret;
>  
>  			} else if (insn->jump_dest &&
>  				   (!func || !insn->jump_dest->func ||
> @@ -2104,8 +2107,17 @@ static int validate_branch(struct objtoo
>  			break;
>  
>  		case INSN_JUMP_DYNAMIC:
> -			if (func && list_empty(&insn->alts))
> -				goto do_sibling_call;
> +			if (func && list_empty(&insn->alts)) {
> +				/* sibling call */
> +				if (has_modified_stack_frame(&state)) {
> +					WARN_FUNC("sibling call from callable instruction with modified stack frame",
> +							sec, insn->offset);
> +					return 1;
> +				}
> +				ret = validate_call(insn, &state);
> +				if (ret)
> +					return ret;
> +			}
>  
>  			return 0;
>  
> 

-- 
Josh

^ permalink raw reply	[flat|nested] 100+ messages in thread

* [tip:core/objtool] tracing: Improve "if" macro code generation
  2019-03-07 17:48           ` Josh Poimboeuf
@ 2019-04-03  8:21             ` tip-bot for Josh Poimboeuf
  0 siblings, 0 replies; 100+ messages in thread
From: tip-bot for Josh Poimboeuf @ 2019-04-03  8:21 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: peterz, hpa, torvalds, jpoimboe, linux-kernel, mingo, bp, tglx

Commit-ID:  37686b1353cfc30e127cef811959cdbcd0495d98
Gitweb:     https://git.kernel.org/tip/37686b1353cfc30e127cef811959cdbcd0495d98
Author:     Josh Poimboeuf <jpoimboe@redhat.com>
AuthorDate: Thu, 7 Mar 2019 11:48:02 -0600
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Wed, 3 Apr 2019 09:36:27 +0200

tracing: Improve "if" macro code generation

With CONFIG_PROFILE_ALL_BRANCHES=y, the "if" macro converts the
conditional to an array index.  This can cause GCC to create horrible
code.  When there are nested ifs, the generated code uses register
values to encode branching decisions.

Make it easier for GCC to optimize by keeping the conditional as a
conditional rather than converting it to an integer.  This shrinks the
generated code quite a bit, and also makes the code sane enough for
objtool to understand.

Reported-by: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: brgerst@gmail.com
Cc: catalin.marinas@arm.com
Cc: dvlasenk@redhat.com
Cc: dvyukov@google.com
Cc: hpa@zytor.com
Cc: james.morse@arm.com
Cc: julien.thierry@arm.com
Cc: luto@amacapital.net
Cc: luto@kernel.org
Cc: rostedt@goodmis.org
Cc: valentin.schneider@arm.com
Cc: will.deacon@arm.com
Link: https://lkml.kernel.org/r/20190307174802.46fmpysxyo35hh43@treble
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 include/linux/compiler.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index 445348facea9..d58aa0db05f9 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -67,7 +67,7 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val,
 				.line = __LINE__,			\
 			};						\
 		______r = !!(cond);					\
-		______f.miss_hit[______r]++;					\
+		______r ? ______f.miss_hit[1]++ : ______f.miss_hit[0]++;\
 		______r;						\
 	}))
 #endif /* CONFIG_PROFILE_ALL_BRANCHES */

^ permalink raw reply related	[flat|nested] 100+ messages in thread

* [PATCH] compiler.h, tracing: Remove CONFIG_PROFILE_ALL_BRANCHES
  2019-03-10 13:16                   ` Peter Zijlstra
@ 2019-04-19 10:08                     ` Ingo Molnar
  2019-04-19 13:04                       ` Steven Rostedt
  0 siblings, 1 reply; 100+ messages in thread
From: Ingo Molnar @ 2019-04-19 10:08 UTC (permalink / raw)
  To: Peter Zijlstra, Linus Torvalds, Steven Rostedt
  Cc: Steven Rostedt, Linus Torvalds, Josh Poimboeuf, Thomas Gleixner,
	Peter Anvin, Julien Thierry, Will Deacon, Andy Lutomirski,
	Catalin Marinas, James Morse, valentin.schneider, Brian Gerst,
	Andrew Lutomirski, Borislav Petkov, Denys Vlasenko,
	Linux List Kernel Mailing, Dmitry Vyukov, Slavomir Kaslev


* Peter Zijlstra <peterz@infradead.org> wrote:

> On Thu, Mar 07, 2019 at 01:18:41PM -0500, Steven Rostedt wrote:
> > On Thu, 7 Mar 2019 09:45:35 -0800
> > Linus Torvalds <torvalds@linux-foundation.org> wrote:
> > 
> > > On Thu, Mar 7, 2019 at 9:38 AM Peter Zijlstra <peterz@infradead.org> wrote:
> > > >
> > > > Also; it seems to me that something PT, or maybe even simply:
> > > >
> > > >   perf -e branches -e branch-misses
> > > >
> > > > would get you similar or sufficient information.  
> 
> > I currently have one of my engineers looking at the data and may be
> > sending patches soon. It's basically an entry level way to get into
> > kernel development. Note, no patch will be sent just because of the
> > data from the profiling. The task is to look at and understand the
> > code, and see if it can be optimized (with likely/unlikely or flow
> > changes). It's a way to get a better understanding of the kernel in
> > various locations. It is by no means "profiler said this, lets change
> > it." All changes must be rational, and make sense. The profiler is only
> > used to help find those places.
> 
> Can't you just have those same engineers look at perf data? This seems
> like a very expensive and convoluted way of getting something.

So since no-one offered objections to using perf branch profiling instead 
(which method allows so much more than CONFIG_PROFILE_ALL_BRANCHES: such 
as profiling glibc and other user-space, or allowing to branch-profile 
the kernel is an uninstrumented form not distorted by 
CONFIG_PROFILE_ALL_BRANCHES code generation artifacts), lemme propose the 
attached patch to remove if-tracing.

If the CONFIG_PROFILE_ALL_BRANCHES=y feature is required for anyone it 
can still be reverted privately or maintained out of tree - no need to 
burden the mainline kernel with this.

I've build tested this and it Looks Perfect Here™.

Thanks,

	Ingo

=============================>
From 3f689ed8a1555aabead90e015a47aefddd2a4e25 Mon Sep 17 00:00:00 2001
From: Ingo Molnar <mingo@kernel.org>
Date: Fri, 19 Apr 2019 11:42:43 +0200
Subject: [PATCH] compiler.h, tracing: Remove CONFIG_PROFILE_ALL_BRANCHES

Redefining 'if' in compiler.h was a hideously wonderful hack back in 2008 when
we merged it via:

  2bcd521a684c: ("trace: profile all if conditionals")

Meanwhile the 'wonderful' novelty part wore off a bit in that decade, and 
what remained is the 'hideous', mostly. ;-)

Meanwhile #2: we also merged perf and hardware branch tracing 
capabilities (branch-miss events, but also BTS and aux hw tracing),
which can collect similar data and so much more:

  $ perf -e branches -e branch-misses

So let's remove this constant source of headaches for good. Anyone truly 
interested in this feature can revert this commit and/or maintain it out 
of tree - but the upstream pain isn't really worth it.

Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 include/asm-generic/vmlinux.lds.h           | 11 +----
 include/linux/compiler.h                    | 24 -----------
 kernel/trace/Kconfig                        | 17 --------
 kernel/trace/trace_branch.c                 | 66 -----------------------------
 tools/perf/tests/bpf-script-test-prologue.c |  9 ----
 5 files changed, 1 insertion(+), 126 deletions(-)

diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index f8f6f04c4453..9c477b2136c2 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -126,14 +126,6 @@
 #define LIKELY_PROFILE()
 #endif
 
-#ifdef CONFIG_PROFILE_ALL_BRANCHES
-#define BRANCH_PROFILE()	__start_branch_profile = .;		\
-				KEEP(*(_ftrace_branch))			\
-				__stop_branch_profile = .;
-#else
-#define BRANCH_PROFILE()
-#endif
-
 #ifdef CONFIG_KPROBES
 #define KPROBE_BLACKLIST()	. = ALIGN(8);				      \
 				__start_kprobe_blacklist = .;		      \
@@ -266,8 +258,7 @@
 	__start___verbose = .;						\
 	KEEP(*(__verbose))                                              \
 	__stop___verbose = .;						\
-	LIKELY_PROFILE()		       				\
-	BRANCH_PROFILE()						\
+	LIKELY_PROFILE()						\
 	TRACE_PRINTKS()							\
 	BPF_RAW_TP()							\
 	TRACEPOINT_STR()
diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index d58aa0db05f9..c63105451c6a 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -48,30 +48,6 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val,
 #  define unlikely(x)	(__branch_check__(x, 0, __builtin_constant_p(x)))
 # endif
 
-#ifdef CONFIG_PROFILE_ALL_BRANCHES
-/*
- * "Define 'is'", Bill Clinton
- * "Define 'if'", Steven Rostedt
- */
-#define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
-#define __trace_if(cond) \
-	if (__builtin_constant_p(!!(cond)) ? !!(cond) :			\
-	({								\
-		int ______r;						\
-		static struct ftrace_branch_data			\
-			__aligned(4)					\
-			__section("_ftrace_branch")			\
-			______f = {					\
-				.func = __func__,			\
-				.file = __FILE__,			\
-				.line = __LINE__,			\
-			};						\
-		______r = !!(cond);					\
-		______r ? ______f.miss_hit[1]++ : ______f.miss_hit[0]++;\
-		______r;						\
-	}))
-#endif /* CONFIG_PROFILE_ALL_BRANCHES */
-
 #else
 # define likely(x)	__builtin_expect(!!(x), 1)
 # define unlikely(x)	__builtin_expect(!!(x), 0)
diff --git a/kernel/trace/Kconfig b/kernel/trace/Kconfig
index 8bd1d6d001d7..169c34e0f16d 100644
--- a/kernel/trace/Kconfig
+++ b/kernel/trace/Kconfig
@@ -366,23 +366,6 @@ config PROFILE_ANNOTATED_BRANCHES
 
 	  Note: this will add a significant overhead; only turn this
 	  on if you need to profile the system's use of these macros.
-
-config PROFILE_ALL_BRANCHES
-	bool "Profile all if conditionals" if !FORTIFY_SOURCE
-	select TRACE_BRANCH_PROFILING
-	imply CC_DISABLE_WARN_MAYBE_UNINITIALIZED  # avoid false positives
-	help
-	  This tracer profiles all branch conditions. Every if ()
-	  taken in the kernel is recorded whether it hit or miss.
-	  The results will be displayed in:
-
-	  /sys/kernel/debug/tracing/trace_stat/branch_all
-
-	  This option also enables the likely/unlikely profiler.
-
-	  This configuration, when enabled, will impose a great overhead
-	  on the system. This should only be enabled when the system
-	  is to be analyzed in much detail.
 endchoice
 
 config TRACING_BRANCHES
diff --git a/kernel/trace/trace_branch.c b/kernel/trace/trace_branch.c
index 3ea65cdff30d..be75301a9963 100644
--- a/kernel/trace/trace_branch.c
+++ b/kernel/trace/trace_branch.c
@@ -387,69 +387,3 @@ __init static int init_annotated_branch_stats(void)
 	return 0;
 }
 fs_initcall(init_annotated_branch_stats);
-
-#ifdef CONFIG_PROFILE_ALL_BRANCHES
-
-extern unsigned long __start_branch_profile[];
-extern unsigned long __stop_branch_profile[];
-
-static int all_branch_stat_headers(struct seq_file *m)
-{
-	seq_puts(m, "   miss      hit    % "
-		    "       Function                "
-		    "  File              Line\n"
-		    " ------- ---------  - "
-		    "       --------                "
-		    "  ----              ----\n");
-	return 0;
-}
-
-static void *all_branch_stat_start(struct tracer_stat *trace)
-{
-	return __start_branch_profile;
-}
-
-static void *
-all_branch_stat_next(void *v, int idx)
-{
-	struct ftrace_branch_data *p = v;
-
-	++p;
-
-	if ((void *)p >= (void *)__stop_branch_profile)
-		return NULL;
-
-	return p;
-}
-
-static int all_branch_stat_show(struct seq_file *m, void *v)
-{
-	struct ftrace_branch_data *p = v;
-	const char *f;
-
-	f = branch_stat_process_file(p);
-	return branch_stat_show_normal(m, p, f);
-}
-
-static struct tracer_stat all_branch_stats = {
-	.name = "branch_all",
-	.stat_start = all_branch_stat_start,
-	.stat_next = all_branch_stat_next,
-	.stat_headers = all_branch_stat_headers,
-	.stat_show = all_branch_stat_show
-};
-
-__init static int all_annotated_branch_stats(void)
-{
-	int ret;
-
-	ret = register_stat_tracer(&all_branch_stats);
-	if (!ret) {
-		printk(KERN_WARNING "Warning: could not register "
-				    "all branches stats\n");
-		return 1;
-	}
-	return 0;
-}
-fs_initcall(all_annotated_branch_stats);
-#endif /* CONFIG_PROFILE_ALL_BRANCHES */
diff --git a/tools/perf/tests/bpf-script-test-prologue.c b/tools/perf/tests/bpf-script-test-prologue.c
index 43f1e16486f4..1f048bd89b0d 100644
--- a/tools/perf/tests/bpf-script-test-prologue.c
+++ b/tools/perf/tests/bpf-script-test-prologue.c
@@ -10,15 +10,6 @@
 
 #include <uapi/linux/fs.h>
 
-/*
- * If CONFIG_PROFILE_ALL_BRANCHES is selected,
- * 'if' is redefined after include kernel header.
- * Recover 'if' for BPF object code.
- */
-#ifdef if
-# undef if
-#endif
-
 #define FMODE_READ		0x1
 #define FMODE_WRITE		0x2
 

^ permalink raw reply related	[flat|nested] 100+ messages in thread

* Re: [PATCH] compiler.h, tracing: Remove CONFIG_PROFILE_ALL_BRANCHES
  2019-04-19 10:08                     ` [PATCH] compiler.h, tracing: Remove CONFIG_PROFILE_ALL_BRANCHES Ingo Molnar
@ 2019-04-19 13:04                       ` Steven Rostedt
  0 siblings, 0 replies; 100+ messages in thread
From: Steven Rostedt @ 2019-04-19 13:04 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Peter Zijlstra, Linus Torvalds, Josh Poimboeuf, Thomas Gleixner,
	Peter Anvin, Julien Thierry, Will Deacon, Andy Lutomirski,
	Catalin Marinas, James Morse, valentin.schneider, Brian Gerst,
	Andrew Lutomirski, Borislav Petkov, Denys Vlasenko,
	Linux List Kernel Mailing, Dmitry Vyukov, Slavomir Kaslev

On Fri, 19 Apr 2019 12:08:37 +0200
Ingo Molnar <mingo@kernel.org> wrote:

> > Can't you just have those same engineers look at perf data? This seems
> > like a very expensive and convoluted way of getting something.  

I haven't tried the perf data. How well does it work with running over
a 2 weeks to a month period? That's what I do yearly. Here's the
results of my last run:

  http://rostedt.homelinux.com/branches/gandalf-branches-2019/brach_all-2019-02-05

  http://rostedt.homelinux.com/branches/mammoth-branches-2019/branch_all-2019-01-02
  http://rostedt.homelinux.com/branches/mammoth-branches-2019/branch_all-2019-01-03
  http://rostedt.homelinux.com/branches/mammoth-branches-2019/branch_all-2019-01-17
  http://rostedt.homelinux.com/branches/mammoth-branches-2019/branch_all-2019-02-05

I have a cron job that runs nightly that copies the current state, and
if the machine reboots, it starts a new file (which is why there's
multiple files for mammoth - it rebooted).

> 
> So since no-one offered objections to using perf branch profiling instead 
> (which method allows so much more than CONFIG_PROFILE_ALL_BRANCHES: such 

I've never used it, so I have no idea if it is suitable or not.

> as profiling glibc and other user-space, or allowing to branch-profile 
> the kernel is an uninstrumented form not distorted by 
> CONFIG_PROFILE_ALL_BRANCHES code generation artifacts), lemme propose the 
> attached patch to remove if-tracing.
> 
> If the CONFIG_PROFILE_ALL_BRANCHES=y feature is required for anyone it 
> can still be reverted privately or maintained out of tree - no need to 
> burden the mainline kernel with this.

But is it a real burden? It's been in the kernel for over 10 years
with very little issue. Only when we do something drastic does it show
up, and it's usually a quick fix to get it working again.

I believe Josh even told me that it found a bug in the objtool code, so
it does still have benefit staying in the kernel even without people
using it for profiling.

Note, I'm in the middle of writing a LWN article about learning the
kernel from branch profiling and it would be a shame if it disappears
before I finish it.

-- Steve


> 
> I've build tested this and it Looks Perfect Here™.


^ permalink raw reply	[flat|nested] 100+ messages in thread

end of thread, other threads:[~2019-04-19 19:12 UTC | newest]

Thread overview: 100+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-07 11:45 [PATCH 00/20] objtool: UACCESS validation v3 Peter Zijlstra
2019-03-07 11:45 ` [PATCH 01/20] x86/ia32: Fix ia32_restore_sigcontext AC leak Peter Zijlstra
2019-03-07 11:45 ` [PATCH 02/20] i915,uaccess: Fix redundant CLAC Peter Zijlstra
2019-03-07 11:45 ` [PATCH 03/20] x86/uaccess: Move copy_user_handle_tail into asm Peter Zijlstra
2019-03-08 18:53   ` Josh Poimboeuf
2019-03-08 19:48     ` Peter Zijlstra
2019-03-08 19:53       ` Josh Poimboeuf
2019-03-10 13:22         ` Peter Zijlstra
2019-03-07 11:45 ` [PATCH 04/20] x86/uaccess: Fix up the fixup Peter Zijlstra
2019-03-07 11:45 ` [PATCH 05/20] x86/uaccess/xen: Suppress SMAP warnings Peter Zijlstra
2019-03-07 12:22   ` Juergen Gross
2019-03-07 12:32     ` Peter Zijlstra
2019-03-07 12:36       ` Juergen Gross
2019-03-08 19:00   ` Josh Poimboeuf
2019-03-08 19:03     ` Josh Poimboeuf
2019-03-10 13:19       ` Peter Zijlstra
2019-03-11 17:59         ` Josh Poimboeuf
2019-03-08 19:50     ` Peter Zijlstra
2019-03-07 11:45 ` [PATCH 06/20] x86/uaccess: Always inline user_access_begin() Peter Zijlstra
2019-03-07 11:45 ` [PATCH 07/20] x86/uaccess: Always inline force_valid_ss() Peter Zijlstra
2019-03-07 13:50   ` Peter Zijlstra
2019-03-07 18:05   ` Andy Lutomirski
2019-03-07 18:59     ` Peter Zijlstra
2019-03-07 19:06       ` Andy Lutomirski
2019-03-07 11:45 ` [PATCH 08/20] x86/uaccess: Introduce user_access_{save,restore}() Peter Zijlstra
2019-03-07 11:45 ` [PATCH 09/20] x86/uaccess,kasan: Fix KASAN vs SMAP Peter Zijlstra
2019-03-07 11:45 ` [PATCH 10/20] x86/uaccess,ubsan: Fix UBSAN " Peter Zijlstra
2019-03-07 11:45 ` [PATCH 11/20] x86/uaccess,ftrace: Fix ftrace_likely_update() " Peter Zijlstra
2019-03-07 11:45 ` [PATCH 12/20] objtool: Set insn->func for alternatives Peter Zijlstra
2019-03-08 19:16   ` Josh Poimboeuf
2019-03-08 19:51     ` Peter Zijlstra
2019-03-07 11:45 ` [PATCH 13/20] objtool: Hande function aliases Peter Zijlstra
2019-03-08 19:23   ` Josh Poimboeuf
2019-03-08 19:52     ` Peter Zijlstra
2019-03-08 20:00       ` Josh Poimboeuf
2019-03-07 11:45 ` [PATCH 14/20] objtool: Rewrite add_ignores() Peter Zijlstra
2019-03-08 19:29   ` Josh Poimboeuf
2019-03-07 11:45 ` [PATCH 15/20] objtool: Add --backtrace support Peter Zijlstra
2019-03-08 19:33   ` Josh Poimboeuf
2019-03-07 11:45 ` [PATCH 16/20] objtool: Rewrite alt->skip_orig Peter Zijlstra
2019-03-08 20:15   ` Josh Poimboeuf
2019-03-08 21:34     ` Peter Zijlstra
2019-03-08 22:27       ` Josh Poimboeuf
2019-03-07 11:45 ` [PATCH 17/20] objtool: Fix sibling call detection Peter Zijlstra
2019-03-08 20:22   ` Josh Poimboeuf
2019-03-07 11:45 ` [PATCH 18/20] objtool: Add UACCESS validation Peter Zijlstra
2019-03-07 16:33   ` Linus Torvalds
2019-03-07 17:10     ` hpa
2019-03-07 17:41     ` Peter Zijlstra
2019-03-07 17:54       ` Linus Torvalds
2019-03-07 18:48         ` Peter Zijlstra
2019-03-07 18:51           ` hpa
2019-03-07 19:03           ` Peter Zijlstra
2019-03-08 15:01             ` Josh Poimboeuf
2019-03-08 15:07               ` Peter Zijlstra
2019-03-07 20:23           ` Peter Zijlstra
2019-03-07 20:40             ` Peter Zijlstra
2019-03-08 15:07               ` Josh Poimboeuf
2019-03-08 15:23                 ` Peter Zijlstra
2019-03-07 20:15       ` Andrey Ryabinin
2019-03-07 20:33         ` Peter Zijlstra
2019-03-07 20:40           ` Andrey Ryabinin
2019-03-07 20:42           ` Peter Zijlstra
2019-03-08 21:02   ` Josh Poimboeuf
2019-03-08 21:31     ` Peter Zijlstra
2019-03-08 21:54       ` Josh Poimboeuf
2019-03-10 13:10     ` Peter Zijlstra
2019-03-11 18:01       ` Josh Poimboeuf
2019-03-07 11:45 ` [PATCH 19/20] objtool: uaccess PUSHF/POPF support Peter Zijlstra
2019-03-08 21:11   ` Josh Poimboeuf
2019-03-10 13:12     ` Peter Zijlstra
2019-03-07 11:45 ` [PATCH 20/20] objtool: Add Direction Flag validation Peter Zijlstra
2019-03-08 21:16   ` Josh Poimboeuf
2019-03-08 21:33     ` Peter Zijlstra
2019-03-08 21:56       ` Josh Poimboeuf
2019-03-10 13:13         ` Peter Zijlstra
2019-03-11 18:00           ` Josh Poimboeuf
2019-03-07 12:03 ` [PATCH 00/20] objtool: UACCESS validation v3 Peter Zijlstra
2019-03-07 12:55   ` Peter Zijlstra
2019-03-07 13:13     ` Peter Zijlstra
2019-03-07 16:47       ` Josh Poimboeuf
2019-03-07 16:50         ` Josh Poimboeuf
2019-03-07 17:00         ` Linus Torvalds
2019-03-07 17:17           ` Josh Poimboeuf
2019-03-07 17:38             ` Peter Zijlstra
2019-03-07 17:45               ` Linus Torvalds
2019-03-07 18:18                 ` Steven Rostedt
2019-03-10 13:16                   ` Peter Zijlstra
2019-04-19 10:08                     ` [PATCH] compiler.h, tracing: Remove CONFIG_PROFILE_ALL_BRANCHES Ingo Molnar
2019-04-19 13:04                       ` Steven Rostedt
2019-03-07 17:04         ` [PATCH 00/20] objtool: UACCESS validation v3 hpa
2019-03-07 17:18           ` Josh Poimboeuf
2019-03-07 17:29             ` hpa
2019-03-07 17:45               ` Josh Poimboeuf
2019-03-07 17:48                 ` Linus Torvalds
2019-03-07 17:43         ` Peter Zijlstra
2019-03-07 17:48           ` Josh Poimboeuf
2019-04-03  8:21             ` [tip:core/objtool] tracing: Improve "if" macro code generation tip-bot for Josh Poimboeuf
2019-03-07 16:31   ` [PATCH 00/20] objtool: UACCESS validation v3 Linus Torvalds
2019-03-07 17:14 ` hpa

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).