Re: CVS commit: src/sys/arch/atari/stand/installboot
martin@ wrote: I still don't see the segmentation violation - what am I missing? Gdb is a bit confused about the stack: (gdb) bt #0 0x0008c2b8 in ?? () #1 0xaba4 in ?? () #2 0xbc34 in ?? () #3 0x0006fce8 in ?? () #4 0x in ?? () With unstripped binary, it looks distrib/utils/libhack issue? --- (gdb) run y/0123456789/abcdefghij/ Starting program: /r/work/netbsd-7/src/distrib/atari/floppies/install/obj.atari/sed/sed y/0123456789/abcdefghij/ Program received signal SIGSEGV, Segmentation fault. 0x0008bbce in mbsrtowcs () (gdb) bt #0 0x0008bbce in mbsrtowcs () #1 0x0006f9b2 in compile_stream.clone () #2 0x0006fbf2 in compile$$from$$sed () #3 0x0006ff28 in _crunched_sed_stub () #4 0x21e6 in ___start () #5 0x20d4 in _start () (gdb) --- Izumi Tsutsui
Re: CVS commit: src/sys/arch/atari/stand/installboot
I wrote: With unstripped binary, it looks distrib/utils/libhack issue? --- (gdb) run y/0123456789/abcdefghij/ Starting program: /r/work/netbsd-7/src/distrib/atari/floppies/install/obj.atari/sed/sed y/0123456789/abcdefghij/ Program received signal SIGSEGV, Segmentation fault. 0x0008bbce in mbsrtowcs () (gdb) bt #0 0x0008bbce in mbsrtowcs () #1 0x0006f9b2 in compile_stream.clone () #2 0x0006fbf2 in compile$$from$$sed () #3 0x0006ff28 in _crunched_sed_stub () #4 0x21e6 in ___start () #5 0x20d4 in _start () (gdb) With -g debug binary: --- (gdb) run y/0123456789/abcdefghij/ Starting program: /r/work/netbsd-7/src/distrib/atari/floppies/install/obj.atari/sed/sed y/0123456789/abcdefghij/ Program received signal SIGSEGV, Segmentation fault. 0x0007d662 in mbrtowc (ps=0x0, max_sz=1, str=0xffefdc27 0123456789, wc=0x0) at /r/work/netbsd-7/src/distrib/utils/libhack/multibyte.c:15 15 return str == NULL || (*wc = (unsigned char)*str) == 0 ? 0 : 1; (gdb) bt #0 0x0007d662 in mbrtowc (ps=0x0, max_sz=1, str=0xffefdc27 0123456789, wc=0x0) at /r/work/netbsd-7/src/distrib/utils/libhack/multibyte.c:15 #1 mbsrtowcs (pwcs=0x0, s=0xffefd41c, n=0, ps=0x0) at /r/work/netbsd-7/src/distrib/utils/libhack/multibyte.c:98 #2 0x00062dee in compile_tr (py=0x10204054, p=0x1bc325 lbuf+24 ) at /r/work/netbsd-7/src/usr.bin/sed/compile.c:676 #3 compile_stream (link=0x10204040) at /r/work/netbsd-7/src/usr.bin/sed/compile.c:356 #4 0x00063010 in compile () at /r/work/netbsd-7/src/usr.bin/sed/compile.c:144 #5 0x00101a24 in main (argc=optimized out, argv=0xffefecc0) at /r/work/netbsd-7/src/usr.bin/sed/main.c:207 #6 0x21e6 in ___start () #7 0x20d4 in _start () (gdb) --- Izumi Tsutsui
Re: CVS commit: src/sys/arch/atari/stand/installboot
On Nov 15, 1:43pm, tsut...@ceres.dti.ne.jp (Izumi Tsutsui) wrote: -- Subject: Re: CVS commit: src/sys/arch/atari/stand/installboot | How about this one? (cksum seems updated properly on the real machine) That looks nicer, go for it! christos | | --- installboot/installboot.c 2014-11-14 13:21:10.0 +0900 | +++ installboot/installboot.c 2014-11-14 23:03:28.0 +0900 | @@ -467,7 +467,10 @@ | struct disklabel *label, u_int magic) | { | int fd; | - uint16_t sum; | + union { | + struct bootblock *bbp; | + uint16_t *word; /* to fill cksum word */ | + } bbsec; | | memset(bb, 0, sizeof(*bb)); | | @@ -499,10 +502,9 @@ | setIDEpar(bb-bb_xxboot, sizeof(bb-bb_xxboot)); | | /* set AHDI checksum */ | - sum = 0; | - memcpy(bb-bb_xxboot + 255 * sizeof(sum), sum, sizeof(sum)); | - sum = 0x1234 - abcksum(bb-bb_xxboot); | - memcpy(bb-bb_xxboot + 255 * sizeof(sum), sum, sizeof(sum)); | + bbsec.bbp = bb; | + bbsec.word[255] = 0; | + bbsec.word[255] = 0x1234 - abcksum(bb-bb_xxboot); | | if (verbose) { | printf(Primary boot loader: %s\n, xxb); | | --- | Izumi Tsutsui -- End of excerpt from Izumi Tsutsui
Re: CVS commit: src/sys/arch/atari/stand/installboot
On Nov 15, 10:46pm, tsut...@ceres.dti.ne.jp (Izumi Tsutsui) wrote: -- Subject: Re: CVS commit: src/sys/arch/atari/stand/installboot | Program received signal SIGSEGV, Segmentation fault. | 0x0007d662 in mbrtowc (ps=0x0, max_sz=1, str=0xffefdc27 0123456789, wc=0x0) | at /r/work/netbsd-7/src/distrib/utils/libhack/multibyte.c:15 | 15 return str == NULL || (*wc = (unsigned char)*str) == 0 ? 0 : 1; Ok, this is a bug in libhack; please cvs update. christos
Re: CVS commit: src/sys
On Sat, Nov 15, 2014 at 6:49 PM, Takeshi Nakayama nakay...@netbsd.org wrote: Module Name:src Committed By: nakayama Date: Sat Nov 15 18:49:05 UTC 2014 Modified Files: src/sys/netsmb: iconv.c src/sys/rump/dev/lib/libnetsmb: Makefile Added Files: src/sys/rump/dev/lib/libnetsmb: netsmb_iconv.c netsmb_user.c netsmb_user.h Log Message: Make rump_smbfs(8) uses host iconv(3) to convert filenames character set. Er, you can't do that. 1. It breaks the rump builds on most platforms http://build.myriabit.eu:8012/waterfall as the prototypes dont match eg see http://build.myriabit.eu:8012/builders/ppc64-cross/builds/5585/steps/shell_3/logs/stdio 2. There is no requirement that rump runs on a platform that has iconv anyway, it may be running on bare metal, or non Posix platform. Not sure what the intention was though - I am sure we can find a way around it... Justin
Re: CVS commit: src/sys/arch/atari/stand/installboot
Date: Sat, 15 Nov 2014 13:43:16 +0900 From: Izumi Tsutsui tsut...@ceres.dti.ne.jp -uint16_t sum; +union { +struct bootblock *bbp; +uint16_t *word; /* to fill cksum word */ +} bbsec; ... -sum = 0; -memcpy(bb-bb_xxboot + 255 * sizeof(sum), sum, sizeof(sum)); -sum = 0x1234 - abcksum(bb-bb_xxboot); -memcpy(bb-bb_xxboot + 255 * sizeof(sum), sum, sizeof(sum)); +bbsec.bbp = bb; +bbsec.word[255] = 0; +bbsec.word[255] = 0x1234 - abcksum(bb-bb_xxboot); Um, that has the same issue as the original code, no? It still refers to the content of the struct bootblock object by two different types, struct bootblock and uint16_t -- passing the pointer through a union doesn't change that. What's wrong with the memcpy? If you don't like the way the memcpy code looks, you could write set16(bb-bb_xxboot, 255, 0); set16(bb-bb_xxboot, 255, 0x1234 - abcksum(bb-bb_xxboot)); void set16(void *p, size_t off, uint16_t v) { memcpy((uint8_t *)p + off*sizeof(uint16_t), v, sizeof v); } I don't see any byte ordering issues here that weren't present before.
Re: CVS commit: src/sys
Justin Cormack jus...@specialbusservice.com wrote Er, you can't do that. 1. It breaks the rump builds on most platforms http://build.myriabit.eu:8012/waterfall as the prototypes dont match eg see http://build.myriabit.eu:8012/builders/ppc64-cross/builds/5585/steps/shell_3/logs/stdio It seems that posix says 2nd arg of iconv(3) is char **, but NetBSD's one is const char **. 2. There is no requirement that rump runs on a platform that has iconv anyway, it may be running on bare metal, or non Posix platform. Not sure what the intention was though - I am sure we can find a way around it... I would like to include this at least on NetBSD host since we don't have kernel iconv and then mount_smbfs(8) is useless for filename conversions. So is it ok to add a compile-time option as below and define it somewhere? Or are there any more appropriate make variables to detect host OS? -- Takeshi Nakayama Index: Makefile === RCS file: /cvsroot/src/sys/rump/dev/lib/libnetsmb/Makefile,v retrieving revision 1.5 diff -u -d -r1.5 Makefile --- Makefile15 Nov 2014 18:49:04 - 1.5 +++ Makefile15 Nov 2014 22:56:53 - @@ -13,8 +13,10 @@ CPPFLAGS+= -I${RUMPTOP}/librump/rumpvfs #CPPFLAGS+=-DSMB_SOCKET_DEBUG -DSMB_IOD_DEBUG +.if ${RUMP_NETSMB_ICONV:Uno} == yes SRCS+= netsmb_iconv.c RUMPCOMP_USER_SRCS=netsmb_user.c +.endif .include bsd.lib.mk .include bsd.klinks.mk
Re: CVS commit: src/sys
Takeshi Nakayama t...@catvmics.ne.jp wrote Justin Cormack jus...@specialbusservice.com wrote Er, you can't do that. 1. It breaks the rump builds on most platforms http://build.myriabit.eu:8012/waterfall as the prototypes dont match eg see http://build.myriabit.eu:8012/builders/ppc64-cross/builds/5585/steps/shell_3/logs/stdio It seems that posix says 2nd arg of iconv(3) is char **, but NetBSD's one is const char **. 2. There is no requirement that rump runs on a platform that has iconv anyway, it may be running on bare metal, or non Posix platform. Not sure what the intention was though - I am sure we can find a way around it... I would like to include this at least on NetBSD host since we don't have kernel iconv and then mount_smbfs(8) is useless for filename conversions. So is it ok to add a compile-time option as below and define it somewhere? Or are there any more appropriate make variables to detect host OS? On second thought, it seems user component can use __NetBSD__ definition, how about this change? -- Takeshi Nakayama Index: netsmb_user.c === RCS file: /cvsroot/src/sys/rump/dev/lib/libnetsmb/netsmb_user.c,v retrieving revision 1.1 diff -u -d -r1.1 netsmb_user.c --- netsmb_user.c 15 Nov 2014 18:49:04 - 1.1 +++ netsmb_user.c 16 Nov 2014 00:21:28 - @@ -36,6 +36,7 @@ int rumpcomp_netsmb_iconv_open(const char *to, const char *from, void **handle) { +#ifdef __NetBSD__ iconv_t cd; int rv; @@ -49,11 +50,16 @@ } return rumpuser_component_errtrans(rv); +#else + /* fallback to use stub functions */ + return 0; +#endif } int rumpcomp_netsmb_iconv_close(void *handle) { +#ifdef __NetBSD__ int rv; if (iconv_close((iconv_t)handle) == -1) @@ -62,12 +68,17 @@ rv = 0; return rumpuser_component_errtrans(rv); +#else + /* do nothing */ + return 0; +#endif } int rumpcomp_netsmb_iconv_conv(void *handle, const char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft) { +#ifdef __NetBSD__ int rv; if (iconv((iconv_t)handle, inbuf, inbytesleft, outbuf, outbytesleft) @@ -77,5 +88,9 @@ rv = 0; return rumpuser_component_errtrans(rv); +#else + /* do nothing */ + return 0; +#endif } #endif
Re: CVS commit: src/sys/arch/atari/stand/installboot
christos@ wrote: | Program received signal SIGSEGV, Segmentation fault. | 0x0007d662 in mbrtowc (ps=0x0, max_sz=1, str=0xffefdc27 0123456789, wc=0x0) | at /r/work/netbsd-7/src/distrib/utils/libhack/multibyte.c:15 | 15 return str == NULL || (*wc = (unsigned char)*str) == 0 ? 0 : 1; Ok, this is a bug in libhack; please cvs update. Christos, could you please at least compile before commit? http://mail-index.netbsd.org/source-changes/2014/11/15/msg060599.html Log Message: Remove unused variable. Such botch and additional fixes make pullups annoying... --- Izumi Tsutsui
Re: CVS commit: src/sys/arch/atari/stand/installboot
On Nov 16, 1:20pm, tsut...@ceres.dti.ne.jp (Izumi Tsutsui) wrote: -- Subject: Re: CVS commit: src/sys/arch/atari/stand/installboot | Christos, could you please at least compile before commit? I compiled, but not with the right flags (obviously). | http://mail-index.netbsd.org/source-changes/2014/11/15/msg060599.html | Log Message: | Remove unused variable. | | Such botch and additional fixes make pullups annoying... Sorry, christos