This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Need help for system calls


Hello,

I will try to explain my problem through some stack-traceback examples

The code is something as follows
main() ----> calls func1() ----> calls func2() ----> calls nanosleep()

When I enter func2() from func1() the arguments passed to func2 + (its
local stack)
is proper. Once the control enters nanosleep() and if at that point (i.e
when the process
is still in the nanosleep() context) I send a signal to the process, the
following thing is 
observed (same is observed in case I attach gdb to the process while the
context is
still in nanosleep()).

The stack of func2() gets overloaded with the contents of func1() and
there is no way to
check what were the contents of func2()'s stack. (It is always the
previous function's (in 
the call-stack) stack that gets overloaded).

But, it is also observed that when the control comes out of nanosleep()
(i.e the register
contents get restored properly) and we can retrieve contents of
func2()'s stack properly.

There are certain system calls like ioctl(), select(), recvfrom(),
nanosleep() that can 
cause a hang() (i.e not return from kernel due to some bug in our
user/kernel space
code), and I wanted some way by which we can prevent this stack
overloading/overwriting.

Any help on the above mentioned points will be extremely useful.


Thanks,
Partha
x3025


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]