That's pretty cool

On Mon, Sep 12, 2016, 12:13 Barret Rhoden <[email protected]> wrote:

> Say you want to print out some values, but you don't want to call
> printf - this can be for a variety of reasons, such as you're deep in
> glibc or otherwise in some delicate code.  You can call a bad syscall
> and get the kernel to print things out:
>
>         tcbhead_t *me = THREAD_SELF;
>         syscall(0, me, me->stack_guard, me->pointer_guard,
>                 me->gscope_flag);
>
> There is no syscall == 0 (SYS_null starts at 1, to catch bugs where 0
> gets passed in).  The kernel kindly prints out:
>
> [kernel] Invalid syscall 0 for proc 66
>         Args: 0x0000400000a13560, 0xff0a000000000000, 0xff0a000000000000,
> 0x0000000000000000, 0x0000000000000000, 0x00007f7fff9fece0
> SW TRAP frame (partial) at 0xffffffffc8bfc790 on core 10
>   rbx  0x00007f7fff9feaf0
>   rbp  0x00007f7fff9febe0
>   r12  0x0000000000000000
>   r13  0x0000000000000000
>   r14  0x0000000000000000
>   r15  0x0000000000000001
>   gsbs 0x0000000000000000
>   fsbs 0x0000000000000000
>   rip  0x000040000079c7fe
>   rsp  0x00007f7fff9fea10
>  mxcsr 0x00001fa0
>  fpucw 0x037f
>
>
> The args to the syscall are nicely printed out for you.  Don't pay too
> much attention to the SW TRAP frame.  That's the context that actually
> did the syscall(), which is a couple functions deep from where you
> wrote syscall().
>
> Barret
>
> --
> You received this message because you are subscribed to the Google Groups
> "Akaros" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Akaros" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to