From: Szabolcs Nagy <nsz@port70.net>
To: musl@lists.openwall.com
Subject: Re: [PATCH] Possible patch for __syscall_cp
Date: Tue, 13 Feb 2018 15:49:55 +0100 [thread overview]
Message-ID: <20180213144955.GB4418@port70.net> (raw)
In-Reply-To: <DB6PR0502MB3016ADDF1A67C6E0264F9B7DE7F60@DB6PR0502MB3016.eurprd05.prod.outlook.com>
* Nicholas Wilson <nicholas.wilson@realvnc.com> [2018-02-13 14:28:32 +0000]:
>
> In __syscall_cp.c, there's a call to __syscall which deliberately *disables* macro expansion, forcing the call to go via the __syscall function. On Wasm, I don't currently provide this function, instead I'm using the macros for __syscall to redirect via the __syscall<N> functions.
>
> This call in __syscall_cp looks to be practically the only place in the whole of Musl where macro expansion is prevented for __syscall (other than in src/internal/syscall.h itself, and arch/mips/syscall_arch.h). So on those grounds it's a bit suspicious, given that every other caller of __syscall uses the macros from internal/syscall.h.
>
> If there is a rationale, I could just define __syscall() in arch/wasm/syscall_arch.h - but I'd rather not if it's not meant to be called. Would it be possible instead to apply the patch below, and allow macro expansion?
>
> I can't see a risk, although I don't understand the cancellation-point implementation very well. There's no recursion possible, since plain __syscall() never redirects to any of the __syscall_cp machinery, so expansion oughtn't to cause problems on any archs?
>
i think your patch is ok (__syscall6 should behave the same
way as __syscall other than the inlining), but you can fix
it for your target only by adding
static inline long __syscall(long n, long a, long b, long c, long d, long e, long f)
{
return __syscall6(n,a,b,c,d,e,f);
}
to syscall_arch.h
> diff --git a/src/thread/__syscall_cp.c b/src/thread/__syscall_cp.c
> index 09a2be84..7b870faa 100644
> --- a/src/thread/__syscall_cp.c
> +++ b/src/thread/__syscall_cp.c
> @@ -8,7 +8,7 @@ static long sccp(syscall_arg_t nr,
> syscall_arg_t u, syscall_arg_t v, syscall_arg_t w,
> syscall_arg_t x, syscall_arg_t y, syscall_arg_t z)
> {
> - return (__syscall)(nr, u, v, w, x, y, z);
> + return __syscall(nr, u, v, w, x, y, z);
> }
>
> weak_alias(sccp, __syscall_cp_c);
next prev parent reply other threads:[~2018-02-13 14:49 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-13 14:28 Nicholas Wilson
2018-02-13 14:49 ` Szabolcs Nagy [this message]
2018-02-14 12:09 ` Nicholas Wilson
2018-02-21 2:03 ` Rich Felker
2018-02-21 10:47 ` Nicholas Wilson
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=20180213144955.GB4418@port70.net \
--to=nsz@port70.net \
--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).