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] [day] [month] [year] [list]
Message-ID: <Pine.LNX.4.64.0701111918480.787@scrub.home>
Date:	Mon, 15 Jan 2007 13:09:03 +0100 (CET)
From:	Roman Zippel <zippel@...ux-m68k.org>
To:	Linus Torvalds <torvalds@...l.org>
cc:	Geert Uytterhoeven <geert@...ux-m68k.org>,
	Peter Zijlstra <a.p.zijlstra@...llo.nl>,
	Andrew Morton <akpm@...l.org>,
	Al Viro <viro@...iv.linux.org.uk>,
	Linux Kernel Development <linux-kernel@...r.kernel.org>,
	Linux/m68k <linux-m68k@...r.kernel.org>
Subject: Re: [PATCH] mm: pagefault_{disable,enable}()

Hi,

On Wed, 10 Jan 2007, Linus Torvalds wrote:

> > > I think your "current_thread_info()" is broken.

No, it's not. What is broken are our header dependencies - we happily mix 
declarations with implementations.
Let's take a simple example like <linux/list.h>, which is practically 
included everywhere, but even that already includes 57 other files and 
depends on 49 config symbols (by comparison for <linux/types.h> it's 7 
other files and 7 symbols).

> > But struct task_struct is defined in <linux/sched.h>, which cannot be included
> > in <asm/thread_info.h> due to include recursion hell.
> 
> But why do you need "struct task_struct" at all?
> 
> The reason this doesn't happen on other platforms is that they don't use 
> "struct task_struct". They use "struct thread_info", which is where the 
> preemption counter is.
> 
> The problem on m68k i sthat broken indirection through "current", which is 
> unnecessary. Isn't the thread structure on the stack on m68k too? So you 
> could do what x86 does, and just do
> 
> 	movel %a7,%d0
> 	andl $STACK_MASK,%d0

That's exactly want I want to avoid, thread info and task struct can be 
accessed via a single register (pointer).

> Or, if worst comes to worst, you can just hardcode the offset of the 
> thread-info pointer in the "struct task_struct". It's the second word 
> after "state". Ugly, but less so than forcing everybody who does NOT want 
> to have that big <linux/sched.h> dependency to get it.

That still generates worse code, the best solution would be to leave the 
work to gcc, but that requires it can actually recognize that task struct 
and thread info need only a single pointer.
One possibility would be to do something like ia64 and abuse 
asm-offsets.h, but then one gets other funny build problems.

By far the cleanest solution would be to clean up our damned header 
dependencies, separating task_struct from sched.h is not that difficult 
and would give archs far more flexibility how to place task struct and 
thread info.

bye, Roman
-
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