[lkml]   [2006]   [Feb]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    Patch in this message
    Subjecttrap int3 problem while porting a user space application and small cleanup patch

    For a while I've been working on a little tool called mpt-status to be
    able to monitor LSI based controllers. The source can be found here:

    The issue I'm trying to track down now is why I cannot get it to work on
    a x86_64 kernel (Sun Fire V20z with AMD Opteron(tm) Processor 252 on
    SLES 9 PL3). I suspect 32/64 bit issues between in my ioctl message
    passing between user space and kernel space. Unfortunately when I strace
    the kernel spits out tons of following entries:

    mpt-status[16045] trap int3 rip:400acf rsp:7fbfff70b0 error:0
    mpt-status[16045] trap int3 rip:4008f1 rsp:7fbfff70a8 error:0
    mpt-status[16045] trap int3 rip:400b86 rsp:7fbfff70b0 error:0

    I can only remotely guess what happened because I'm not sound on x64
    trap handling, so my question is: How can I best debug and address this
    issue in my tool?

    I'm pretty sure it has something to do with me including kernel headers
    in a user space tool, but noone has done the sanitizing for the LSI
    related headers residing in drivers/message/fusion. It works on all
    32-bit machines I've tested so far.

    Attached is a small code style cleanup patch that resulted from my
    skimming through the arch/x86_64/kernel/traps.c code to figure out what
    went haywire. If Andi is ok with it, please consider applying.

    Signed-off-by: Roberto Nibali <>

    Best regards,
    Roberto Nibali, ratz
    '[q]sa[ln0=aln256%Pln256/snlbx]sb3135071790101768542287578439snlbxq' | dc
    diff --git a/arch/x86_64/kernel/traps.c b/arch/x86_64/kernel/traps.c
    index ee1b2da..3442a56 100644
    --- a/arch/x86_64/kernel/traps.c
    +++ b/arch/x86_64/kernel/traps.c
    @@ -108,7 +108,7 @@ int printk_address(unsigned long address
    if (!modname)
    modname = delim = "";
    return printk("<%016lx>{%s%s%s%s%+ld}",
    - address,delim,modname,delim,symname,offset);
    + address, delim, modname, delim, symname, offset);
    int printk_address(unsigned long address)
    @@ -320,13 +320,12 @@ void show_registers(struct pt_regs *regs
    show_stack(NULL, (unsigned long*)rsp);

    printk("\nCode: ");
    - if(regs->rip < PAGE_OFFSET)
    + if (regs->rip < PAGE_OFFSET)
    goto bad;

    - for(i=0;i<20;i++)
    - {
    + for (i=0; i<20; i++) {
    unsigned char c;
    - if(__get_user(c, &((unsigned char*)regs->rip)[i])) {
    + if (__get_user(c, &((unsigned char*)regs->rip)[i])) {
    printk(" Bad RIP value.");
    @@ -465,7 +464,7 @@ static void __kprobes do_trap(int trapnr
    "%s[%d] trap %s rip:%lx rsp:%lx error:%lx\n",
    tsk->comm, tsk->pid, str,
    - regs->rip,regs->rsp,error_code);
    + regs->rip, regs->rsp, error_code);

    if (info)
    force_sig_info(signr, info, tsk);
    @@ -479,9 +478,9 @@ static void __kprobes do_trap(int trapnr
    const struct exception_table_entry *fixup;
    fixup = search_exception_tables(regs->rip);
    - if (fixup) {
    + if (fixup)
    regs->rip = fixup->fixup;
    - } else
    + else
    die(str, regs, error_code);
    @@ -554,7 +553,7 @@ asmlinkage void __kprobes do_general_pro
    "%s[%d] general protection rip:%lx rsp:%lx error:%lx\n",
    tsk->comm, tsk->pid,
    - regs->rip,regs->rsp,error_code);
    + regs->rip, regs->rsp, error_code);

    force_sig(SIGSEGV, tsk);
     \ /
      Last update: 2006-02-12 18:11    [W:0.022 / U:118.968 seconds]
    ©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site