mailing list of musl libc
 help / color / mirror / code / Atom feed
From: naruto canada <narutocanada@gmail.com>
To: musl@lists.openwall.com
Subject: [musl] Re: anyone know how to approach this problem (expect5.x.x hangs)
Date: Fri, 25 Feb 2022 19:35:39 +0000	[thread overview]
Message-ID: <CAKrOiPTdJQ3kLqeet2457sf-fxA=pbhb+VspmiusgF8yJXMHxw@mail.gmail.com> (raw)
In-Reply-To: <CAKrOiPQ2idv0f94VQBvyVHm6esQMCcyyTtp-6M5NUA4-XyNrUA@mail.gmail.com>

On 2/25/22, naruto canada <narutocanada@gmail.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 )

cd /build/musl-1.2.2/;
grep membarrier * -r
...
include/sys/membarrier.h:int membarrier(int, int);
ldso/dynlink.c:#include <sys/membarrier.h>
ldso/dynlink.c:	 * if the new dtv pointer is. The __membarrier function has a
ldso/dynlink.c:	__membarrier(MEMBARRIER_CMD_PRIVATE_EXPEDITED, 0);
...
src/internal/pthread_impl.h:hidden void __membarrier_init(void);
src/linux/membarrier.c:#include <sys/membarrier.h>
src/linux/membarrier.c:int __membarrier(int cmd, int flags)
src/linux/membarrier.c:	int r = __syscall(SYS_membarrier, cmd, flags);
src/linux/membarrier.c:void __membarrier_init(void)
src/linux/membarrier.c:	/* If membarrier is linked, attempt to
pre-register to be able to use
src/linux/membarrier.c:	__syscall(SYS_membarrier,
MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED, 0);
src/linux/membarrier.c:weak_alias(__membarrier, membarrier);
src/thread/pthread_create.c:weak_alias(dummy_0, __membarrier_init);
src/thread/pthread_create.c:		__membarrier_init();

I have no idea how to go further.

> Thanks.
>

  reply	other threads:[~2022-02-25 19:35 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-25 17:59 [musl] " naruto canada
2022-02-25 19:35 ` naruto canada [this message]
2022-02-25 23:32   ` [musl] " Rich Felker
2022-02-26  2:46     ` naruto canada
2022-02-26 13:48       ` Rich Felker
2022-02-27 15:35         ` naruto canada
2022-02-27 21:29           ` naruto canada
2022-02-28  0:16             ` Rich Felker

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='CAKrOiPTdJQ3kLqeet2457sf-fxA=pbhb+VspmiusgF8yJXMHxw@mail.gmail.com' \
    --to=narutocanada@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).