Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset ae89656 in mainline


Ignore:
Timestamp:
2018-05-11T17:26:58Z (3 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master
Children:
7473807
Parents:
8a8771c
Message:

Provide an empty #DB handler

Userspace can trigger a #DB exception just after the SYSENTER
instruction by setting the TF in EFLAGS. The #DB exception will appear
to have originated in the kernel so we must not panic in that case.

Location:
kernel/arch/ia32
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/ia32/include/arch/interrupt.h

    r8a8771c rae89656  
    5151
    5252#define EXC_DE 0
     53#define EXC_DB 1
    5354#define EXC_NM 7
    5455#define EXC_SS 12
     
    7374
    7475#define VECTOR_DE                 (IVT_EXCBASE + EXC_DE)
     76#define VECTOR_DB                 (IVT_EXCBASE + EXC_DB)
    7577#define VECTOR_NM                 (IVT_EXCBASE + EXC_NM)
    7678#define VECTOR_SS                 (IVT_EXCBASE + EXC_SS)
  • kernel/arch/ia32/src/interrupt.c

    r8a8771c rae89656  
    112112}
    113113
     114static void db_exception(unsigned int n, istate_t *istate)
     115{
     116        /*
     117         * We need to provide at least an empty handler that does not panic
     118         * if the exception appears to come from the kernel because the
     119         * userspace can inject a kernel-level #DB after e.g. the SYSENTER
     120         * instruction if the EFLAGS.TF is set.
     121         */
     122}
     123
    114124/** General Protection Fault. */
    115125static void gp_fault(unsigned int n __attribute__((unused)), istate_t *istate)
     
    231241
    232242        exc_register(VECTOR_DE, "de_fault", true, (iroutine_t) de_fault);
     243        exc_register(VECTOR_DB, "db_exc", true, (iroutine_t) db_exception);
    233244        exc_register(VECTOR_NM, "nm_fault", true, (iroutine_t) nm_fault);
    234245        exc_register(VECTOR_SS, "ss_fault", true, (iroutine_t) ss_fault);
Note: See TracChangeset for help on using the changeset viewer.