From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/3383 Path: news.gmane.org!not-for-mail From: Szabolcs Nagy Newsgroups: gmane.linux.lib.musl.general Subject: Re: util-linux-2.23 mount segmentation fault error Date: Thu, 30 May 2013 08:43:54 +0200 Message-ID: <20130530064353.GE7095@port70.net> References: <20130527142929.GF31915@port70.net> <51A60C74.6050500@gentoo.org> <20130529200453.GC7095@port70.net> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="vkogqOf2sHV7VnPd" X-Trace: ger.gmane.org 1369896246 17860 80.91.229.3 (30 May 2013 06:44:06 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 30 May 2013 06:44:06 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-3387-gllmg-musl=m.gmane.org@lists.openwall.com Thu May 30 08:44:07 2013 Return-path: Envelope-to: gllmg-musl@plane.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1Uhwak-0008Eg-IC for gllmg-musl@plane.gmane.org; Thu, 30 May 2013 08:44:06 +0200 Original-Received: (qmail 31814 invoked by uid 550); 30 May 2013 06:44:06 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 31806 invoked from network); 30 May 2013 06:44:05 -0000 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Xref: news.gmane.org gmane.linux.lib.musl.general:3383 Archived-At: --vkogqOf2sHV7VnPd Content-Type: text/plain; charset=us-ascii Content-Disposition: inline * plan9assembler [2013-05-30 15:11:09 +0900]: > here is backtrace of gdb for "./mount /dev/sda1 /mnt" > > Program received signal SIGSEGV, Segmentation fault. > 0x00007ffff7dd58fb in strlen () from /lib/ld-musl-x86_64.so.1 > (gdb) at > #0 0x00007ffff7dd58fb in strlen () from /lib/ld-musl-x86_64.so.1 > #1 0x00007ffff79614b6 in unmangle_string (s=0x6164732f7665642f
0x616732f7665642 out of bounds>) at ./include/mangle.h:17 > #2 mnt_parse_table_line (s=0x7fffffffe640 "/dev/sda1 /mnt ext4 rw 0 0", > fs=0x608f00) at libmount/src/tab_parse.c:78 > #3 mnt_table_parse_next (tb=tb@entry=0x7ffff7ffb360, f=f@entry=0x608a00, > fs=fs@entry=0x608f00, filename=filename@entry=0x7ffff7973e78 "/etc/mtab", > nlines=nlines@entry=0x7fffffffeab4) at at libmount/src/tab_parse.c:396 yes this is the %ms issue i was talking about > On Thu, May 30, 2013 at 7:17 AM, plan9assembler wrote: > > correction: > > > > #if 1 > > #define _IO(a,b) _IOC(0U,(a),(b),0) //? > > #define _IOW(a,b,c) _IOC(1U,(a),(b),sizeof(c)) //? > > #else > > #define _IO(a,b) _IOC(0,(a),(b),0) //ok > > #define _IOW(a,b,c) _IOC(1,(a),(b),sizeof(c)) //ok > > #endif > > > > #define _IOR(a,b,c) _IOC(2U,(a),(b),sizeof(c)) //ok > > - #define _IOW(a,b,c) _IOC(3U,(a),(b),sizeof(c)) //ok > > + #define _IOWR(a,b,c) _IOC(3U,(a),(b),sizeof(c)) //ok this does not make sense to me > > On Thu, May 30, 2013 at 7:07 AM, plan9assembler wrote: > >> could you send me the patch? i will test it. my super sophisticated patch has no warranty you could do better parsing or wait for musl to support %ms --vkogqOf2sHV7VnPd Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="ms.diff" --- util-linux-2.23/libmount/src/tab_parse.c 2013-04-12 12:04:05.000000000 +0200 +++ util-linux/libmount/src/tab_parse.c 2013-05-30 08:37:39.000000000 +0200 @@ -61,16 +61,18 @@ int rc, n = 0, xrc; char *src = NULL, *fstype = NULL, *optstr = NULL; +#undef UL_SCNsA +#define UL_SCNsA "%s" rc = sscanf(s, UL_SCNsA" " /* (1) source */ UL_SCNsA" " /* (2) target */ UL_SCNsA" " /* (3) FS type */ UL_SCNsA" " /* (4) options */ "%n", /* byte count */ - &src, - &fs->target, - &fstype, - &optstr, + src=malloc(200), + fs->target=malloc(200), + fstype=malloc(200), + optstr=malloc(200), &n); xrc = rc; @@ -147,9 +149,9 @@ &fs->id, &fs->parent, &maj, &min, - &fs->root, - &fs->target, - &fs->vfs_optstr, + fs->root=malloc(200), + fs->target=malloc(200), + fs->vfs_optstr=malloc(200), &end); if (rc >= 7 && end > 0) @@ -169,9 +171,9 @@ UL_SCNsA" " /* (9) source */ UL_SCNsA, /* (10) fs options (fs specific) */ - &fstype, - &src, - &fs->fs_optstr); + fstype=malloc(200), + src=malloc(200), + fs->fs_optstr=malloc(200)); if (rc >= 10) { fs->flags |= MNT_FS_KERNEL; @@ -285,8 +287,8 @@ "%jd" /* (4) used */ "%d", /* priority */ - &src, - &fs->swaptype, + src=malloc(200), + fs->swaptype=malloc(200), &fsz, &usz, &fs->priority); --vkogqOf2sHV7VnPd--