* time.h define NULL
@ 2015-06-02 9:09 Tomasz Sterna
2015-06-02 9:35 ` Szabolcs Nagy
0 siblings, 1 reply; 19+ messages in thread
From: Tomasz Sterna @ 2015-06-02 9:09 UTC (permalink / raw)
To: musl
Why does time.h unconditionally define NULL [1]?
It gives me the following warning during compilation:
In file included from /usr/include/pthread.h:31:
/usr/include/time.h:11:9: warning: 'NULL' macro redefined
[-Wmacro-redefined]
#define NULL 0L
^
[1] http://git.musl-libc.org/cgit/musl/tree/include/time.h#n11
--
/o__
(_<^' It's better to burn out than it is to rust.
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: time.h define NULL
2015-06-02 9:09 time.h define NULL Tomasz Sterna
@ 2015-06-02 9:35 ` Szabolcs Nagy
2015-06-02 9:38 ` Daniel Cegiełka
2015-06-02 11:16 ` Tomasz Sterna
0 siblings, 2 replies; 19+ messages in thread
From: Szabolcs Nagy @ 2015-06-02 9:35 UTC (permalink / raw)
To: musl
* Tomasz Sterna <tomek@xiaoka.com> [2015-06-02 11:09:40 +0200]:
> Why does time.h unconditionally define NULL [1]?
because it is required
> It gives me the following warning during compilation:
>
> In file included from /usr/include/pthread.h:31:
> /usr/include/time.h:11:9: warning: 'NULL' macro redefined
> [-Wmacro-redefined]
> #define NULL 0L
> ^
what is the previous definition?
and why is that conflicting?
c11 6.10.3p2:
#define A x
#define A x
is valid
#define A x
#define A y
is not.
>
> [1] http://git.musl-libc.org/cgit/musl/tree/include/time.h#n11
> --
> /o__
> (_<^' It's better to burn out than it is to rust.
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: time.h define NULL
2015-06-02 9:35 ` Szabolcs Nagy
@ 2015-06-02 9:38 ` Daniel Cegiełka
2015-06-02 9:41 ` Szabolcs Nagy
2015-06-02 11:16 ` Tomasz Sterna
1 sibling, 1 reply; 19+ messages in thread
From: Daniel Cegiełka @ 2015-06-02 9:38 UTC (permalink / raw)
To: musl
2015-06-02 11:35 GMT+02:00 Szabolcs Nagy <nsz@port70.net>:
>
> * Tomasz Sterna <tomek@xiaoka.com> [2015-06-02 11:09:40 +0200]:
> > Why does time.h unconditionally define NULL [1]?
>
> because it is required
>
> > It gives me the following warning during compilation:
> >
> > In file included from /usr/include/pthread.h:31:
> > /usr/include/time.h:11:9: warning: 'NULL' macro redefined
> > [-Wmacro-redefined]
> > #define NULL 0L
> > ^
>
> what is the previous definition?
http://git.musl-libc.org/cgit/musl/tree/include/stddef.h#n7
> and why is that conflicting?
>
> c11 6.10.3p2:
>
> #define A x
> #define A x
>
> is valid
>
> #define A x
> #define A y
>
> is not.
>
> >
> > [1] http://git.musl-libc.org/cgit/musl/tree/include/time.h#n11
> > --
> > /o__
> > (_<^' It's better to burn out than it is to rust.
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: time.h define NULL
2015-06-02 9:38 ` Daniel Cegiełka
@ 2015-06-02 9:41 ` Szabolcs Nagy
0 siblings, 0 replies; 19+ messages in thread
From: Szabolcs Nagy @ 2015-06-02 9:41 UTC (permalink / raw)
To: musl
* Daniel Cegie??ka <daniel.cegielka@gmail.com> [2015-06-02 11:38:46 +0200]:
> 2015-06-02 11:35 GMT+02:00 Szabolcs Nagy <nsz@port70.net>:
> >
> > * Tomasz Sterna <tomek@xiaoka.com> [2015-06-02 11:09:40 +0200]:
> > > Why does time.h unconditionally define NULL [1]?
> >
> > because it is required
> >
> > > It gives me the following warning during compilation:
> > >
> > > In file included from /usr/include/pthread.h:31:
> > > /usr/include/time.h:11:9: warning: 'NULL' macro redefined
> > > [-Wmacro-redefined]
> > > #define NULL 0L
> > > ^
> >
> > what is the previous definition?
>
> http://git.musl-libc.org/cgit/musl/tree/include/stddef.h#n7
>
so why was one header compiled as c++ the other not?
>
>
> > and why is that conflicting?
> >
> > c11 6.10.3p2:
> >
> > #define A x
> > #define A x
> >
> > is valid
> >
> > #define A x
> > #define A y
> >
> > is not.
> >
> > >
> > > [1] http://git.musl-libc.org/cgit/musl/tree/include/time.h#n11
> > > --
> > > /o__
> > > (_<^' It's better to burn out than it is to rust.
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: time.h define NULL
2015-06-02 9:35 ` Szabolcs Nagy
2015-06-02 9:38 ` Daniel Cegiełka
@ 2015-06-02 11:16 ` Tomasz Sterna
2015-06-02 11:24 ` Szabolcs Nagy
2015-06-02 11:32 ` time.h define NULL Jens Gustedt
1 sibling, 2 replies; 19+ messages in thread
From: Tomasz Sterna @ 2015-06-02 11:16 UTC (permalink / raw)
To: musl
Dnia 2015-06-02, wto o godzinie 11:35 +0200, Szabolcs Nagy pisze:
> > Why does time.h unconditionally define NULL [1]?
> because it is required
Required by what?
> > /usr/include/time.h:11:9: warning: 'NULL' macro redefined
> > [-Wmacro-redefined]
> > #define NULL 0L
> > ^
> what is the previous definition?
> and why is that conflicting?
Previous definition is:
#define NULL (0)
it is in one of headers of the application I'm trying to build against
musl.
Even if it is required by time.h, shouldn't it be guarded by #ifndef
NULL? time.h is not stand-alone unit and is designed to be included to
other software.
--
/o__ Q: What do agnostic, insomniac dyslexics do at night?
(_<^' A: Stay awake and wonder if there's a dog.
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: time.h define NULL
2015-06-02 11:16 ` Tomasz Sterna
@ 2015-06-02 11:24 ` Szabolcs Nagy
2015-06-02 12:04 ` Tomasz Sterna
2015-06-02 11:32 ` time.h define NULL Jens Gustedt
1 sibling, 1 reply; 19+ messages in thread
From: Szabolcs Nagy @ 2015-06-02 11:24 UTC (permalink / raw)
To: musl
* Tomasz Sterna <tomek@xiaoka.com> [2015-06-02 13:16:31 +0200]:
> Dnia 2015-06-02, wto o godzinie 11:35 +0200, Szabolcs Nagy pisze:
> > > Why does time.h unconditionally define NULL [1]?
> > because it is required
>
> Required by what?
>
c11 7.27.1p2
> > > /usr/include/time.h:11:9: warning: 'NULL' macro redefined
> > > [-Wmacro-redefined]
> > > #define NULL 0L
> > > ^
> > what is the previous definition?
> > and why is that conflicting?
>
> Previous definition is:
> #define NULL (0)
>
> it is in one of headers of the application I'm trying to build against
> musl.
>
that's undefined behaviour
NULL is reserved for the implementation if time.h is included.
c11 7.1.3
> Even if it is required by time.h, shouldn't it be guarded by #ifndef
> NULL? time.h is not stand-alone unit and is designed to be included to
> other software.
no
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: time.h define NULL
2015-06-02 11:16 ` Tomasz Sterna
2015-06-02 11:24 ` Szabolcs Nagy
@ 2015-06-02 11:32 ` Jens Gustedt
1 sibling, 0 replies; 19+ messages in thread
From: Jens Gustedt @ 2015-06-02 11:32 UTC (permalink / raw)
To: musl
[-- Attachment #1: Type: text/plain, Size: 1423 bytes --]
Am Dienstag, den 02.06.2015, 13:16 +0200 schrieb Tomasz Sterna:
> Dnia 2015-06-02, wto o godzinie 11:35 +0200, Szabolcs Nagy pisze:
> > > Why does time.h unconditionally define NULL [1]?
> > because it is required
>
> Required by what?
because the C standard says so
> > > /usr/include/time.h:11:9: warning: 'NULL' macro redefined
> > > [-Wmacro-redefined]
> > > #define NULL 0L
> > > ^
> > what is the previous definition?
> > and why is that conflicting?
>
> Previous definition is:
> #define NULL (0)
>
> it is in one of headers of the application I'm trying to build against
> musl.
This is a bug. An application should never redefine a standard macro
> Even if it is required by time.h, shouldn't it be guarded by #ifndef
> NULL? time.h is not stand-alone unit and is designed to be included to
> other software.
No. As you can see both defininitions are different, no only
syntactical, but also one has type int and the other long.
An application should never be able to overwrite a standard macro, but
things should error out as they do for you.
Jens
--
:: INRIA Nancy Grand Est ::: Camus ::::::: ICube/ICPS :::
:: ::::::::::::::: office Strasbourg : +33 368854536 ::
:: :::::::::::::::::::::: gsm France : +33 651400183 ::
:: ::::::::::::::: gsm international : +49 15737185122 ::
:: http://icube-icps.unistra.fr/index.php/Jens_Gustedt ::
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 181 bytes --]
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: time.h define NULL
2015-06-02 11:24 ` Szabolcs Nagy
@ 2015-06-02 12:04 ` Tomasz Sterna
2015-06-02 15:57 ` stable 1.1.9 & current GIT broken on mips Sebastian Gottschall
0 siblings, 1 reply; 19+ messages in thread
From: Tomasz Sterna @ 2015-06-02 12:04 UTC (permalink / raw)
To: musl
Dnia 2015-06-02, wto o godzinie 13:24 +0200, Szabolcs Nagy pisze:
> > Required by what?
> c11 7.27.1p2
And this is an answer I'm completely satisfied with. :-)
Thank you.
--
/o__
(_<^' If money can't buy happiness, I guess you'll just have to rent it.
^ permalink raw reply [flat|nested] 19+ messages in thread
* stable 1.1.9 & current GIT broken on mips
2015-06-02 12:04 ` Tomasz Sterna
@ 2015-06-02 15:57 ` Sebastian Gottschall
2015-06-02 17:19 ` Rich Felker
0 siblings, 1 reply; 19+ messages in thread
From: Sebastian Gottschall @ 2015-06-02 15:57 UTC (permalink / raw)
To: musl
Hello
i tested today the current 1.1.9 (and later also current git so see if
its the same behaviour)
build on a mipsr2 big endian target (atheros ar7xxx) based on my dd-wrt
firmware.
i found out that mips seems to be broken on musl right now. the
behaviour is
that a call using execvp will not result in calling the desired
application.
on a second call and a following return call, the userspace will lock up
with no way todo anything anymore.
for testing i used the same compiler, just recompiled musl with version
1.1.8 and overwrote the libc library and crt stuff. the result was, that
it worked
again without any issue
it needs to be considered that parts of the code is compiled using
-mips16 and -minterlink-mips16 if that matters
bellow you will find a copy of the c function which caused that problem.
this function is placed in a library which is linked to the main init
process. the function is called from this init process
its called in the following pseudo way
_evalpid(commandlinearray,">/dev/console", 0 , NULL);
Sebastian
int _evalpid(char *const argv[], char *path, int timeout, int *ppid)
{
pid_t pid;
int status;
int fd;
int flags;
int sig;
switch (pid = fork()) {
case -1: /* error */
perror("fork");
return errno;
case 0: /* child */
/*
* Reset signal handlers set for parent process
*/
for (sig = 0; sig < (_NSIG - 1); sig++)
signal(sig, SIG_DFL);
/*
* Clean up
*/
ioctl(0, TIOCNOTTY, 0);
close(STDIN_FILENO);
close(STDOUT_FILENO);
close(STDERR_FILENO);
setsid();
/*
* We want to check the board if exist UART? , add by honor
* 2003-12-04
*/
if ((fd = open("/dev/console", O_RDWR)) < 0) {
(void)open("/dev/null", O_RDONLY);
(void)open("/dev/null", O_WRONLY);
(void)open("/dev/null", O_WRONLY);
} else {
close(fd);
(void)open("/dev/console", O_RDONLY);
(void)open("/dev/console", O_WRONLY);
(void)open("/dev/console", O_WRONLY);
}
/*
* Redirect stdout to <path>
*/
if (path) {
flags = O_WRONLY | O_CREAT;
if (!strncmp(path, ">>", 2)) {
/*
* append to <path>
*/
flags |= O_APPEND;
path += 2;
} else if (!strncmp(path, ">", 1)) {
/*
* overwrite <path>
*/
flags |= O_TRUNC;
path += 1;
}
if ((fd = open(path, flags, 0644)) < 0)
perror(path);
else {
dup2(fd, STDOUT_FILENO);
close(fd);
}
}
/*
* execute command
*/
setenv("PATH", "/sbin:/bin:/usr/sbin:/usr/bin", 1);
alarm(timeout);
execvp(argv[0], argv);
perror(argv[0]);
exit(errno);
default: /* parent */
if (ppid) {
*ppid = pid;
return 0;
} else {
waitpid(pid, &status, 0);
if (WIFEXITED(status))
return WEXITSTATUS(status);
else
return status;
}
}
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: stable 1.1.9 & current GIT broken on mips
2015-06-02 15:57 ` stable 1.1.9 & current GIT broken on mips Sebastian Gottschall
@ 2015-06-02 17:19 ` Rich Felker
2015-06-02 17:52 ` Sebastian Gottschall
0 siblings, 1 reply; 19+ messages in thread
From: Rich Felker @ 2015-06-02 17:19 UTC (permalink / raw)
To: Sebastian Gottschall; +Cc: musl
On Tue, Jun 02, 2015 at 05:57:23PM +0200, Sebastian Gottschall wrote:
> Hello
>
> i tested today the current 1.1.9 (and later also current git so see
> if its the same behaviour)
> build on a mipsr2 big endian target (atheros ar7xxx) based on my
> dd-wrt firmware.
> i found out that mips seems to be broken on musl right now. the
> behaviour is
> that a call using execvp will not result in calling the desired
> application.
> on a second call and a following return call, the userspace will
> lock up with no way todo anything anymore.
>
> for testing i used the same compiler, just recompiled musl with
> version 1.1.8 and overwrote the libc library and crt stuff. the
> result was, that it worked
> again without any issue
>
> it needs to be considered that parts of the code is compiled using
> -mips16 and -minterlink-mips16 if that matters
I suspect the regression is related to your use of mips16, which I had
no idea worked at all with musl and is not something that's officially
supported. Did you build musl itself as mips16? I don't think this is
going to work because we have tail calls back and forth between C and
asm code where the asm is written in normal 32-bit mips instructions.
There may also be issues with the dynamic linker start code if
crt_arch.h is assembled in mips16 mode.
Could you provide details on your setup, specifically, which
components are being compiled as mips16?
Rich
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: stable 1.1.9 & current GIT broken on mips
2015-06-02 17:19 ` Rich Felker
@ 2015-06-02 17:52 ` Sebastian Gottschall
2015-06-02 19:11 ` Rich Felker
0 siblings, 1 reply; 19+ messages in thread
From: Sebastian Gottschall @ 2015-06-02 17:52 UTC (permalink / raw)
To: Rich Felker; +Cc: musl
Am 02.06.2015 um 19:19 schrieb Rich Felker:
> On Tue, Jun 02, 2015 at 05:57:23PM +0200, Sebastian Gottschall wrote:
>> Hello
>>
>> i tested today the current 1.1.9 (and later also current git so see
>> if its the same behaviour)
>> build on a mipsr2 big endian target (atheros ar7xxx) based on my
>> dd-wrt firmware.
>> i found out that mips seems to be broken on musl right now. the
>> behaviour is
>> that a call using execvp will not result in calling the desired
>> application.
>> on a second call and a following return call, the userspace will
>> lock up with no way todo anything anymore.
>>
>> for testing i used the same compiler, just recompiled musl with
>> version 1.1.8 and overwrote the libc library and crt stuff. the
>> result was, that it worked
>> again without any issue
>>
>> it needs to be considered that parts of the code is compiled using
>> -mips16 and -minterlink-mips16 if that matters
> I suspect the regression is related to your use of mips16, which I had
> no idea worked at all with musl and is not something that's officially
> supported. Did you build musl itself as mips16? I don't think this is
> going to work because we have tail calls back and forth between C and
> asm code where the asm is written in normal 32-bit mips instructions.
> There may also be issues with the dynamic linker start code if
> crt_arch.h is assembled in mips16 mode.
no musl itself is build without mips16. i'm aware that this will likelly
not work. only the applications are partially compiled with mips16 (some
libs like openssl arent compiled with mips16 for performance reasons)
> Could you provide details on your setup, specifically, which
> components are being compiled as mips16?
all libs and applications which are affected here in this testcase are
compiled with mips16, except for musl
Sebastian
>
> Rich
>
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: stable 1.1.9 & current GIT broken on mips
2015-06-02 17:52 ` Sebastian Gottschall
@ 2015-06-02 19:11 ` Rich Felker
2015-06-02 19:59 ` Sebastian Gottschall
0 siblings, 1 reply; 19+ messages in thread
From: Rich Felker @ 2015-06-02 19:11 UTC (permalink / raw)
To: Sebastian Gottschall; +Cc: musl
On Tue, Jun 02, 2015 at 07:52:15PM +0200, Sebastian Gottschall wrote:
> Am 02.06.2015 um 19:19 schrieb Rich Felker:
> >On Tue, Jun 02, 2015 at 05:57:23PM +0200, Sebastian Gottschall wrote:
> >>Hello
> >>
> >>i tested today the current 1.1.9 (and later also current git so see
> >>if its the same behaviour)
> >>build on a mipsr2 big endian target (atheros ar7xxx) based on my
> >>dd-wrt firmware.
> >>i found out that mips seems to be broken on musl right now. the
> >>behaviour is
> >>that a call using execvp will not result in calling the desired
> >>application.
> >>on a second call and a following return call, the userspace will
> >>lock up with no way todo anything anymore.
What do you mean by "the userspace will lock up"? The process hangs?
Or the whole system? Is there any way to observe what's going on with
strace?
And can you clarify what you mean about execvp? Are you saying the
first call to execvp returns with an error? I don't get what you mean
about "a second call and a following return call". On success execvp
does not return.
If you're trying to start a dynamic-linked application, it's likely
that something is going wrong in the dynamic linker after execvp
succeeds but before execution passes into the main program. You could
try running a program with global constructors and see if they run.
There's a jump at the end of dynamic linking which is not compatible
with calling into mips16 code, but as long as crt1.o is not mips16
(and it shouldn't be; on mips it's still built from a .s file, and you
said you're not using mips16 in libc) this should not be a problem.
Another possibility I should mention since this is DD-WRT is that
you've got an ancient kernel that's not compatible with TLS. As of
1.1.0 musl deprecated running without a valid thread pointer, but
still worked if you happened not to invoke code that needs it. 1.1.9
removed the last remnants of support for no-thread-pointer and now
aborts with SIGSEGV or SIGILL in the startup code if setting the
thread pointer fails, which will be the case on 2.4 kernels.
Please let me know if you think this might be the case and if it's
blocking an important usage case for you. Since the rdhwr to get the
thread pointer is potentially very expensive on old hardware
(MIPS-I/II) I'm already considering making musl use a non-TLS global
for the thread pointer on mips in single-threaded programs, and this
same mechanism could make it possible to run (without threads, of
course) on kernels without rdhwr emulation or set_thread_area syscall.
But if possible it's really best to just move away from 2.4. It has
lots of bugs and cannot provide a fully-working environment for musl.
Rich
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: stable 1.1.9 & current GIT broken on mips
2015-06-02 19:11 ` Rich Felker
@ 2015-06-02 19:59 ` Sebastian Gottschall
2015-06-04 4:04 ` Rich Felker
0 siblings, 1 reply; 19+ messages in thread
From: Sebastian Gottschall @ 2015-06-02 19:59 UTC (permalink / raw)
To: Rich Felker; +Cc: musl
Am 02.06.2015 um 21:11 schrieb Rich Felker:
> On Tue, Jun 02, 2015 at 07:52:15PM +0200, Sebastian Gottschall wrote:
>> Am 02.06.2015 um 19:19 schrieb Rich Felker:
>>> On Tue, Jun 02, 2015 at 05:57:23PM +0200, Sebastian Gottschall wrote:
>>>> Hello
>>>>
>>>> i tested today the current 1.1.9 (and later also current git so see
>>>> if its the same behaviour)
>>>> build on a mipsr2 big endian target (atheros ar7xxx) based on my
>>>> dd-wrt firmware.
>>>> i found out that mips seems to be broken on musl right now. the
>>>> behaviour is
>>>> that a call using execvp will not result in calling the desired
>>>> application.
>>>> on a second call and a following return call, the userspace will
>>>> lock up with no way todo anything anymore.
> What do you mean by "the userspace will lock up"? The process hangs?
> Or the whole system? Is there any way to observe what's going on with
> strace?
no serial input anymore, looks like system hangs. but sometimes a kernel
message still may race up. ([81.730000] random: nonblocking pool is
initialized for instance)
so its not completelly dead, but its not possible
to interface from userspace anymore with serial console etc.
>
> And can you clarify what you mean about execvp? Are you saying the
> first call to execvp returns with an error? I don't get what you mean
> about "a second call and a following return call". On success execvp
> does not return.
i never checked for a return value. i just can say that the programm was
never called.
see the function i provided
_eval("devinit"); //returns, but app never gets called
_eval("sysinit"); //app never gets called, _eval hangs complete system
on return call of _eval
>
> If you're trying to start a dynamic-linked application, it's likely
> that something is going wrong in the dynamic linker after execvp
> succeeds but before execution passes into the main program. You could
> try running a program with global constructors and see if they run.
> There's a jump at the end of dynamic linking which is not compatible
> with calling into mips16 code, but as long as crt1.o is not mips16
> (and it shouldn't be; on mips it's still built from a .s file, and you
> said you're not using mips16 in libc) this should not be a problem.
>
> Another possibility I should mention since this is DD-WRT is that
> you've got an ancient kernel that's not compatible with TLS. As of
> 1.1.0 musl deprecated running without a valid thread pointer, but
> still worked if you happened not to invoke code that needs it. 1.1.9
> removed the last remnants of support for no-thread-pointer and now
> aborts with SIGSEGV or SIGILL in the startup code if setting the
> thread pointer fails, which will be the case on 2.4 kernels.
its kernel 3.18 and kernel 3.10 which is mainly used. in the testcase
3.18 was used
dont think that dd-wrt still used 2.4 (this is only the case for old
wrt54g devices, but these devices are uclibc based)
musl is the standard for all mips and armbe/le based devices in dd-wrt
only y86,x64,powerpc and mips64 devices are still using uclibs since
mips64 doesnt work with musl and power
wasnt working months ago. may have changed in between. never tested so far.
but target is to use musl on all cpu architectures in future, once its
working on all.
Sebastian
>
> Please let me know if you think this might be the case and if it's
> blocking an important usage case for you. Since the rdhwr to get the
> thread pointer is potentially very expensive on old hardware
> (MIPS-I/II) I'm already considering making musl use a non-TLS global
> for the thread pointer on mips in single-threaded programs, and this
> same mechanism could make it possible to run (without threads, of
> course) on kernels without rdhwr emulation or set_thread_area syscall.
> But if possible it's really best to just move away from 2.4. It has
> lots of bugs and cannot provide a fully-working environment for musl.
>
> Rich
>
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: stable 1.1.9 & current GIT broken on mips
2015-06-02 19:59 ` Sebastian Gottschall
@ 2015-06-04 4:04 ` Rich Felker
2015-06-04 8:29 ` Sebastian Gottschall
2015-06-04 12:14 ` Sebastian Gottschall
0 siblings, 2 replies; 19+ messages in thread
From: Rich Felker @ 2015-06-04 4:04 UTC (permalink / raw)
To: Sebastian Gottschall; +Cc: musl
On Tue, Jun 02, 2015 at 09:59:08PM +0200, Sebastian Gottschall wrote:
> Am 02.06.2015 um 21:11 schrieb Rich Felker:
> >On Tue, Jun 02, 2015 at 07:52:15PM +0200, Sebastian Gottschall wrote:
> >>Am 02.06.2015 um 19:19 schrieb Rich Felker:
> >>>On Tue, Jun 02, 2015 at 05:57:23PM +0200, Sebastian Gottschall wrote:
> >>>>Hello
> >>>>
> >>>>i tested today the current 1.1.9 (and later also current git so see
> >>>>if its the same behaviour)
> >>>>build on a mipsr2 big endian target (atheros ar7xxx) based on my
> >>>>dd-wrt firmware.
> >>>>i found out that mips seems to be broken on musl right now. the
> >>>>behaviour is
> >>>>that a call using execvp will not result in calling the desired
> >>>>application.
> >>>>on a second call and a following return call, the userspace will
> >>>>lock up with no way todo anything anymore.
> >What do you mean by "the userspace will lock up"? The process hangs?
> >Or the whole system? Is there any way to observe what's going on with
> >strace?
> no serial input anymore, looks like system hangs. but sometimes a
> kernel message still may race up. ([81.730000] random: nonblocking
> pool is initialized for instance)
> so its not completelly dead, but its not possible
> to interface from userspace anymore with serial console etc.
Can you provide me with the libc.so binary that's failing?
> >And can you clarify what you mean about execvp? Are you saying the
> >first call to execvp returns with an error? I don't get what you mean
> >about "a second call and a following return call". On success execvp
> >does not return.
> i never checked for a return value. i just can say that the programm
> was never called.
> see the function i provided
> _eval("devinit"); //returns, but app never gets called
> _eval("sysinit"); //app never gets called, _eval hangs complete
> system on return call of _eval
> >
> >If you're trying to start a dynamic-linked application, it's likely
> >that something is going wrong in the dynamic linker after execvp
> >succeeds but before execution passes into the main program. You could
> >try running a program with global constructors and see if they run.
> >There's a jump at the end of dynamic linking which is not compatible
> >with calling into mips16 code, but as long as crt1.o is not mips16
> >(and it shouldn't be; on mips it's still built from a .s file, and you
> >said you're not using mips16 in libc) this should not be a problem.
> >
> >Another possibility I should mention since this is DD-WRT is that
> >you've got an ancient kernel that's not compatible with TLS. As of
> >1.1.0 musl deprecated running without a valid thread pointer, but
> >still worked if you happened not to invoke code that needs it. 1.1.9
> >removed the last remnants of support for no-thread-pointer and now
> >aborts with SIGSEGV or SIGILL in the startup code if setting the
> >thread pointer fails, which will be the case on 2.4 kernels.
> its kernel 3.18 and kernel 3.10 which is mainly used. in the
> testcase 3.18 was used
> dont think that dd-wrt still used 2.4 (this is only the case for old
> wrt54g devices, but these devices are uclibc based)
> musl is the standard for all mips and armbe/le based devices in
> dd-wrt only y86,x64,powerpc and mips64 devices are still using
> uclibs since mips64 doesnt work with musl and power
> wasnt working months ago. may have changed in between. never tested so far.
> but target is to use musl on all cpu architectures in future, once
> its working on all.
OK, that's not the issue then.
Rich
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: stable 1.1.9 & current GIT broken on mips
2015-06-04 4:04 ` Rich Felker
@ 2015-06-04 8:29 ` Sebastian Gottschall
2015-06-04 12:14 ` Sebastian Gottschall
1 sibling, 0 replies; 19+ messages in thread
From: Sebastian Gottschall @ 2015-06-04 8:29 UTC (permalink / raw)
To: Rich Felker; +Cc: musl
www.dd-wrt.com/libc.so
Am 04.06.2015 um 06:04 schrieb Rich Felker:
> On Tue, Jun 02, 2015 at 09:59:08PM +0200, Sebastian Gottschall wrote:
>> Am 02.06.2015 um 21:11 schrieb Rich Felker:
>>> On Tue, Jun 02, 2015 at 07:52:15PM +0200, Sebastian Gottschall wrote:
>>>> Am 02.06.2015 um 19:19 schrieb Rich Felker:
>>>>> On Tue, Jun 02, 2015 at 05:57:23PM +0200, Sebastian Gottschall wrote:
>>>>>> Hello
>>>>>>
>>>>>> i tested today the current 1.1.9 (and later also current git so see
>>>>>> if its the same behaviour)
>>>>>> build on a mipsr2 big endian target (atheros ar7xxx) based on my
>>>>>> dd-wrt firmware.
>>>>>> i found out that mips seems to be broken on musl right now. the
>>>>>> behaviour is
>>>>>> that a call using execvp will not result in calling the desired
>>>>>> application.
>>>>>> on a second call and a following return call, the userspace will
>>>>>> lock up with no way todo anything anymore.
>>> What do you mean by "the userspace will lock up"? The process hangs?
>>> Or the whole system? Is there any way to observe what's going on with
>>> strace?
>> no serial input anymore, looks like system hangs. but sometimes a
>> kernel message still may race up. ([81.730000] random: nonblocking
>> pool is initialized for instance)
>> so its not completelly dead, but its not possible
>> to interface from userspace anymore with serial console etc.
> Can you provide me with the libc.so binary that's failing?
>
>>> And can you clarify what you mean about execvp? Are you saying the
>>> first call to execvp returns with an error? I don't get what you mean
>>> about "a second call and a following return call". On success execvp
>>> does not return.
>> i never checked for a return value. i just can say that the programm
>> was never called.
>> see the function i provided
>> _eval("devinit"); //returns, but app never gets called
>> _eval("sysinit"); //app never gets called, _eval hangs complete
>> system on return call of _eval
>>> If you're trying to start a dynamic-linked application, it's likely
>>> that something is going wrong in the dynamic linker after execvp
>>> succeeds but before execution passes into the main program. You could
>>> try running a program with global constructors and see if they run.
>>> There's a jump at the end of dynamic linking which is not compatible
>>> with calling into mips16 code, but as long as crt1.o is not mips16
>>> (and it shouldn't be; on mips it's still built from a .s file, and you
>>> said you're not using mips16 in libc) this should not be a problem.
>>>
>>> Another possibility I should mention since this is DD-WRT is that
>>> you've got an ancient kernel that's not compatible with TLS. As of
>>> 1.1.0 musl deprecated running without a valid thread pointer, but
>>> still worked if you happened not to invoke code that needs it. 1.1.9
>>> removed the last remnants of support for no-thread-pointer and now
>>> aborts with SIGSEGV or SIGILL in the startup code if setting the
>>> thread pointer fails, which will be the case on 2.4 kernels.
>> its kernel 3.18 and kernel 3.10 which is mainly used. in the
>> testcase 3.18 was used
>> dont think that dd-wrt still used 2.4 (this is only the case for old
>> wrt54g devices, but these devices are uclibc based)
>> musl is the standard for all mips and armbe/le based devices in
>> dd-wrt only y86,x64,powerpc and mips64 devices are still using
>> uclibs since mips64 doesnt work with musl and power
>> wasnt working months ago. may have changed in between. never tested so far.
>> but target is to use musl on all cpu architectures in future, once
>> its working on all.
> OK, that's not the issue then.
>
> Rich
>
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: stable 1.1.9 & current GIT broken on mips
2015-06-04 4:04 ` Rich Felker
2015-06-04 8:29 ` Sebastian Gottschall
@ 2015-06-04 12:14 ` Sebastian Gottschall
2015-06-04 16:07 ` Rich Felker
1 sibling, 1 reply; 19+ messages in thread
From: Sebastian Gottschall @ 2015-06-04 12:14 UTC (permalink / raw)
To: Rich Felker; +Cc: musl
nbd gave me the following patch he found in the IRC. i tested it and its
working
diff --git a/src/ldso/dynlink.c b/src/ldso/dynlink.c
index 42930ad..f498327 100644
--- a/src/ldso/dynlink.c
+++ b/src/ldso/dynlink.c
@@ -270,6 +270,8 @@ static void do_relocs(struct dso *dso, size_t *rel,
size_t rel_size, size_t stri
for (; rel_size; rel+=stride, rel_size-=stride*sizeof(size_t)) {
if (skip_relative && IS_RELATIVE(rel[1])) continue;
type = R_TYPE(rel[1]);
+ if (!type)
+ continue;
sym_index = R_SYM(rel[1]);
reloc_addr = (void *)(base + rel[0]);
if (sym_index) {
Am 04.06.2015 um 06:04 schrieb Rich Felker:
> On Tue, Jun 02, 2015 at 09:59:08PM +0200, Sebastian Gottschall wrote:
>> Am 02.06.2015 um 21:11 schrieb Rich Felker:
>>> On Tue, Jun 02, 2015 at 07:52:15PM +0200, Sebastian Gottschall wrote:
>>>> Am 02.06.2015 um 19:19 schrieb Rich Felker:
>>>>> On Tue, Jun 02, 2015 at 05:57:23PM +0200, Sebastian Gottschall wrote:
>>>>>> Hello
>>>>>>
>>>>>> i tested today the current 1.1.9 (and later also current git so see
>>>>>> if its the same behaviour)
>>>>>> build on a mipsr2 big endian target (atheros ar7xxx) based on my
>>>>>> dd-wrt firmware.
>>>>>> i found out that mips seems to be broken on musl right now. the
>>>>>> behaviour is
>>>>>> that a call using execvp will not result in calling the desired
>>>>>> application.
>>>>>> on a second call and a following return call, the userspace will
>>>>>> lock up with no way todo anything anymore.
>>> What do you mean by "the userspace will lock up"? The process hangs?
>>> Or the whole system? Is there any way to observe what's going on with
>>> strace?
>> no serial input anymore, looks like system hangs. but sometimes a
>> kernel message still may race up. ([81.730000] random: nonblocking
>> pool is initialized for instance)
>> so its not completelly dead, but its not possible
>> to interface from userspace anymore with serial console etc.
> Can you provide me with the libc.so binary that's failing?
>
>>> And can you clarify what you mean about execvp? Are you saying the
>>> first call to execvp returns with an error? I don't get what you mean
>>> about "a second call and a following return call". On success execvp
>>> does not return.
>> i never checked for a return value. i just can say that the programm
>> was never called.
>> see the function i provided
>> _eval("devinit"); //returns, but app never gets called
>> _eval("sysinit"); //app never gets called, _eval hangs complete
>> system on return call of _eval
>>> If you're trying to start a dynamic-linked application, it's likely
>>> that something is going wrong in the dynamic linker after execvp
>>> succeeds but before execution passes into the main program. You could
>>> try running a program with global constructors and see if they run.
>>> There's a jump at the end of dynamic linking which is not compatible
>>> with calling into mips16 code, but as long as crt1.o is not mips16
>>> (and it shouldn't be; on mips it's still built from a .s file, and you
>>> said you're not using mips16 in libc) this should not be a problem.
>>>
>>> Another possibility I should mention since this is DD-WRT is that
>>> you've got an ancient kernel that's not compatible with TLS. As of
>>> 1.1.0 musl deprecated running without a valid thread pointer, but
>>> still worked if you happened not to invoke code that needs it. 1.1.9
>>> removed the last remnants of support for no-thread-pointer and now
>>> aborts with SIGSEGV or SIGILL in the startup code if setting the
>>> thread pointer fails, which will be the case on 2.4 kernels.
>> its kernel 3.18 and kernel 3.10 which is mainly used. in the
>> testcase 3.18 was used
>> dont think that dd-wrt still used 2.4 (this is only the case for old
>> wrt54g devices, but these devices are uclibc based)
>> musl is the standard for all mips and armbe/le based devices in
>> dd-wrt only y86,x64,powerpc and mips64 devices are still using
>> uclibs since mips64 doesnt work with musl and power
>> wasnt working months ago. may have changed in between. never tested so far.
>> but target is to use musl on all cpu architectures in future, once
>> its working on all.
> OK, that's not the issue then.
>
> Rich
>
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: stable 1.1.9 & current GIT broken on mips
2015-06-04 12:14 ` Sebastian Gottschall
@ 2015-06-04 16:07 ` Rich Felker
2015-06-06 15:42 ` Anthony G. Basile
0 siblings, 1 reply; 19+ messages in thread
From: Rich Felker @ 2015-06-04 16:07 UTC (permalink / raw)
To: Sebastian Gottschall; +Cc: musl
On Thu, Jun 04, 2015 at 02:14:19PM +0200, Sebastian Gottschall wrote:
> nbd gave me the following patch he found in the IRC. i tested it and
> its working
>
>
> diff --git a/src/ldso/dynlink.c b/src/ldso/dynlink.c
> index 42930ad..f498327 100644
> --- a/src/ldso/dynlink.c
> +++ b/src/ldso/dynlink.c
> @@ -270,6 +270,8 @@ static void do_relocs(struct dso *dso, size_t
> *rel, size_t rel_size, size_t stri
> for (; rel_size; rel+=stride, rel_size-=stride*sizeof(size_t)) {
> if (skip_relative && IS_RELATIVE(rel[1])) continue;
> type = R_TYPE(rel[1]);
> + if (!type)
> + continue;
> sym_index = R_SYM(rel[1]);
> reloc_addr = (void *)(base + rel[0]);
> if (sym_index) {
Excellent. I've applied an equivalent fix to git master and it will be
in the 1.1.10 release (coming up soon).
Rich
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: stable 1.1.9 & current GIT broken on mips
2015-06-04 16:07 ` Rich Felker
@ 2015-06-06 15:42 ` Anthony G. Basile
2015-06-06 15:59 ` Anthony G. Basile
0 siblings, 1 reply; 19+ messages in thread
From: Anthony G. Basile @ 2015-06-06 15:42 UTC (permalink / raw)
To: musl
On 6/4/15 12:07 PM, Rich Felker wrote:
> On Thu, Jun 04, 2015 at 02:14:19PM +0200, Sebastian Gottschall wrote:
>> nbd gave me the following patch he found in the IRC. i tested it and
>> its working
>>
>>
>> diff --git a/src/ldso/dynlink.c b/src/ldso/dynlink.c
>> index 42930ad..f498327 100644
>> --- a/src/ldso/dynlink.c
>> +++ b/src/ldso/dynlink.c
>> @@ -270,6 +270,8 @@ static void do_relocs(struct dso *dso, size_t
>> *rel, size_t rel_size, size_t stri
>> for (; rel_size; rel+=stride, rel_size-=stride*sizeof(size_t)) {
>> if (skip_relative && IS_RELATIVE(rel[1])) continue;
>> type = R_TYPE(rel[1]);
>> + if (!type)
>> + continue;
>> sym_index = R_SYM(rel[1]);
>> reloc_addr = (void *)(base + rel[0]);
>> if (sym_index) {
>
> Excellent. I've applied an equivalent fix to git master and it will be
> in the 1.1.10 release (coming up soon).
>
> Rich
>
I can confirm that this fix the build on the lemote fuloongs which are
little endian mips-III. 1.1.9 was broken there.
--
Anthony G. Basile, Ph. D.
Chair of Information Technology
D'Youville College
Buffalo, NY 14201
(716) 829-8197
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: stable 1.1.9 & current GIT broken on mips
2015-06-06 15:42 ` Anthony G. Basile
@ 2015-06-06 15:59 ` Anthony G. Basile
0 siblings, 0 replies; 19+ messages in thread
From: Anthony G. Basile @ 2015-06-06 15:59 UTC (permalink / raw)
To: musl
On 6/6/15 11:42 AM, Anthony G. Basile wrote:
>> Rich
>>
>
> I can confirm that this fix the build on the lemote fuloongs which are
> little endian mips-III. 1.1.9 was broken there.
>
Sorry I didn't mean "the build". 1.1.9 builds fine on mips but
everything then segfaults.
--
Anthony G. Basile, Ph. D.
Chair of Information Technology
D'Youville College
Buffalo, NY 14201
(716) 829-8197
^ permalink raw reply [flat|nested] 19+ messages in thread
end of thread, other threads:[~2015-06-06 15:59 UTC | newest]
Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-02 9:09 time.h define NULL Tomasz Sterna
2015-06-02 9:35 ` Szabolcs Nagy
2015-06-02 9:38 ` Daniel Cegiełka
2015-06-02 9:41 ` Szabolcs Nagy
2015-06-02 11:16 ` Tomasz Sterna
2015-06-02 11:24 ` Szabolcs Nagy
2015-06-02 12:04 ` Tomasz Sterna
2015-06-02 15:57 ` stable 1.1.9 & current GIT broken on mips Sebastian Gottschall
2015-06-02 17:19 ` Rich Felker
2015-06-02 17:52 ` Sebastian Gottschall
2015-06-02 19:11 ` Rich Felker
2015-06-02 19:59 ` Sebastian Gottschall
2015-06-04 4:04 ` Rich Felker
2015-06-04 8:29 ` Sebastian Gottschall
2015-06-04 12:14 ` Sebastian Gottschall
2015-06-04 16:07 ` Rich Felker
2015-06-06 15:42 ` Anthony G. Basile
2015-06-06 15:59 ` Anthony G. Basile
2015-06-02 11:32 ` time.h define NULL Jens Gustedt
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).