From: ardi <ardillasdelmonte@gmail.com>
To: musl@lists.openwall.com
Subject: Re: Feature request: building musl in a portable way
Date: Sat, 23 Dec 2017 21:57:47 +0100 [thread overview]
Message-ID: <CA+fZqCWZEJfa26Ps8NvA4R7cdSRh=z_GUZsaQb1iXLTziy0W=A@mail.gmail.com> (raw)
In-Reply-To: <20171223081818.jus6ggz5eexkln26@voyager>
On Sat, Dec 23, 2017 at 9:18 AM, Markus Wichmann <nullplan@gmx.net> wrote:
> Clean it might be, but it's also long and stony. Linux currently
> supports ca. 300 syscalls.
Does musl use all Linux syscalls? In the musl headers I found traces
of about 60 or so syscall IDs definitions, IIRC (or even less, I don't
remember now).
[...]
> - musl requires mmap() with MAP_FIXED on a previously allocated area to
> work for shared libraries. In fact, musl itself will use mmap() with
> MAP_FIXED _only_ on previously allocated areas. There are reasons for
> that, but suffice it to say that for instance Cygwin fails these
> calls.
Does musl explicitly query for MAP_FIXED in the proper syscall
arguments when it expects MAP_FIXED, or do you have to guess it? If
musl explicitly queries for MAP_FIXED through the syscall arguments, I
don't see any problem here, just parse the arguments and pass the
MAP_FIXED requirement to the host syscall.
> - musl requires the close() syscall to always release the file descriptor
> if it was allocated before. Even if the call itself fails for any
> reason.
> - musl assumes the credential setting functions to have thread-local
> effect. Since POSIX defines them to have a process-global effect, it
> goes to some length to match them up. I am not certain every OS is as
> quirky in that respect as Linux (that's the real issue).
> - musl assumes to be able to read the instruction pointer from the
> arguments to signal handler, and to be able to set it.
Thanks a lot for all these advices!!
[...]
>> Yes, I believe that whenever there are assembly source files in some
>> directory in the musl tree, there're functions there that make
>> syscalls without going through the interface you defined above. I'll
>> look at this and I'll see if it can be improved somehow.
>>
>
> Ooh, thanks, that reminded me: the assembly files do make syscalls
> wildly, usually for control of the stack of because the other arch's
> need it. For instance src/thread/i386/__set_thread_area.s does nothing
> but invoke two syscalls. But it is needed to be an assembly file, since
> for some other arch's (e.g. PowerPC), only a register move is required.
Yeah, that's my main worry: the musl functions that issue syscalls
directly in assembly on their own, bypassing the musl syscall main
interface. I still need to look at this.
Thanks!
ardi
next prev parent reply other threads:[~2017-12-23 20:57 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-21 16:25 ardi
2017-12-21 21:38 ` Rich Felker
2017-12-22 16:09 ` ardi
2017-12-22 16:43 ` Rich Felker
2017-12-22 19:04 ` ardi
2017-12-23 8:18 ` Markus Wichmann
2017-12-23 20:57 ` ardi [this message]
2017-12-22 17:10 ` Nicholas Wilson
2017-12-22 17:49 ` Rich Felker
2017-12-22 18:01 ` Nicholas Wilson
2017-12-22 18:08 ` Rich Felker
2017-12-22 19:06 ` Nicholas Wilson
2017-12-22 19:27 ` ardi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CA+fZqCWZEJfa26Ps8NvA4R7cdSRh=z_GUZsaQb1iXLTziy0W=A@mail.gmail.com' \
--to=ardillasdelmonte@gmail.com \
--cc=musl@lists.openwall.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/musl/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).