[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20080425155444.GB9503@Krystal>
Date: Fri, 25 Apr 2008 11:54:44 -0400
From: Mathieu Desnoyers <mathieu.desnoyers@...ymtl.ca>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Ingo Molnar <mingo@...e.hu>, Jiri Slaby <jirislaby@...il.com>,
David Miller <davem@...emloft.net>, zdenek.kabelac@...il.com,
rjw@...k.pl, paulmck@...ux.vnet.ibm.com, akpm@...ux-foundation.org,
linux-ext4@...r.kernel.org, herbert@...dor.apana.org.au,
penberg@...helsinki.fi, clameter@....com,
linux-kernel@...r.kernel.org, Andi Kleen <andi@...stfloor.org>,
pageexec@...email.hu, "H. Peter Anvin" <hpa@...or.com>,
Jeremy Fitzhardinge <jeremy@...p.org>
Subject: Re: [PATCH 1/1] x86: fix text_poke
* Linus Torvalds (torvalds@...ux-foundation.org) wrote:
>
>
> On Fri, 25 Apr 2008, Ingo Molnar wrote:
> >
> > something like the patch below? (untested)
>
> No. That whole code sequence is total and utter crap. It needs to be
> rewritten.
>
> It first does a BUG_ON() if it's not naturally aligned (because that
> wouldn't be atomic), and then it has code for page crossing! What a TOTAL
> PIECE OF SH*T!
>
> Hint:
> - if it's naturally aligned, it couldn't be page crossing ANYWAY
> - and if it was a page-crosser, it sure as hell couldn't be atomic!
>
> The code is just crap, crap, crap. It needs to be rewritten from scratch.
> I'll have a patch soonish.
>
> Linus
Woooow, just a sec here. I removed the atomicity test _because_ there
happen to be a case where it's safe to do non-atomic instruction
modification. If we do :
1) replace the instruction first byte by a breakpoint, execute an
instruction bypass (see the immediate values patches for detail)
2) modify the instruction non-atomically
3) put back the original instruction first byte.
That's why I removed the BUG_ONs at the beginning of the function.
That's also why it's required to deal with page crossing.
Mathieu
--
Mathieu Desnoyers
Computer Engineering Ph.D. Student, Ecole Polytechnique de Montreal
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F BA06 3F25 A8FE 3BAE 9A68
--
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