Re: [leaf-user] ntpd segfaulting (copied to leaf-devel)

2017-05-03 Thread Erich Titl

Hi Bob

(copying this to leaf-devel)

Sorry, I was too fast, I did not look into the i386 code but the one in 
x86_64


Am 03.05.2017 um 20:03 schrieb Robert K Coffman Jr. -Info From Data Corp.:

Eric,

IRC user ddrown confirmed the x64 patch I mentioned earlier seems to fix
the issue on i386 as well.  I'm not really sure what to do with that
information.  Is it possible to patch Leaf with it?

https://gist.github.com/ddrown/15e943b8fe1da398320b0c0518c95554


I don't know. It looks like the RESTORE2 macro is extended with a nop 
operator in this patch. This looks like assembly code.


...

This is i386...

#define RESTORE(name, syscall) RESTORE2(name, syscall)

#ifdef __NR_rt_sigaction
/* The return code for realtime-signals.  */
# define RESTORE2(name, syscall) \
__asm__ (   \
".text\n"   \
"__" #name ":\n"\
"   movl$" #syscall ", %eax\n"  \
"   int $0x80\n"\
);
RESTORE(restore_rt, __NR_rt_sigreturn)
#endif

#ifdef __NR_sigreturn
/* For the boring old signals.  */
# undef RESTORE2
# define RESTORE2(name, syscall) \
__asm__ (   \
".text\n"   \
"__" #name ":\n"\
"   popl%eax\n" \
"   movl$" #syscall ", %eax\n"  \
"   int $0x80\n"\
);
RESTORE(restore, __NR_sigreturn)
#endif

and this is x86_64

#define RESTORE(name, syscall) RESTORE2(name, syscall)
#define RESTORE2(name, syscall) \
__asm__ (   \
"nop\n" \
".text\n"   \
"__" #name ":\n"\
"   movq$" #syscall ", %rax\n"  \
"   syscall\n"  \
);

#ifdef __NR_rt_sigaction
/* The return code for realtime-signals.  */
RESTORE(restore_rt, __NR_rt_sigreturn)
#endif
#ifdef __NR_sigreturn
RESTORE(restore, __NR_sigreturn)
#endif

So in i386 the patch appears to be possible, if it is necessary I don't 
know as it looks like the nop operator could be used to make the 
assembly code align to instruction size. The nop operator is already in 
the x86_64 code.


I have not followed uClibc development. I am wondering what their 
position is on this issue.


cheers

ET






smime.p7s
Description: S/MIME Cryptographic Signature
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
leaf-user mailing list: leaf-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/leaf-user
Support Request -- http://leaf-project.org/


Re: [leaf-user] ntpd segfaulting (copied to leaf-devel)

2017-05-03 Thread Erich Titl

Hi Bob

(copying this to leaf-devel)

Am 03.05.2017 um 20:03 schrieb Robert K Coffman Jr. -Info From Data Corp.:

Eric,

IRC user ddrown confirmed the x64 patch I mentioned earlier seems to fix
the issue on i386 as well.  I'm not really sure what to do with that
information.  Is it possible to patch Leaf with it?

https://gist.github.com/ddrown/15e943b8fe1da398320b0c0518c95554


I don't know. It looks like the RESTORE2 macro is extended with a nop 
operator in this patch. This looks like assembly code.


The thing that puzzles me most is that the current code looks like the 
following.


#define RESTORE(name, syscall) RESTORE2(name, syscall)
#define RESTORE2(name, syscall) \
__asm__ (   \
"nop\n" \
".text\n"   \
"__" #name ":\n"\
"   movq$" #syscall ", %rax\n"  \
"   syscall\n"  \
);

So it looks like the patch has already been applied. Very definitely 
ddrown has not started from the same codebase, so I would be very 
reluctant to follow this path.


cheers

ET





smime.p7s
Description: S/MIME Cryptographic Signature
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
leaf-user mailing list: leaf-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/leaf-user
Support Request -- http://leaf-project.org/


Re: [leaf-user] ntpd segfaulting

2017-05-03 Thread Robert K Coffman Jr. -Info From Data Corp.
Eric,

IRC user ddrown confirmed the x64 patch I mentioned earlier seems to fix 
the issue on i386 as well.  I'm not really sure what to do with that 
information.  Is it possible to patch Leaf with it?

https://gist.github.com/ddrown/15e943b8fe1da398320b0c0518c95554

- Bob


> So it really appears to boil down on uClibc. I believe KP ported that
> part, so the only thing I canrecomment is to file a bug, but it might
> take quite a while if uplink uClibc is involved.



--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot

leaf-user mailing list: leaf-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/leaf-user
Support Request -- http://leaf-project.org/