• C
    [PATCH] i386: let usermode execute the "enter" instruction · 21528454
    Chuck Ebbert 提交于
    The i386 page fault handler does not allow enough slack when checking for
    userspace access below the current stack pointer.  This prevents use of the
    enter instruction by user code.  Fix this by allowing enough slack for
    "enter $65535,$31" to execute.
    
    Problem reported by Tomasz Malesinski <tmal@mimuw.edu.pl>
    
    Tested using this program, based on the original from Tomasz:
    
    	.file	"ovflow.S"
    	.version	"01.01"
    gcc2_compiled.:
    .section	.rodata
    .LC0:
    	.string	"asdf\n"
    .text
    	.align 4
    .globl main
    	.type	 main,@function
    main:
    nest_level=0
    .rept 30
    	enter $0,$nest_level
    nest_level=nest_level+1
    .endr
    	enter $65535,$30
    	enter $65535,$31
    	addl $-12,%esp
    	pushl $.LC0
    	call printf
    	addl $16,%esp
    .L2:
    .rept 32
    	leave
    .endr
    	ret
    .Lfe1:
    	.size	 main,.Lfe1-main
    	.ident	"GCC: (GNU) 2.95.4 20011002 (Debian prerelease)"
    Signed-off-by: NChuck Ebbert <76306.1226@compuserve.com>
    Cc: Andi Kleen <ak@muc.de>
    Signed-off-by: NAndrew Morton <akpm@osdl.org>
    Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
    21528454
fault.c 16.2 KB