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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Sat, 18 Jul 2015 10:57:14 -0500
From:	Josh Poimboeuf <jpoimboe@...hat.com>
To:	Borislav Petkov <bp@...en8.de>
Cc:	Thomas Gleixner <tglx@...utronix.de>,
	Ingo Molnar <mingo@...hat.com>,
	"H. Peter Anvin" <hpa@...or.com>, Michal Marek <mmarek@...e.cz>,
	Peter Zijlstra <peterz@...radead.org>,
	Andy Lutomirski <luto@...nel.org>,
	Linus Torvalds <torvalds@...ux-foundation.org>,
	Andi Kleen <andi@...stfloor.org>,
	Pedro Alves <palves@...hat.com>, x86@...nel.org,
	live-patching@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [RFC PATCH 04/21] x86/hweight: Add stack frame dependency for
 __arch_hweight*()

On Sat, Jul 18, 2015 at 04:56:29PM +0200, Borislav Petkov wrote:
> On Sat, Jul 18, 2015 at 08:44:15AM -0500, Josh Poimboeuf wrote:
> > Ok, so would you rather adding a whitelist to tell stackvalidate to
> > ignore it?  Something like this?
> 
> I tried it and maybe I'm missing something but that doesn't work:
> 
> $ make drivers/gpu/drm/i915/intel_ringbuffer.o
>   CHK     include/config/kernel.release
>   CHK     include/generated/uapi/linux/version.h
>   CHK     include/generated/utsrelease.h
>   CHK     include/generated/timeconst.h
>   CHK     include/generated/bounds.h
>   CHK     include/generated/asm-offsets.h
>   CALL    scripts/checksyscalls.sh
>   CC      drivers/gpu/drm/i915/intel_ringbuffer.o
> ./arch/x86/include/asm/arch_hweight.h: Assembler messages:
> ./arch/x86/include/asm/arch_hweight.h:31: Error: symbol `.Ltemp32' is already defined
> ./arch/x86/include/asm/arch_hweight.h:31: Error: symbol `.Ltemp32' is already defined
> ./arch/x86/include/asm/arch_hweight.h:31: Error: symbol `.Ltemp32' is already defined
> scripts/Makefile.build:258: recipe for target 'drivers/gpu/drm/i915/intel_ringbuffer.o' failed
> make[1]: *** [drivers/gpu/drm/i915/intel_ringbuffer.o] Error 1
> Makefile:1528: recipe for target 'drivers/gpu/drm/i915/intel_ringbuffer.o' failed
> make: *** [drivers/gpu/drm/i915/intel_ringbuffer.o] Error 2

Yeah, it doesn't actually support this particular example yet.  I was
just trying to figure out if that's what you were proposing.

> Also, that label temp32 could be more descriptive.

Yeah, that's from:

  ".Ltemp" __stringify(__LINE__) ":;"

Which was intended to give a unique ID for each use of the macro, but
apparently that didn't work as planned here.

> so you see that a CALL instruction gets replaced with a POPCNT and
> the feature bit used is 4*32+23 which is X86_FEATURE_POPCNT. This
> information is enough to detect that particular case and add the offset
> ".long 661b - ." to the list of instructions which stackvalidate should
> ignore.

Currently, when stackvalidate sees an ALTERNATIVE, it assumes that
either code path is possible, so it follows both paths in parallel.

If I understand right, you're proposing that stackvalidate should only
follow the POPCNT path and never follow the !POPCNT path?

> Anyway, this is what I'd do.
> 
> IMNSVHO, we must be very conservative and not add some
> markers/helpers/etc to code only so that tools can do their job. Not if
> it can be helped. Instead, tools should do the hard work and we should
> keep kernel code clean.

In general, I agree, and I like the original patch much better.  IMO, it
achieved the goal of keeping the kernel code clean, while fixing the
frame pointer bug.

If you insist on breaking stack traces on !POPCNT, I can probably add
some intelligence to stackvalidate to look for !POPCNT and ignore it.
It seems less "clean" to me, though.

-- 
Josh
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ