On Fri, Mar 03, 2017 at 01:11:21PM -0700, Theo de Raadt wrote:
> Completely agree.
> 

+1 , although I don't think we should be dropping to ddb. But that's a
different discussion.

> > Whan an amd64 machine gets an NMI, the current process in user land
> > is signalled with SIGBUS.  That does not make sense, the machine
> > should drop to ddb regardless wether a user process is currently
> > scheduled or not.  NMI signals hardware failure or a debugging
> > button.
> > 
> > The code in i386 has always been that way.
> > 
> > Then the switch in db_ktrap() should also not depend on the fact
> > wether kernel or user land was runing.
> > 
> > ok?
> > 
> > bluhm
> > 
> > Index: arch/amd64/amd64/db_interface.c
> > ===================================================================
> > RCS file: /data/mirror/openbsd/cvs/src/sys/arch/amd64/amd64/db_interface.c,v
> > retrieving revision 1.25
> > diff -u -p -r1.25 db_interface.c
> > --- arch/amd64/amd64/db_interface.c 14 Mar 2016 23:08:05 -0000      1.25
> > +++ arch/amd64/amd64/db_interface.c 3 Mar 2017 19:37:40 -0000
> > @@ -118,6 +118,7 @@ db_ktrap(int type, int code, db_regs_t *
> >     case T_BPTFLT:  /* breakpoint */
> >     case T_TRCTRAP: /* single_step */
> >     case T_NMI:     /* NMI */
> > +   case T_NMI|T_USER:
> >     case -1:        /* keyboard interrupt */
> >             break;
> >     default:
> > Index: arch/amd64/amd64/trap.c
> > ===================================================================
> > RCS file: /data/mirror/openbsd/cvs/src/sys/arch/amd64/amd64/trap.c,v
> > retrieving revision 1.52
> > diff -u -p -r1.52 trap.c
> > --- arch/amd64/amd64/trap.c 21 Jan 2017 05:42:03 -0000      1.52
> > +++ arch/amd64/amd64/trap.c 3 Mar 2017 19:37:40 -0000
> > @@ -242,7 +242,6 @@ copyfault:
> >     case T_TSSFLT|T_USER:
> >     case T_SEGNPFLT|T_USER:
> >     case T_STKFLT|T_USER:
> > -   case T_NMI|T_USER:
> >  #ifdef TRAP_SIGDEBUG
> >             printf("pid %d (%s): %s at rip %llx addr %llx\n",
> >                 p->p_p->ps_pid, p->p_p->ps_comm, "BUS",
> > @@ -425,8 +424,9 @@ faultcommon:
> >             KERNEL_UNLOCK();
> >             break;
> >  
> > -#if        NISA > 0
> > +#if NISA > 0
> >     case T_NMI:
> > +   case T_NMI|T_USER:
> >  #if defined(KGDB) || defined(DDB)
> >             /* NMI can be hooked up to a pushbutton for debugging */
> >             printf ("NMI ... going to debugger\n");
> > Index: arch/i386/i386/db_interface.c
> > ===================================================================
> > RCS file: /data/mirror/openbsd/cvs/src/sys/arch/i386/i386/db_interface.c,v
> > retrieving revision 1.33
> > diff -u -p -r1.33 db_interface.c
> > --- arch/i386/i386/db_interface.c   14 Mar 2016 23:08:05 -0000      1.33
> > +++ arch/i386/i386/db_interface.c   3 Mar 2017 19:37:40 -0000
> > @@ -113,6 +113,7 @@ db_ktrap(int type, int code, db_regs_t *
> >     case T_BPTFLT:  /* breakpoint */
> >     case T_TRCTRAP: /* single_step */
> >     case T_NMI:     /* NMI */
> > +   case T_NMI|T_USER:
> >     case -1:        /* keyboard interrupt */
> >             break;
> >     default:
> > Index: arch/i386/i386/trap.c
> > ===================================================================
> > RCS file: /data/mirror/openbsd/cvs/src/sys/arch/i386/i386/trap.c,v
> > retrieving revision 1.126
> > diff -u -p -r1.126 trap.c
> > --- arch/i386/i386/trap.c   8 Oct 2016 05:49:08 -0000       1.126
> > +++ arch/i386/i386/trap.c   3 Mar 2017 19:37:40 -0000
> > @@ -483,7 +483,7 @@ trap(struct trapframe *frame)
> >             KERNEL_UNLOCK();
> >             break;
> >  
> > -#if        NISA > 0
> > +#if NISA > 0
> >     case T_NMI:
> >     case T_NMI|T_USER:
> >  #if defined(DDB) || defined(KGDB)
> > 
> 

Reply via email to