jcorbier
jcorbier

Reputation: 33

How can I know if a kernel buffer comes from the stack?

Is there any way to determine whether a buffer received as a void* pointer comes from the stack or has been allocated with any other mechansim (vmalloc, kmalloc, ...)?

In other words, is there any API or trick, similar to is_vmalloc_addr, to know if the buffer comes from the stack?

Upvotes: 2

Views: 233

Answers (1)

Ilya Matveychikov
Ilya Matveychikov

Reputation: 4024

See object_is_on_stack() at include/linux/sched.h. Hope this helps.

Upvotes: 1

Related Questions