Re: Quick question

jburrell@crl5.crl.com
Wed, 6 Aug 1997 13:15:36 -0500 (CDT)


> My question is: Why no 'Segmentation Fault' message? It just silently
> dies. I called the program hlp2html so I suppose it does a decent job of
> figuring it out. The message following mine about 'cp' causing them is
> more interesting.
>
> -George
>
> ps - 2.1.42 since I forgot to mention.

I have no clue at all. That's a very good question. Here's a snipet of code
from arch/i386/fault.c:

bad_area:
up(&mm->mmap_sem);

/* User mode accesses just cause a SIGSEGV */
if (error_code & 4) {
tsk->tss.cr2 = address;
tsk->tss.error_code = error_code;
tsk->tss.trap_no = 14;
force_sig(SIGSEGV, tsk);
goto out;
}

/* Are we prepared to handle this kernel fault? */
if ((fixup = search_exception_table(regs->eip)) != 0) {
printk(KERN_DEBUG "%s: Exception at [<%lx>] (%lx)\n",
tsk->comm,
regs->eip,
fixup);
regs->eip = fixup;
goto out;
}

I don't quite know the answer. It looks like only kernel faults send the
KERN_DEBUG "Exception" spam out to the syslog. It also "fixes" it somehow.
It seems that what it's doing is doing some run-time modification of the
execution path to skip over the invalid instruction.

I apparently understand the fault mechanism properly, but don't understand
exactly why it behaves like it does. I think I've just stepped beyond my
knowledge. I'm sending a copy of this back to the kernel list in the hope
that some of the gurus can better answer this. I hope you don't mind.