lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <mp26sywwsgekejs7fvsjhym3zunh4y42z2mkw5txi37dolas3l@zup3ny7bceaw>
Date: Thu, 3 Apr 2025 11:24:28 -0700
From: Josh Poimboeuf <jpoimboe@...nel.org>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Ingo Molnar <mingo@...nel.org>, linux-kernel@...r.kernel.org, 
	Peter Zijlstra <a.p.zijlstra@...llo.nl>, Thomas Gleixner <tglx@...utronix.de>, 
	Borislav Petkov <bp@...en8.de>, Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [GIT PULL] objtool fixes

On Thu, Apr 03, 2025 at 09:06:11AM -0700, Linus Torvalds wrote:
> Josh, what's wrong with just disassembling the damn instruction?
> 
> It's what objtool does.
> 
> By all means add annotations for when the kernel does something
> *special*, and the annotation is "this violates the usual rules".
> Those kinds of annotations make perfect sense, and are a "don't
> complain about this, because I know I'm doing something odd".
> 
> So annotations for things like non-standard stack frames etc are a good thing.
> 
> But dammit, clac/stac is *not* that. Quite the reverse. clac/stac *is*
> the usual rule. clac/stac *is* the annotation.

There's also smap_save() / smap_restore().  For the latter we'd need to
look for alternatives with "push reg; popf", which is definitely not
SMAP-specific.  So we'd need to start reading feature bits again, which
ends up even worse than what we had before.

I still don't see what's wrong with something like this:

  # OBJTOOL (IGNORE_ALTERNATIVE)
  911: .pushsection .discard.annotate_insn,"M",@progbits,8; .long 911b - .; .long 6; .popsection

Now compare that with an alternative:

# ./arch/x86/include/asm/cpufeature.h:101: 	asm goto(ALTERNATIVE_TERNARY("jmp 6f", %c[feature], "", "jmp %l[t_no]")
#APP
# 101 "./arch/x86/include/asm/cpufeature.h" 1
	# ALT: oldinstr
771:
	# ALT: oldinstr
771:
	jmp 6f
772:
# ALT: padding
.skip -(((775f-774f)-(772b-771b)) > 0) * ((775f-774f)-(772b-771b)),0x90
773:
.pushsection .altinstructions,"a"
 .long 771b - .
 .long 774f - .
 .4byte ( 3*32+21)
 .byte 773b-771b
 .byte 775f-774f
.popsection
.pushsection .altinstr_replacement, "ax"
# ALT: replacement
774:
	jmp .L250	#
775:
.popsection

772:
# ALT: padding
.skip -(((775f-774f)-(772b-771b)) > 0) * ((775f-774f)-(772b-771b)),0x90
773:
.pushsection .altinstructions,"a"
 .long 771b - .
 .long 774f - .
 .4byte 516	#
 .byte 773b-771b
 .byte 775f-774f
.popsection
.pushsection .altinstr_replacement, "ax"
# ALT: replacement
774:
	
775:
.popsection
.pushsection .altinstr_aux,"ax"
6:
 testb $16, boot_cpu_data+112(%rip)	#,
 jnz .L249	#
 jmp .L250	#
.popsection

# 0 "" 2
#NO_APP

-- 
Josh

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ