From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/3380 Path: news.gmane.org!not-for-mail From: plan9assembler Newsgroups: gmane.linux.lib.musl.general Subject: Re: util-linux-2.23 mount segmentation fault error Date: Thu, 30 May 2013 07:17:53 +0900 Message-ID: References: <20130525162604.GY20323@brightrain.aerifal.cx> <20130526091432.GE31915@port70.net> <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/alternative; boundary=047d7b5d4342cddcca04dde2c02e X-Trace: ger.gmane.org 1369865888 4809 80.91.229.3 (29 May 2013 22:18:08 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 29 May 2013 22:18:08 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-3384-gllmg-musl=m.gmane.org@lists.openwall.com Thu May 30 00:18:09 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 1Uhoh5-0005AA-Ay for gllmg-musl@plane.gmane.org; Thu, 30 May 2013 00:18:07 +0200 Original-Received: (qmail 3487 invoked by uid 550); 29 May 2013 22:18: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 3471 invoked from network); 29 May 2013 22:18:06 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=RJGFu82RxczxFV1V2iGBiyzlUYKkfYHBUy76ulAIjk4=; b=Bnbr1XOilJO1OJ3Gkc7nxezg8zS7f+zX4aVdXGuNoWQEUKN921ngSl1t2pgHtaANq+ dfQvq/5koqiPdjAOucfpgCMDvHhIt48ZbJkGuqkr5zQq5E7L3aqivsEDDEwFUEXllRZY AlFNdam7xuYmEchXvSYKMBs3EOsD3t3mRFXRLORJPldzQdxnxWXtnwIoAVfL0yy2ndNW dMOaWrDd1QdyFEAG/fJxNTzZWZEUFh2ZONKSB47FzyIAUQFb/hRcsmpz/SssPq9Lbmxq VxC7hC8WRfZnoKd5/s19ApthAnRYojtjCYMDjoY1ch3Ap/Z8EY8keD1TLbvNf9LqFvPJ Xmxw== X-Received: by 10.66.218.200 with SMTP id pi8mr5516162pac.40.1369865873905; Wed, 29 May 2013 15:17:53 -0700 (PDT) In-Reply-To: Xref: news.gmane.org gmane.linux.lib.musl.general:3380 Archived-At: --047d7b5d4342cddcca04dde2c02e Content-Type: text/plain; charset=ISO-8859-1 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 On Thu, May 30, 2013 at 7:07 AM, plan9assembler wrote: > could you send me the patch? i will test it. > > BTW, in latest musl-git version, i found something wrong with ioctl.h > > #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 > > if i set 0, it works fine run as "./mount", but set 1 then, > > > # ./mount /dev/sda1 /mnt > EXT4-fs (sda1): mounted filesystem with ordered data mode. Opts: (null) > > < 30 - 40 seconds waiting without return to shell> > > mount: /mnt: filesystem mounted, but mount(8) failedOperation timed out > // <-- this is weird. > # > > > > > > On Thu, May 30, 2013 at 5:04 AM, Szabolcs Nagy wrote: > >> * plan9assembler [2013-05-29 23:41:13 +0900]: >> > util-linux umount gets segfaults randomly..(X) >> > util-linux umount gets segfaults always..(O) >> > >> > # ./umount /mnt >> > traps: umount[9444] general protection ip:7f9c48e618fb sp:7fff72447b88 >> > error:0 in libc.so[7f9c48e16000+72000] >> > Segmentation fault. >> >> it seems util-linux uses sscanf with %ms to parse mtab >> in libmount in tab_parse.c >> >> after i fixed that mount and umount does not segfault here >> (used fixed size malloc and %s instead) >> > > --047d7b5d4342cddcca04dde2c02e Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
correction:

#if 1=A0
#define _IO(a,b) _IO= C(0U,(a),(b),0)=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 //?
#define _IOW(a,b,c) _IOC(1U,(a),(b),sizeof(c)) //?
#els= e
#define _IO(a,b) _IOC(0,(a),(b),0)=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0 //ok
#define _IOW(a,b,c) _IOC(1,(a),= (b),sizeof(c))=A0=A0 //ok
#endif

#define _IOR(a,b,c) _IOC(2U,(a),(b),sizeof(c))=A0 //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


On Thu, May 30, 2013 at 7:07 AM, plan9as= sembler <plan9assembler@gmail.com> wrote:
could you send me the patch? i wi= ll test it.

BTW, in latest musl-git version, i found something= wrong with ioctl.h

#if 1=A0
#define _IO(a,b) _= IOC(0U,(a),(b),0)=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 //?
#define _IOW(a,b,c) _IOC(1U,(a),(b),sizeof(c)) //?
#els= e
#define _IO(a,b) _IOC(0,(a),(b),0)=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0 //ok
#define _IOW(a,b,c) _IOC(1,(a),= (b),sizeof(c))=A0=A0 //ok
#endif

#define _IOR(a,b,c) _IOC(2U,(a),(b),sizeof(c))=A0 //ok
#define _IOW(a,b,c) _IOC(3U,(a),(b),sizeof(c)) //ok
<= br>
if i set 0, it works fine run as "./mount", but set 1 th= en,


# ./mount /dev/sda1 /mnt
EXT4-fs (sda1): mounted filesystem with ordered data mode. Opts: (null)

< 30 - 40  seconds waiting without return to shell>

mount: /mnt: filesystem mounted, but mount(8) failedOperation timed out
// <-- this is weird.
#




On Thu, Ma= y 30, 2013 at 5:04 AM, Szabolcs Nagy <nsz@port70.net> wrote:
* plan9assembler <plan9assembler@gmail.com> [20= 13-05-29 23:41:13 +0900]:
> util-linux umount gets segfaults randomly..(X)
> util-linux umount gets segfaults always..(O)
>
> # ./umount /mnt
> traps: umount[9444] general protection ip:7f9c48e618fb sp:7fff72447b88=
> error:0 in libc.so[7f9c48e16000+72000]
> Segmentation fault.

it seems util-linux uses sscanf with %ms to parse mtab
in libmount in tab_parse.c

after i fixed that mount and umount does not segfault here
(used fixed size malloc and %s instead)


--047d7b5d4342cddcca04dde2c02e--