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]
Date:	Mon, 11 May 2009 15:52:56 -0700 (PDT)
From:	Linus Torvalds <torvalds@...ux-foundation.org>
To:	Ingo Molnar <mingo@...e.hu>
cc:	Masami Hiramatsu <mhiramat@...hat.com>,
	LKML <linux-kernel@...r.kernel.org>,
	systemtap@...rces.redhat.com,
	Harvey Harrison <harvey.harrison@...il.com>,
	Thomas Gleixner <tglx@...utronix.de>,
	Jan Blunck <jblunck@...e.de>,
	Christoph Hellwig <hch@...radead.org>
Subject: Re: [PATCH -rc] [BUGFIX] x86: fix kernel_trap_sp()



On Tue, 12 May 2009, Ingo Molnar wrote:
> 
> yeah, this is cleaner and probably a tad faster.

Well, I don't care about the 'faster' part per se, but I could actually 
see some case where a kernel-only version did some pointer dereference 
that was invalid for the user version, and could oops, so putting it 
inside the code that explicitly tests that it's not user-or-vm seems like 
conceptually the right thing to do.

Of course, in this case it's the other way around - it's the non-kernel 
version that does a dereference, and it just so happens to be safe (but 
return an invalid pointer) when the trap was in kernel mode.  So the 
argument is pretty theoretical, but I think it's cleaner.

> One small detail:
> 
> > +	return (unsigned long)(&regs->sp);
> 
> the original commit had:
> 
> > +	return (unsigned long)&regs->sp;

Ok, that's just because I didn't actually apply the original patch, I 
just rewrote it entirely, and for some reason I put parenthesis around the 
expression. You're right that it doesn't matter, and either is fine.  I 
don't really care, I suspect I add the parenthesis just because I don't 
even want to have to think about the proper operator precedence rules.

So pick whichever version.

			Linus
--
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