mailing list of musl libc
 help / color / mirror / code / Atom feed
From: plan9assembler <plan9assembler@gmail.com>
To: musl@lists.openwall.com
Subject: Re: util-linux-2.23 mount segmentation fault error
Date: Thu, 30 May 2013 15:11:09 +0900	[thread overview]
Message-ID: <CAGSZau1pTVCUNad8DJDg1NQ6TaFDE8eEB90h4k-S+tiP_CADhg@mail.gmail.com> (raw)
In-Reply-To: <CAGSZau1CTsY0U=08cKuEBfYg-hGpow6cJ8T7-UDc9vhn=yuf6w@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 3615 bytes --]

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 <Address
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
#4  0x00007ffff79618e7 in mnt_table_parse_stream (tb=tb@entry=0x7ffff7ffb360,
f=f@entry=0x608a00, filename=<optimzed out>, filename@entry=0x7ffff7973e78
"/etc/mtab") at libmount/src/tab_parse.c:529
#5  0x00007ffff7961e26 in mnt_table_parse_file (tb=0x7ffff7ffb360,
filename=0x7ffff7973e78 "/etc/mtab") at libmount/src/tab_parse.c:584
#6  0x00007ffff796246f in mnt_table_parse_mtab (tb=0x7ffff7ffb360,
filename=0x7ffff7973e78 "/etc/mtab") at libmount/src/tab_parse.c:968
#7  0x00007ffff794fbf5 in mnt_context_get_mtab (cxt=cxt@entry=0x7ffff7ffb260,
tb=tb@entry=0x7fffffffec90) at libmount/src/context.c:958
#8  0x0000000000403c7d in print_all (show_label=0, pattern=0x0,
cxt=0x7ffff7ffb260) at sys-utils/mount.c:130
#9  main (argc=0, argv=0x7fffffffed40) at sys-utils/mount.c:1004
(gdb)



On Thu, May 30, 2013 at 7:17 AM, plan9assembler <plan9assembler@gmail.com>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
>
>
> On Thu, May 30, 2013 at 7:07 AM, plan9assembler <plan9assembler@gmail.com>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 <nsz@port70.net> wrote:
>>
>>> * plan9assembler <plan9assembler@gmail.com> [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)
>>>
>>
>>
>

[-- Attachment #2: Type: text/html, Size: 5339 bytes --]

  reply	other threads:[~2013-05-30  6:11 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-25 15:46 plan9assembler
2013-05-25 16:26 ` Rich Felker
2013-05-25 21:34   ` plan9assembler
2013-05-26  9:14     ` Szabolcs Nagy
2013-05-26 11:22       ` plan9assembler
2013-05-27 14:05         ` plan9assembler
2013-05-27 14:29           ` Szabolcs Nagy
2013-05-27 21:40             ` plan9assembler
2013-05-29 13:46               ` plan9assembler
2013-05-29 14:11               ` Luca Barbato
2013-05-29 14:32                 ` plan9assembler
2013-05-29 14:41                   ` plan9assembler
2013-05-29 20:04                     ` Szabolcs Nagy
2013-05-29 22:07                       ` plan9assembler
2013-05-29 22:17                         ` plan9assembler
2013-05-30  6:11                           ` plan9assembler [this message]
2013-05-30  6:43                             ` Szabolcs Nagy
2013-05-30  7:26                               ` plan9assembler
2013-05-30  8:37                                 ` Szabolcs Nagy
2013-06-01 23:14                                   ` plan9assembler
2013-06-01 23:16                                     ` plan9assembler
2013-06-02  1:50                                     ` John Spencer
2013-06-02 10:55                                       ` plan9assembler
2013-06-02 13:00                                         ` Szabolcs Nagy
2013-06-02 22:02                                           ` plan9assembler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAGSZau1pTVCUNad8DJDg1NQ6TaFDE8eEB90h4k-S+tiP_CADhg@mail.gmail.com \
    --to=plan9assembler@gmail.com \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).