From mboxrd@z Thu Jan 1 00:00:00 1970 From: Efraim Flashner Subject: Re: chroot/aarch64 issues Date: Tue, 5 Jul 2016 14:45:08 +0300 Message-ID: <20160705114508.GD6523@debian-netbook> References: <20160704104248.GA32334@debian-netbook> <87h9c5ed87.fsf@gnu.org> <20160704141514.GB32334@debian-netbook> <87oa6czd4w.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="C94crkcyjafcjHxo" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:52529) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bKOn8-0001G8-UQ for guix-devel@gnu.org; Tue, 05 Jul 2016 07:45:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bKOn2-0005Fz-Q6 for guix-devel@gnu.org; Tue, 05 Jul 2016 07:45:25 -0400 Content-Disposition: inline In-Reply-To: <87oa6czd4w.fsf@gnu.org> List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: Ludovic =?utf-8?Q?Court=C3=A8s?= Cc: guix-devel@gnu.org --C94crkcyjafcjHxo Content-Type: multipart/mixed; boundary="zS7rBR6csb6tI2e1" Content-Disposition: inline --zS7rBR6csb6tI2e1 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Jul 05, 2016 at 10:45:51AM +0200, Ludovic Court=C3=A8s wrote: > Efraim Flashner skribis: >=20 > > On Mon, Jul 04, 2016 at 03:37:12PM +0200, Ludovic Court=C3=A8s wrote: > >> Hi! > >>=20 > >> Efraim Flashner skribis: > >>=20 > >> > On the side I'm working on the aarch64 port, and I've come across a > >>=20 > >> Woohoo! > >>=20 > >> > snag. I've been unable to actually get anything to build. When I sta= rt > >> > the daemon as: > >> > `sudo ./pre-inst-env guix-daemon --build-users-group=3Dguixbuild', > >> > when I attempt to build hello I get back the error: > >> > guix build: error: build failed: cloning builder process: Invalid ar= gument > >>=20 > >> Could you strace the daemon itself? > >>=20 > >> sudo ./pre-inst-env strace -f -o log guix-daemon \ > >> --build-users-group=3Dguixbuild > >>=20 > >> I presume EINVAL is returned by clone(2), but it would be good to see > >> that syscall precisely. > > > > attached >=20 > The culprit is: >=20 > 4871 clone(child_stack=3D0x7fd850d338, flags=3DCLONE_NEWNS|CLONE_NEWUTS|= CLONE_NEWIPC|CLONE_NEWPID|CLONE_NEWNET|SIGCHLD) =3D -1 EINVAL (Invalid argu= ment) >=20 > >> What Linux version is this? > > > > $ uname -a > > Linux odroid-jessie64 3.14.65+ #2 SMP PREEMPT Sun Jul 3 18:29:45 > > UTC 2016 aarch64 GNU/Linux >=20 > According to clone(2), this version supports all of the above flags. >=20 > Also, the kernel config you posted has all the namespace options > enabled: >=20 > --8<---------------cut here---------------start------------->8--- > CONFIG_UTS_NS=3Dy > CONFIG_IPC_NS=3Dy > CONFIG_USER_NS=3Dy > CONFIG_PID_NS=3Dy > CONFIG_NET_NS=3Dy > --8<---------------cut here---------------end--------------->8--- >=20 > If the kernel config corresponds to this kernel, I don=E2=80=99t see whic= h of > the other EINVAL reasons given in clone(2) would apply. Does =E2=80=98dm= esg=E2=80=99 > show something? >=20 > Could you maybe try a C program that invokes clone(2) and progressively > remove CLONE_ flags until you find the one that=E2=80=99s causing EINVAL? >=20 > Thanks, > Ludo=E2=80=99. I ran the program from here http://man7.org/tlpi/code/online/dist/procexec/demo_clone.c.html and =66rom what I could tell it worked. I've attached the log anyway. grepping for "cloning builder process" led me to nix/libstore/build.cc . pid =3D clone(childEntry, stack + sizeof(stack) - 8, flags, this); the failing clone call: 4871 clone(child_stack=3D0x7fd850d338, flags=3DCLONE_NEWNS|CLONE_NEWUTS|CL= ONE_NEWIPC|CLONE_NEWPID|CLONE_NEWNET|SIGCHLD) =3D -1 EINVAL (Invalid argume= nt) the other clone calls: 4866 clone(child_stack=3D0, flags=3DCLONE_CHILD_CLEARTID|CLONE_CHILD_SETTI= D|SIGCHLD, child_tidptr=3D0x7fb24220d0) =3D 4871 4871 clone(child_stack=3D0, flags=3DCLONE_CHILD_CLEARTID|CLONE_CHILD_SETTI= D|SIGCHLD, child_tidptr=3D0x7fb24220d0) =3D 4872 4872 clone(child_stack=3D0x7facb0bae0, flags=3DCLONE_VM|CLONE_FS|CLONE_FIL= ES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSEM|CLONE_SETTLS|CLONE_PARENT_SETTI= D|CLONE_CHILD_CLEARTID, parent_tidptr=3D0x7facb0c2b0, tls=3D0x7facb0c8d0, c= hild_tidptr=3D0x7facb0c2b0) =3D 4873 4871 clone(child_stack=3D0, flags=3DCLONE_CHILD_CLEARTID|CLONE_CHILD_SETTI= D|SIGCHLD, child_tidptr=3D0x7fb24220d0) =3D 4875 without chroot there's no error since `if (useChroot)' is false. tidptr is apparently thread id pointer. I'm going to look more at http://man7.org/linux/man-pages/man2/set_tid_address.2.html and http://man7.org/linux/man-pages/man2/clone.2.html in case there's something specific about aarch64 causing problems. also, is this something I should look into? faccessat(AT_FDCWD, "/etc/ld.so.nohwcap", F_OK) =3D -1 ENOENT (No such file= or directory) --=20 Efraim Flashner =D7=90=D7=A4=D7=A8=D7=99=D7=9D = =D7=A4=D7=9C=D7=A9=D7=A0=D7=A8 GPG key =3D A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351 Confidentiality cannot be guaranteed on emails sent or received unencrypted --zS7rBR6csb6tI2e1 Content-Type: text/plain; charset=utf-8 Content-Disposition: attachment; filename=clone-log 10223 execve("./procexec/demo_clone", ["./procexec/demo_clone"], [/* 19 vars */]) = 0 10223 brk(0) = 0x413000 10223 faccessat(AT_FDCWD, "/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory) 10223 mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f82e76000 10223 faccessat(AT_FDCWD, "/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory) 10223 openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3 10223 fstat(3, {st_mode=S_IFREG|0644, st_size=22634, ...}) = 0 10223 mmap(NULL, 22634, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f82e70000 10223 close(3) = 0 10223 faccessat(AT_FDCWD, "/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory) 10223 openat(AT_FDCWD, "/lib/aarch64-linux-gnu/libm.so.6", O_RDONLY|O_CLOEXEC) = 3 10223 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0\267\0\1\0\0\0\340R\0\0\0\0\0\0"..., 832) = 832 10223 fstat(3, {st_mode=S_IFREG|0644, st_size=588696, ...}) = 0 10223 mmap(NULL, 651944, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f82daf000 10223 mprotect(0x7f82e3e000, 61440, PROT_NONE) = 0 10223 mmap(0x7f82e4d000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x8e000) = 0x7f82e4d000 10223 close(3) = 0 10223 faccessat(AT_FDCWD, "/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory) 10223 openat(AT_FDCWD, "/lib/aarch64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3 10223 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0\267\0\1\0\0\0\250\16\2\0\0\0\0\0"..., 832) = 832 10223 fstat(3, {st_mode=S_IFREG|0755, st_size=1287872, ...}) = 0 10223 mmap(NULL, 1360760, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f82c62000 10223 mprotect(0x7f82d95000, 65536, PROT_NONE) = 0 10223 mmap(0x7f82da5000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x133000) = 0x7f82da5000 10223 mmap(0x7f82dab000, 13176, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f82dab000 10223 close(3) = 0 10223 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f82e6f000 10223 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f82e6e000 10223 mprotect(0x7f82da5000, 16384, PROT_READ) = 0 10223 mprotect(0x7f82e4d000, 4096, PROT_READ) = 0 10223 mprotect(0x7f82e7a000, 4096, PROT_READ) = 0 10223 munmap(0x7f82e70000, 22634) = 0 10223 getpid() = 10223 10223 getppid() = 10218 10223 fstat(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 4), ...}) = 0 10223 mmap(NULL, 65536, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f82c52000 10223 write(1, "Parent: PID=10223 PPID=10218\n", 29) = 29 10223 umask(02) = 022 10223 openat(AT_FDCWD, "/dev/null", O_RDWR) = 3 10223 rt_sigaction(SIGTERM, {SIG_IGN, [TERM], SA_RESTART}, {SIG_DFL, [], 0}, 8) = 0 10223 brk(0) = 0x413000 10223 brk(0x444000) = 0x444000 10223 rt_sigaction(SIGUSR1, {0x400f90, [], SA_RESTART}, NULL, 8) = 0 10223 clone( 10224 getpid( 10223 <... clone resumed> child_stack=0x423000, flags=SIGUSR1) = 10224 10224 <... getpid resumed> ) = 10224 10224 getppid( 10223 wait4(-1, 10224 <... getppid resumed> ) = 10223 10224 write(1, "Child: PID=10224 PPID=10223\n", 29) = 29 10224 umask(020) = 02 10224 close(3) = 0 10224 rt_sigaction(SIGTERM, {SIG_DFL, [TERM], SA_RESTART}, {SIG_IGN, [TERM], SA_RESTART}, 8) = 0 10224 exit_group(22) = ? 10224 +++ exited with 22 +++ 10223 <... wait4 resumed> [{WIFEXITED(s) && WEXITSTATUS(s) == 22}], __WCLONE, NULL) = 10224 10223 --- SIGUSR1 {si_signo=SIGUSR1, si_code=0x1, si_pid=10224, si_uid=1000, si_value={int=22, ptr=0x16}} --- 10223 write(1, "Caught signal 10 (User defined s"..., 41) = 41 10223 rt_sigreturn() = 10224 10223 write(1, " Child PID=10224\n", 20) = 20 10223 write(1, " Status: child exited, status"..., 36) = 36 10223 write(1, "Parent - checking process attrib"..., 38) = 38 10223 umask(0) = 02 10223 write(1, " umask has not changed\n", 26) = 26 10223 write(3, "Hello world\n", 12) = 12 10223 write(1, " write() on file descriptor 3"..., 43) = 43 10223 rt_sigaction(SIGTERM, NULL, {SIG_IGN, [TERM], SA_RESTART}, 8) = 0 10223 write(1, " signal disposition has not c"..., 39) = 39 10223 exit_group(0) = ? 10223 +++ exited with 0 +++ --zS7rBR6csb6tI2e1-- --C94crkcyjafcjHxo Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCgAGBQJXe53BAAoJEPTB05F+rO6TkP4P/1OGXDhgQrkfN9s3clZepltu 6PJAdSfJQl6Ub8QY4QD96cSvH9BV8mM/9JlWENZhLcn5wRDH/f+ML8gmF0kqUsb1 qjWk/HSNtdAl+0DeyYyWs6+nJ/QttCShCMI0eeQyfZ4CiLQFDEv+mk//hQxN8RiD wN8mJg3bz3hPG5929e9/QVuvg33M+7CGEBpQGgt2aqz+PGZDqO+KgWv/yuzwXNp9 Ju/XXWnir89foV7InITAL3qj3mSfwrbgeTa0rSMhb4UvTnEvR9liH15crnf+VN/M F0IKVqxzAh7utto9R0na4gK4VbjN9zHcaNhS9KROIwSK3RjarhJlo4qs6dzDJyTC NF4ylXKvtTYh07GfX0iGENVqlBTEfiDoU85eSVrlyxYwSdb3d4oqKDsAAMqfps8M p6I5STi2X49kfFvdPrbptKuaETHGM7LFdPjCcQs/NsRSiz/RtyrFgd2vSWXwsYPq mS/r9rjtY/NEArfmQfKQpIXwOX9VDeky0/TIv8WzmGNAZVyORFmHjilHo35dcwcI H7Fym2eOITNAD+OQkatiShwLre6ROj0MlJWiznalt181ec7Gl3IfhmoHt8AlM8hy dzmU2AxjjXnEeEJw9bvs0t7sZy4APkX2gcHqhVfqSYIHDC6vlmE/sbXZCM/h59/e GzFJAs4u4YC9UDoJ6kq2 =p8cQ -----END PGP SIGNATURE----- --C94crkcyjafcjHxo--