Re: [RFC PATCH] x86/mm/fault: Allow stack access below %rsp

2018-11-05 Thread Andy Lutomirski
On Mon, Nov 5, 2018 at 9:20 AM Dave Hansen wrote: > > > On 11/4/18 9:14 PM, Andy Lutomirski wrote: > > I should add: if this patch is *not* applied, then I think we'll > > need to replace the sw_error_code check with user_mode(regs) to avoid > > an info leak if CET is enabled. Because, with CET,

Re: [RFC PATCH] x86/mm/fault: Allow stack access below %rsp

2018-11-05 Thread Andy Lutomirski
On Mon, Nov 5, 2018 at 9:20 AM Dave Hansen wrote: > > > On 11/4/18 9:14 PM, Andy Lutomirski wrote: > > I should add: if this patch is *not* applied, then I think we'll > > need to replace the sw_error_code check with user_mode(regs) to avoid > > an info leak if CET is enabled. Because, with CET,

Re: [RFC PATCH] x86/mm/fault: Allow stack access below %rsp

2018-11-05 Thread Dave Hansen
On 11/5/18 8:27 AM, Waiman Long wrote: > So gcc had changed to avoid doing that, but my main concern are old > binaries that were compiled with old gcc. Yeah, fair enough. FWIW, I don't have any strong feelings about this patch either way, but supporting old binaries/compilers without crashing

Re: [RFC PATCH] x86/mm/fault: Allow stack access below %rsp

2018-11-05 Thread Dave Hansen
On 11/5/18 8:27 AM, Waiman Long wrote: > So gcc had changed to avoid doing that, but my main concern are old > binaries that were compiled with old gcc. Yeah, fair enough. FWIW, I don't have any strong feelings about this patch either way, but supporting old binaries/compilers without crashing

Re: [RFC PATCH] x86/mm/fault: Allow stack access below %rsp

2018-11-05 Thread Dave Hansen
On 11/4/18 9:14 PM, Andy Lutomirski wrote: > I should add: if this patch is *not* applied, then I think we'll > need to replace the sw_error_code check with user_mode(regs) to avoid > an info leak if CET is enabled. Because, with CET, WRUSS will allow > a *kernel* mode access (where regs->sp is

Re: [RFC PATCH] x86/mm/fault: Allow stack access below %rsp

2018-11-05 Thread Dave Hansen
On 11/4/18 9:14 PM, Andy Lutomirski wrote: > I should add: if this patch is *not* applied, then I think we'll > need to replace the sw_error_code check with user_mode(regs) to avoid > an info leak if CET is enabled. Because, with CET, WRUSS will allow > a *kernel* mode access (where regs->sp is

Re: [RFC PATCH] x86/mm/fault: Allow stack access below %rsp

2018-11-05 Thread Waiman Long
On 11/02/2018 06:28 PM, Dave Hansen wrote: > On 11/2/18 12:50 PM, Waiman Long wrote: >> On 11/02/2018 03:44 PM, Dave Hansen wrote: >>> On 11/2/18 12:40 PM, Waiman Long wrote: The 64k+ limit check is kind of arbitrary. So the check is now removed to just let expand_stack() decide if a

Re: [RFC PATCH] x86/mm/fault: Allow stack access below %rsp

2018-11-05 Thread Waiman Long
On 11/02/2018 06:28 PM, Dave Hansen wrote: > On 11/2/18 12:50 PM, Waiman Long wrote: >> On 11/02/2018 03:44 PM, Dave Hansen wrote: >>> On 11/2/18 12:40 PM, Waiman Long wrote: The 64k+ limit check is kind of arbitrary. So the check is now removed to just let expand_stack() decide if a

Re: [RFC PATCH] x86/mm/fault: Allow stack access below %rsp

2018-11-04 Thread Andy Lutomirski
On Sun, Nov 4, 2018 at 9:11 PM Andy Lutomirski wrote: > > On Fri, Nov 2, 2018 at 3:28 PM Dave Hansen wrote: > > > > On 11/2/18 12:50 PM, Waiman Long wrote: > > > On 11/02/2018 03:44 PM, Dave Hansen wrote: > > >> On 11/2/18 12:40 PM, Waiman Long wrote: > > >>> The 64k+ limit check is kind of

Re: [RFC PATCH] x86/mm/fault: Allow stack access below %rsp

2018-11-04 Thread Andy Lutomirski
On Sun, Nov 4, 2018 at 9:11 PM Andy Lutomirski wrote: > > On Fri, Nov 2, 2018 at 3:28 PM Dave Hansen wrote: > > > > On 11/2/18 12:50 PM, Waiman Long wrote: > > > On 11/02/2018 03:44 PM, Dave Hansen wrote: > > >> On 11/2/18 12:40 PM, Waiman Long wrote: > > >>> The 64k+ limit check is kind of

Re: [RFC PATCH] x86/mm/fault: Allow stack access below %rsp

2018-11-04 Thread Andy Lutomirski
On Fri, Nov 2, 2018 at 3:28 PM Dave Hansen wrote: > > On 11/2/18 12:50 PM, Waiman Long wrote: > > On 11/02/2018 03:44 PM, Dave Hansen wrote: > >> On 11/2/18 12:40 PM, Waiman Long wrote: > >>> The 64k+ limit check is kind of arbitrary. So the check is now removed > >>> to just let expand_stack()

Re: [RFC PATCH] x86/mm/fault: Allow stack access below %rsp

2018-11-04 Thread Andy Lutomirski
On Fri, Nov 2, 2018 at 3:28 PM Dave Hansen wrote: > > On 11/2/18 12:50 PM, Waiman Long wrote: > > On 11/02/2018 03:44 PM, Dave Hansen wrote: > >> On 11/2/18 12:40 PM, Waiman Long wrote: > >>> The 64k+ limit check is kind of arbitrary. So the check is now removed > >>> to just let expand_stack()

Re: [RFC PATCH] x86/mm/fault: Allow stack access below %rsp

2018-11-02 Thread Dave Hansen
On 11/2/18 12:50 PM, Waiman Long wrote: > On 11/02/2018 03:44 PM, Dave Hansen wrote: >> On 11/2/18 12:40 PM, Waiman Long wrote: >>> The 64k+ limit check is kind of arbitrary. So the check is now removed >>> to just let expand_stack() decide if a segmentation fault should happen. >> With the 64k

Re: [RFC PATCH] x86/mm/fault: Allow stack access below %rsp

2018-11-02 Thread Dave Hansen
On 11/2/18 12:50 PM, Waiman Long wrote: > On 11/02/2018 03:44 PM, Dave Hansen wrote: >> On 11/2/18 12:40 PM, Waiman Long wrote: >>> The 64k+ limit check is kind of arbitrary. So the check is now removed >>> to just let expand_stack() decide if a segmentation fault should happen. >> With the 64k

Re: [RFC PATCH] x86/mm/fault: Allow stack access below %rsp

2018-11-02 Thread Waiman Long
On 11/02/2018 04:11 PM, Andy Lutomirski wrote: > On Fri, Nov 2, 2018 at 12:50 PM Waiman Long wrote: >> On 11/02/2018 03:44 PM, Dave Hansen wrote: >>> On 11/2/18 12:40 PM, Waiman Long wrote: The 64k+ limit check is kind of arbitrary. So the check is now removed to just let expand_stack()

Re: [RFC PATCH] x86/mm/fault: Allow stack access below %rsp

2018-11-02 Thread Waiman Long
On 11/02/2018 04:11 PM, Andy Lutomirski wrote: > On Fri, Nov 2, 2018 at 12:50 PM Waiman Long wrote: >> On 11/02/2018 03:44 PM, Dave Hansen wrote: >>> On 11/2/18 12:40 PM, Waiman Long wrote: The 64k+ limit check is kind of arbitrary. So the check is now removed to just let expand_stack()

Re: [RFC PATCH] x86/mm/fault: Allow stack access below %rsp

2018-11-02 Thread Andy Lutomirski
On Fri, Nov 2, 2018 at 12:50 PM Waiman Long wrote: > > On 11/02/2018 03:44 PM, Dave Hansen wrote: > > On 11/2/18 12:40 PM, Waiman Long wrote: > >> The 64k+ limit check is kind of arbitrary. So the check is now removed > >> to just let expand_stack() decide if a segmentation fault should happen. >

Re: [RFC PATCH] x86/mm/fault: Allow stack access below %rsp

2018-11-02 Thread Andy Lutomirski
On Fri, Nov 2, 2018 at 12:50 PM Waiman Long wrote: > > On 11/02/2018 03:44 PM, Dave Hansen wrote: > > On 11/2/18 12:40 PM, Waiman Long wrote: > >> The 64k+ limit check is kind of arbitrary. So the check is now removed > >> to just let expand_stack() decide if a segmentation fault should happen. >

Re: [RFC PATCH] x86/mm/fault: Allow stack access below %rsp

2018-11-02 Thread Waiman Long
On 11/02/2018 03:44 PM, Dave Hansen wrote: > On 11/2/18 12:40 PM, Waiman Long wrote: >> The 64k+ limit check is kind of arbitrary. So the check is now removed >> to just let expand_stack() decide if a segmentation fault should happen. > With the 64k check removed, what's the next limit that we

Re: [RFC PATCH] x86/mm/fault: Allow stack access below %rsp

2018-11-02 Thread Waiman Long
On 11/02/2018 03:44 PM, Dave Hansen wrote: > On 11/2/18 12:40 PM, Waiman Long wrote: >> The 64k+ limit check is kind of arbitrary. So the check is now removed >> to just let expand_stack() decide if a segmentation fault should happen. > With the 64k check removed, what's the next limit that we

Re: [RFC PATCH] x86/mm/fault: Allow stack access below %rsp

2018-11-02 Thread Dave Hansen
On 11/2/18 12:40 PM, Waiman Long wrote: > The 64k+ limit check is kind of arbitrary. So the check is now removed > to just let expand_stack() decide if a segmentation fault should happen. With the 64k check removed, what's the next limit that we bump into? Is it just the stack_guard_gap space

Re: [RFC PATCH] x86/mm/fault: Allow stack access below %rsp

2018-11-02 Thread Dave Hansen
On 11/2/18 12:40 PM, Waiman Long wrote: > The 64k+ limit check is kind of arbitrary. So the check is now removed > to just let expand_stack() decide if a segmentation fault should happen. With the 64k check removed, what's the next limit that we bump into? Is it just the stack_guard_gap space

[RFC PATCH] x86/mm/fault: Allow stack access below %rsp

2018-11-02 Thread Waiman Long
The current x86 page fault handler allows stack access below the stack pointer if it is no more than 64k+256 bytes. Any access beyond the 64k+ limit will cause a segmentation fault. The gcc -fstack-check option generates code to probe the stack for large stack allocation to see if the stack is

[RFC PATCH] x86/mm/fault: Allow stack access below %rsp

2018-11-02 Thread Waiman Long
The current x86 page fault handler allows stack access below the stack pointer if it is no more than 64k+256 bytes. Any access beyond the 64k+ limit will cause a segmentation fault. The gcc -fstack-check option generates code to probe the stack for large stack allocation to see if the stack is