Re: [PATCH v2 5/7] x86: plumb error code and fault address through to fault handlers

2018-08-27 Thread Jann Horn
On Mon, Aug 27, 2018 at 9:09 PM Andy Lutomirski  wrote:
>
> On Mon, Aug 27, 2018 at 11:56 AM, Jann Horn  wrote:
> > This is preparation for looking at trap number and fault address in the
> > handlers for uaccess errors.
> > This patch should not change any behavior.
>
> Confused.  $SUBJECT says you're plumbing the error code through, and
> you are sort of doing it:
>
> > -int fixup_exception(struct pt_regs *regs, int trapnr)
> > +int fixup_exception(struct pt_regs *regs, int trapnr, unsigned long 
> > error_code,
> > +   unsigned long fault_addr)
> >  {
>
> It's available here...
>
> > const struct exception_table_entry *e;
> > ex_handler_t handler;
> > @@ -202,7 +212,7 @@ int fixup_exception(struct pt_regs *regs, int trapnr)
> > return 0;
> >
> > handler = ex_fixup_handler(e);
> > -   return handler(e, regs, trapnr);
> > +   return handler(e, regs, trapnr, fault_addr);
>
> ... but you don't pass it into the handlers.  Is this intentional?

Whoops. No, that's not intentional. I'll fix it up for the next version.


Re: [PATCH v2 5/7] x86: plumb error code and fault address through to fault handlers

2018-08-27 Thread Jann Horn
On Mon, Aug 27, 2018 at 9:09 PM Andy Lutomirski  wrote:
>
> On Mon, Aug 27, 2018 at 11:56 AM, Jann Horn  wrote:
> > This is preparation for looking at trap number and fault address in the
> > handlers for uaccess errors.
> > This patch should not change any behavior.
>
> Confused.  $SUBJECT says you're plumbing the error code through, and
> you are sort of doing it:
>
> > -int fixup_exception(struct pt_regs *regs, int trapnr)
> > +int fixup_exception(struct pt_regs *regs, int trapnr, unsigned long 
> > error_code,
> > +   unsigned long fault_addr)
> >  {
>
> It's available here...
>
> > const struct exception_table_entry *e;
> > ex_handler_t handler;
> > @@ -202,7 +212,7 @@ int fixup_exception(struct pt_regs *regs, int trapnr)
> > return 0;
> >
> > handler = ex_fixup_handler(e);
> > -   return handler(e, regs, trapnr);
> > +   return handler(e, regs, trapnr, fault_addr);
>
> ... but you don't pass it into the handlers.  Is this intentional?

Whoops. No, that's not intentional. I'll fix it up for the next version.


Re: [PATCH v2 5/7] x86: plumb error code and fault address through to fault handlers

2018-08-27 Thread Andy Lutomirski
On Mon, Aug 27, 2018 at 11:56 AM, Jann Horn  wrote:
> This is preparation for looking at trap number and fault address in the
> handlers for uaccess errors.
> This patch should not change any behavior.

Confused.  $SUBJECT says you're plumbing the error code through, and
you are sort of doing it:

> -int fixup_exception(struct pt_regs *regs, int trapnr)
> +int fixup_exception(struct pt_regs *regs, int trapnr, unsigned long 
> error_code,
> +   unsigned long fault_addr)
>  {

It's available here...

> const struct exception_table_entry *e;
> ex_handler_t handler;
> @@ -202,7 +212,7 @@ int fixup_exception(struct pt_regs *regs, int trapnr)
> return 0;
>
> handler = ex_fixup_handler(e);
> -   return handler(e, regs, trapnr);
> +   return handler(e, regs, trapnr, fault_addr);

... but you don't pass it into the handlers.  Is this intentional?


Re: [PATCH v2 5/7] x86: plumb error code and fault address through to fault handlers

2018-08-27 Thread Andy Lutomirski
On Mon, Aug 27, 2018 at 11:56 AM, Jann Horn  wrote:
> This is preparation for looking at trap number and fault address in the
> handlers for uaccess errors.
> This patch should not change any behavior.

Confused.  $SUBJECT says you're plumbing the error code through, and
you are sort of doing it:

> -int fixup_exception(struct pt_regs *regs, int trapnr)
> +int fixup_exception(struct pt_regs *regs, int trapnr, unsigned long 
> error_code,
> +   unsigned long fault_addr)
>  {

It's available here...

> const struct exception_table_entry *e;
> ex_handler_t handler;
> @@ -202,7 +212,7 @@ int fixup_exception(struct pt_regs *regs, int trapnr)
> return 0;
>
> handler = ex_fixup_handler(e);
> -   return handler(e, regs, trapnr);
> +   return handler(e, regs, trapnr, fault_addr);

... but you don't pass it into the handlers.  Is this intentional?