Custom malloc/mmap for x86_64

Mike Frysinger
Sat Apr 28 19:51:00 GMT 2012

On Saturday 28 April 2012 15:08:13 Daniel wrote:
> I am writting a custom software stack for linux and adding new
> system calls to allow programmers to exploit my
> logic without interfering with anything else in the system.
> I am adding a custom mmap, which works if I use the
> system call with its NR id:
> #define my_map 312
> syscall(my_map, 1024*1024, 4096, 0, 0, 0, 0, 0);
> This executes dummy code for now, but I have gotten
> it to invoke calls at the kernel level.
> I am trying to add a call to my_map in glibc, I creted a c file
>  just like mmap.c, same parameters (one extra), and that
> method gets invoked now that I use my glibc library. The problem
>  howerver, is that I am afraid that is not the way
> to do this. So my question is: how do I get my_map() wrapper to
>  be build in a similar fashion as the wrapper for
> mmap()?

let's take a step back.  why do you want this in glibc ?  as part of your goal 
to "exploit my logic without interfering with anything else in the system", 
wouldn't you just create a new library for people to link against ?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <>

More information about the Libc-help mailing list