current_thread_info() - Linux

This is a discussion on current_thread_info() - Linux ; I was looking at include/linux/asm-i386/thread_info.h in the 2.6.17.4 kernel tree and noticed that the current thread info structure is kept at esp ANDed with 0xffffe000 Isn't that a bad idea, what if esp is decremented so much by pushing and ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: current_thread_info()

  1. current_thread_info()

    I was looking at include/linux/asm-i386/thread_info.h in the 2.6.17.4
    kernel tree and noticed that the current thread info structure is kept
    at esp ANDed with 0xffffe000
    Isn't that a bad idea, what if esp is decremented so much by pushing
    and popping that data in the thread info structure is corrupted ?


  2. Re: current_thread_info()

    ykstortionist@gmail.com wrote:
    > I was looking at include/linux/asm-i386/thread_info.h in the 2.6.17.4
    > kernel tree and noticed that the current thread info structure is kept
    > at esp ANDed with 0xffffe000
    > Isn't that a bad idea, what if esp is decremented so much by pushing
    > and popping that data in the thread info structure is corrupted ?


    Well, that would be bad. However, within the kernel, stack space is
    and always has been a limited resource. Kernel developers must be
    aware of this and act accordingly; you avoid recursion, don't allocate
    large buffers on the stack and so forth.

    GH


+ Reply to Thread