sparc64: Fix sun4u execute bit check in TSB I-TLB load.
authorDavid S. Miller <davem@davemloft.net>
Fri, 19 Feb 2010 23:19:52 +0000 (15:19 -0800)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 15 Mar 2010 15:49:38 +0000 (08:49 -0700)
commit26e272a3c2670bfbf91c477c964fc14d3e6f9ed5
tree10902bbbb847d7dc7a09ddbe45a16a164c8d15c2
parentbbc9c131b1dec886899452819d0afd82c4e3c818
sparc64: Fix sun4u execute bit check in TSB I-TLB load.

[ Upstream commit 1f474646fdc36b457606bbcd6a3592e6cbd31ac4 ]

Thanks to testcase and report from Brad Spengler:

--------------------
#include <stdio.h>

typedef int (* _wee)(void);

int main(void)
{
        char buf[8] = { '\x81', '\xc7', '\xe0', '\x08', '\x81', '\xe8',
                        '\x00', '\x00' };
        _wee wee;
        printf("%p\n", &buf);
        wee = (_wee)&buf;
        wee();

        return 0;
}
--------------------

TSB I-tlb load code tries to use andcc to check the _PAGE_EXEC_4U bit,
but that's bit 12 so it gets sign extended all the way up to bit 63
and the test nearly always passes as a result.

Use sethi to fix the bug.

Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
arch/sparc/kernel/tsb.S