Re: Programmed Exception Handling

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello...

Allow me to share my thoughts...

On Jan 25, 2008 10:22 AM, Anant Narayanan <anant@xxxxxx> wrote:
> Good day,
>
> I'm trying to implement a binary format loader for a foreign
> executable format, and have a few questions regarding the same:
>
> 1) The executable format is static, and thus, there's no dynamic/
> shared library loading involved. Is it ok to leave `load_shlib' of
> `linux_binfmt' unimplemented?

Possibly.

> 2) During execution of the foreign executable, system calls are
> notified via an interrupt (or programmed exception in intel
> terminology)  - 0x64. This is different from the interrupt raised by
> linux for system calls - 0x80. Thus, I'd like to be able to intercept
> these interrupts and handle them gracefully (eg: call a real linux
> system call via INT 0x80 instead).
How about this: int 0x64, AFAIK, won't be accessible from user mode,
thus..ehm, it should cause ... GPF? anyway, that should call specific
signal handler. IMHO, feed a custom signal handler for your binary
that catch this fault. Access the stack frame(s) and registers to find
out the parameter passed to int 0x64. Then,  do the equivalent with
int x80 or by jumping to vsyscall page. Just beware of reentrancy
issues.

Checking emulator like qemu user mode translator could give you further ideas.


>
> 3) Is there a method by which the kernel manages allocation of
> programmed exceptions? What happens when another module which also
> wants to intercept INT 0x64 is loaded?
if you pick my idea above, maybe you don't need to plant modify IDT
entry at all.

regards,

Mulyadi.

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux