Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 20 Jul 2021 09:15:27 -0300
From:      Rdbo <rdbodev@gmail.com>
To:        freebsd-questions@freebsd.org
Subject:   Understanding the behavior of the 32 bit mmap system call
Message-ID:  <CABsRSOOib-xWTN41cB24=y7UtTqkPREOZfVOXYksw%2B7AzSWuEQ@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
Hi, I'm a hobbyist developer working on a multiplatform, multiarch memory
library, and I chose FreeBSD to be one of the supported operating systems.
I was playing around with the SYS_mmap system call and I noticed that, for
x86_32, you have to pass a struct containing all the mmap arguments, rather
than the arguments themselves. The thing is, this structure is not passed
as a pointer (like on Linux, for example), so I don't see how one would do
this syscall from a remote process, as each register is responsible for one
argument of the syscall, and a single register can't store a structure this
size. I've tried passing the structure as a pointer, passing each mmap
argument in a separate register (like __NR_mmap2 on Linux), looking for
alternative mmap system calls that do not require the struct parameter.
Unfortunately, these attempts have all failed.
TLDR; how to run a 32 bit SYS_mmap system call from a remote process when a
single register can't fit the whole structure and the structure is not
passed as a pointer?
Regards, rdbo



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CABsRSOOib-xWTN41cB24=y7UtTqkPREOZfVOXYksw%2B7AzSWuEQ>