Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Wed, 17 Jul 2013 15:19:49 +0200
From: Szabolcs Nagy <nsz@...t70.net>
To: musl@...ts.openwall.com
Subject: Re: time code progress

* Jens Gustedt <jens.gustedt@...ia.fr> [2013-07-17 14:09:38 +0200]:
> Am Mittwoch, den 17.07.2013, 13:39 +0200 schrieb Szabolcs Nagy:
> > (i think it did not like the syscall arg counting in case of 0 args in
> > #define __SYSCALL_NARGS_X(a,b,c,d,e,f,g,h,n,...) n
> > #define __SYSCALL_NARGS(...) __SYSCALL_NARGS_X(__VA_ARGS__,7,6,5,4,3,2,1,0)
> > )
> 
> yes, this is in fact not suitable to test for 0 args. For the
> preprocessor 0 args basically doesn't exist, there is always one
> argument, but which is empty.
> 

note that the problem is not that __VA_ARGS__ is empty
(it's not, contrary to what i might implied), but that
if n becomes 0 (== __VA_ARGS__ expands to one argument),
then there is no more arguments in the __SYSCALL_NARGS_X
call to substitute for '...', so a simple fix would be

#define __SYSCALL_NARGS(...) __SYSCALL_NARGS_X(__VA_ARGS__,7,6,5,4,3,2,1,0, tralala)

but i'm not sure if this should be fixed (this is internal
code and i think there are no 0 argument syscalls)

i just wanted to record how i found the close without fd issue
(which shows that some kind of type checking for syscall
arguments would help libc hacking.. but that's non-trivial
to do)

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.