#How do I access the process' vector table in linux?

52 messages · Page 1 of 1 (latest)

jaunty inlet
#

It should be on some accessible memory address, 0x0 is not mapped in my process.
Can sigaction somehow reveal the raw address?

humble gyroBOT
#

When your question is answered use !solved to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question use !howto ask.

honest sapphire
#

Just to clarify, what do you mean by vector table?

jaunty inlet
honest sapphire
#

Oh that. I'm 99% sure that there is just the one interupt table for the CPU as a whole. An individual process doesn't have an interupt vector table

jaunty inlet
#

when I tried to run gdb and track divide by zero, instruction by instruction, I don't see any function calls to the handler

#

maybe userland processes can't see the magic

honest sapphire
#

That's because interupt handlers are run by the kernel in kernel mode. GDB wouldn't see what happens

jaunty inlet
#

in theory

honest sapphire
#

I mean, if you want to debug Linux itself... Maybe?
I'm not sure you can debug the kernel that is running the debugger though???
You might need to debug using a VM

jaunty inlet
#

and thus we can see, ohhhhhhhhhh, so that's why the interrupt handler refuses to run what it should

#

but my skill is too weak, I need to read thousands of pages of docs first, and maybe follow the linux-from-scratch guide

honest sapphire
#

I mean, at that point just build your own Linux :P

jaunty inlet
#

I will leave the thread open to see what others comment

potent flax
#

The IVT is kernelspace, not userspace. I think in DOS you could access the IVT.

#

The signal handler won't help you reverse engineer it back to kernelspace im afraid

#

I would be surprised if Linux has some kind of API that shows the IVT

#

But why not read the source of the kernel? Im not too sure what you are trying to do

jaunty inlet
jaunty inlet
potent flax
potent flax
jaunty inlet
#

if there are no visible pages, then gdb can't access anything

jaunty inlet
jaunty inlet
potent flax
jaunty inlet
jaunty inlet
#

the CPU raised a hardware exception, and eventually the OS decided to send SIGFPE to the process I have, gdb shows me the signal we received

honest sapphire
#

The division itself doesn't context switch, the division by zero causes an interupt, and all interrupts context switch

jaunty inlet
#

aaaaaaaaaaaaaaaaaa

#

oke

#

!solved

humble gyroBOT
#

Thank you and let us know if you have any more questions!

This thread is now set to auto-hide after an hour of inactivity

jaunty inlet
#

bye guys 👋

dark flint
#

fyi this is a video that talks a bit about what happens when an interrupt happens

ACE your next technical interview! Get 10% off when subscribing to Neetcode Pro: https://neetcode.io/core

Join CodeCrafters and learn by creating your own: INTERPRETER, Redis, Git, Http server, Interpreter, Grep... in your favorite programming language:
https://app.codecrafters.io/join?via=jdvillal

Sponsor my work on Github: https://github.com...

▶ Play video
#

this guy in general is pretty nice

#

power point guy

honest sapphire
#

I was also thinking of that video, XD

jaunty inlet
dark flint
jaunty inlet
#

and all interrupts run in priviledged mode, all the CPU instructions for hardware accessing are available

dark flint
jaunty inlet
#

once upon a time in old OS-es without system calls, we would run raw interrupts via the instruction int, all the time

dark flint
#

they interrupt the program by invoking the kernel to handle stuff

jaunty inlet
#

ye

jaunty inlet
dark flint