Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220226134800.GB7074@brightrain.aerifal.cx>
Date: Sat, 26 Feb 2022 08:48:01 -0500
From: Rich Felker <dalias@...c.org>
To: naruto canada <narutocanada@...il.com>
Cc: musl@...ts.openwall.com
Subject: Re: Re: anyone know how to approach this problem (expect5.x.x
 hangs)

On Sat, Feb 26, 2022 at 02:46:10AM +0000, naruto canada wrote:
> On 2/25/22, Rich Felker <dalias@...c.org> wrote:
> > On Fri, Feb 25, 2022 at 07:35:39PM +0000, naruto canada wrote:
> >> On 2/25/22, naruto canada <narutocanada@...il.com> wrote:
> >> > hi
> >> >
> >> > I'm in the process of porting all my desktop env. over to musl.
> >> > I'm about 70% done. I hit a few minor snags but got over them.
> >> > I had expected a lot more painful experience, but it turned out ok.
> >> > I could not get xserver to compile but will work around using vnc for
> >> > now.
> >> > I am quite happy I got qemu to compile.
> >> > The last 30% (Browsers !!!), I dare not approach them right now.
> >> >
> >> > Anyway, back to my probem, expect5.x.x hangs,
> >> > no seg fault, so I do not know how to approach this problem.
> >> > normally I do a simple test:
> >> > expect -c "spawn ls" # this always succeeds.
> >> >
> >> > (I use expect to automate password creation)
> >> > VNCRP=123456 # need 6 characters # create ~/.vnc/passwd
> >> > echo '#!/usr/bin/expect
> >> > set timeout -1
> >> > spawn vncpasswd
> >> > expect "Password:"
> >> > send "'$VNCRP'\r"
> >> > expect "Verify:"
> >> > send "'$VNCRP'\r"
> >> > expect "Would you like to enter a view-only password (y/n)?"
> >> > send "n\r"
> >> > interact' > /tmp/p.ex
> >> > expect /tmp/p.ex
> >> > This script works fine under glibc, but hangs under musl.
> >> >
> >> > I've already tried the same version of expect and patches from
> >> > aports-3.15.0/main/expect/*.patch
> >> > I got the same result. (it hangs)
> >> >
> >> > This is not a priority problem for me. I can easily work around it
> >> > without using expect.
> >> > Just wondering if anyone know how to approach this problem (when there
> >> > is no seg fault)
> >>
> >> I did a quick strace, and compare it with glibc:
> >> GLIBC CASE:
> >> ....
> >> open("/tmp/p.ex", O_RDONLY)             = 4
> >> spawn vncpasswd
> >> open("/dev/ptmx", O_RDWR)               = 4
> >> open("/etc/group", O_RDONLY|O_CLOEXEC)  = 5
> >> open("/dev/pts/18", O_RDWR|O_NOCTTY)    = 5
> >> Password:
> >> Verify:
> >> Would you like to enter a view-only password (y/n)? n
> >> --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=956,
> >> si_status=0, si_utime=0, si_stime=0} ---
> >>
> >>                                 open("/dev/null", O_RDONLY)
> >>  = 4
> >>                      open("/dev/null", O_RDONLY)             = 3
> >> open("/dev/null", O_RDONLY)             = 2
> >> open("/dev/null", O_RDONLY)             = 0
> >> +++ exited with 0 +++
> >>
> >> MUSL CASE:
> >> open("/tmp/p.ex", O_RDONLY|O_LARGEFILE) = 7
> >> spawn vncpasswd
> >> open("/dev/ptmx", O_RDWR|O_NOCTTY|O_LARGEFILE) = 7
> >> open("/dev/pts/3", O_RDWR|O_NOCTTY|O_LARGEFILE) = 8
> >> syscall_397(0xffffff9c, 0xb6f624e0, 0, 0x7ff, 0xbe927e48, 0xb6f624e0)
> >> = -1 (errno 38)
> >> syscall_397(0x8, 0xb6f58350, 0x1000, 0x7ff, 0xbe927e48, 0xb6f624e0) =
> >> -1 (errno 38)
> >> syscall_403(0, 0xbe928258, 0xb6e82de0, 0, 0xbe928334, 0) = -1 (errno 38)
> >> syscall_389(0x10, 0, 0, 0xb6f62170, 0xbe92815c, 0xbe92808c) = -1 (errno
> >> 38)
> >>
> >> It seems to block or stopped at syscall_389
> >> ( arch/arm/bits/syscall.h.in:#define __NR_membarrier		389 )
> >
> > The syscall has returned, so it's something after that which is
> > hanging. Running under gdb and hitting ^C could show where.
> >
> > Something very wrong is going on here, since the syscalls are failing
> > with ENOSYS but no fallback path has been taken. If it's musl making
> > them, it will not assume these exist but will check for ENOSYS and
> > make an alternate syscall if that happens. So it would seem that
> > either these syscalls are being made directly by the application
> > (expect) or something went very wrong in building musl (weird patches?
> > stale build dir previously used for another arch? ..?) that has the
> > wrong thing happening.
> >
> > What kernel version are you using? There was a recent thread on the
> > list where someone had a badly patched kernel from Google that did
> > something to mess up ENOSYS, and strace hid the bug, so perhaps this
> > is similar.
> 
> It is compiled on (and running on) android phone.
> I have no control over the kernel (3.4.0-perf-g63c3cac) (LG G3).
> (I have already matched kernel header (3.4.0) when compile the tool
> and the World)
> I used 3.10.x before and got into problem, so I matched the kernel header
> this time. This is the gdb result (I ran 3 times). It always stopped
> at the same place:

The kernel headers you use should not matter at all. Do you know where
we can find the sources for LG's kernel? I'm guessing they did
something horrible...

Rich

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.