How to elf/tst-ldconfig-* in cross test setup
Hi,
The following tests fail invariably on ARC cross testing setup
FAIL: elf/tst-dlopen-self-container
FAIL: elf/tst-dlopen-tlsmodid-container
FAIL: elf/tst-ldconfig-bad-aux-cache
FAIL: elf/tst-ldconfig-ld_so_conf-update
FAIL: elf/tst-pldd
This is despite having ldconfig on target.
The issue is expected src-path for dso.
| [pid 168] renameat(AT_FDCWD, "/usr/lib/tst-ldconfig-ld-mod.so", AT_FDCWD, | "/tmp/tst-ldconfig/libldconfig-ld-mod.so") = -1 EXDEV | (Invalid cross-device link)
In cross setup, /usr/lib needs to be the host path where test is built or the dso needs to be copied over to target at the canonical location. I'm not sure what the right approach is so any pointers would be great.
Thx,
-Vineet
_______________________________________________
linux-snps-arc mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-snps-arc
Quoted 9 lines · Vineet Gupta via Libc-alpha
The issue is expected src-path for dso.
| [pid 168] renameat(AT_FDCWD, "/usr/lib/tst-ldconfig-ld-mod.so", AT_FDCWD, | "/tmp/tst-ldconfig/libldconfig-ld-mod.so") = -1 EXDEV | (Invalid cross-device link)In cross setup,
/usr/libneeds to be the host path where test is built or the dso needs to be copied over to target at the canonical location. I'm not sure what the right approach is so any pointers would be great.
This rename should be happening inside the test-container, in a subdirectory of the build, so should not be a cross-dev link. Are you trying to run these tests manually?
_______________________________________________
linux-snps-arc mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-snps-arc
Quoted 7 lines · DJ Delorie via Libc-alpha
Quoted 6 lines · Vineet Gupta via Libc-alpha
The issue is expected src-path for dso.
| [pid 168] renameat(AT_FDCWD, "/usr/lib/tst-ldconfig-ld-mod.so", AT_FDCWD, | "/tmp/tst-ldconfig/libldconfig-ld-mod.so") = -1 EXDEV | (Invalid cross-device link)
Quoted 7 lines
Quoted 3 lines
In cross setup,
/usr/libneeds to be the host path where test is built or the dso needs to be copied over to target at the canonical location. I'm not sure what the right approach is so any pointers would be great.This rename should be happening inside the test-container, in a subdirectory of the build, so should not be a cross-dev link. Are you trying to run these tests manually?
No, I'm running this is a cross-compiled setup where the test artifacts are on a NFS mounted host. Here's the full strace for test
$ strace_static -f ~/br/build/glibc-867196a7635/build/elf/tst-ldconfig-ld_so_conf-update
execve("~/br/build/glibc-867196a7635/build/elf/tst-ldconfig-ld_so_conf-update", ["~/br"...], 0x5ffffdc4 /* 11 va0
brk(NULL) = 0x1a000uname({sysname="Linux", nodename="hsdk", ...}) = 0faccessat(AT_FDCWD, "/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)openat(AT_FDCWD, "/lib/tls/libdl.so.2", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)statx(AT_FDCWD, "/lib/tls", AT_STATX_SYNC_AS_STAT|AT_NO_AUTOMOUNT, STATX_BASIC_STATS, 0x5ffff164) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "/lib/libdl.so.2", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\303\0\1\0\0\0<\v\0\0004\0\0\0"...,
512) = 512
statx(3, "", AT_STATX_SYNC_AS_STAT|AT_EMPTY_PATH, STATX_BASIC_STATS, {stx_mask=STATX_BASIC_STATS, stx_attributes=0, stx_mode=S_IFREG|0755, stx_size=309012, ...}) = 0mmap2(NULL, 16516, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x20020000 mmap2(0x20022000, 16384, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0) = 0x20022000
close(3) = 0openat(AT_FDCWD, "/lib/libc.so.6", O_RDONLY|O_CLOEXEC) = 3read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\303\0\1\0\0\0\340\264\1\0004\0\0\0"..., 512) = 512
statx(3, "", AT_STATX_SYNC_AS_STAT|AT_EMPTY_PATH, STATX_BASIC_STATS, {stx_mask=STATX_BASIC_STATS, stx_attributes=0, stx_mode=S_IFREG|0755, stx_size=24324580, ...}) = 0mmap2(NULL, 1060392, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x20026000mprotect(0x20122000, 8192, PROT_NONE) = 0mmap2(0x20124000, 16384, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0xfc000) = 0x20124000 mmap2(0x20128000, 3624, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x20128000
close(3) = 0mmap2(NULL, 16384, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2012a000
arc_settls(0x2012a478) = 0 mprotect(0x20124000, 8192, PROT_READ) = 0 mprotect(0x20022000, 8192, PROT_READ) = 0 mprotect(0x16000, 8192, PROT_READ) = 0 mprotect(0x2001c000, 8192, PROT_READ) = 0
mmap2(NULL, 8, PROT_READ|PROT_WRITE, MAP_SHARED|MAP_ANONYMOUS, -1, 0) = 0x2001a000 clone(child_stack=NULL, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x2012a06c) = 2322 /home/vineetg/arc/BR-glibc/strace_static: Process 2322 attached
[pid 2321] rt_sigaction(SIGALRM, {sa_handler=0x123f8, sa_mask=[ALRM], sa_flags=SA_RESTORER|SA_RESTART, sa_restorer=0x200513f8}, <unfinished ...> [pid 2322] prlimit64(0, RLIMIT_CORE, {rlim_cur=0, rlim_max=0}, <unfinished ...> [pid 2321] <... rt_sigaction resumed>{sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
[pid 2322] <... prlimit64 resumed>NULL) = 0
[pid 2322] setpgid(0, 0 <unfinished ...>
[pid 2321] setitimer(ITIMER_REAL, {it_interval={tv_sec=0, tv_usec=20},it_value={tv_sec=20, tv_usec=894348}}, <unfinished ...>
[pid 2322] <... setpgid resumed>) = 0
[pid 2321] <... setitimer resumed>{it_interval={tv_sec=0, tv_usec=0}, it_value={tv_sec=6917526297652493452, tv_usec=2306054381734274040}}) = 0 [pid 2322] statx(AT_FDCWD, "/var/cache/ldconfig", AT_STATX_SYNC_AS_STAT|AT_NO_AUTOMOUNT, STATX_BASIC_STATS, <unfinished ...> [pid 2321] rt_sigaction(SIGINT, {sa_handler=0x123f8, sa_mask=[INT], sa_flags=SA_RESTORER|SA_RESTART, sa_restorer=0x200513f8}, <unfinished ...> [pid 2322] <... statx resumed>{stx_mask=STATX_BASIC_STATS, stx_attributes=0, stx_mode=S_IFDIR|0700, stx_size=60, ...}) = 0
[pid 2321] <... rt_sigaction resumed>{sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
[pid 2322] statx(AT_FDCWD, "/tmp/tst-ldconfig", AT_STATX_SYNC_AS_STAT|AT_NO_AUTOMOUNT, STATX_BASIC_STATS, <unfinished ...> [pid 2321] wait4(2322, <unfinished ...>
[pid 2322] <... statx resumed>{stx_mask=STATX_BASIC_STATS, stx_attributes=0, stx_mode=S_IFDIR|0755, stx_size=40, ...}) = 0
[pid 2322] brk(NULL) = 0x1a000 [pid 2322] brk(0x3c000) = 0x3c000 [pid 2322] renameat(AT_FDCWD,
"~/br/build/glibc-867196a7635/build/elf/tst-ldconfig-ld-mod.so", AT_FDCWD, "/tmp/tst-ldconfig/libldconfig-ld-)
[pid 2322] write(1, "error: tst-ldconfig-ld_so_conf-u"..., 44error:
tst-ldconfig-ld_so_conf-update.c:78: ) = 44
[pid 2322] write(1, "Renaming/moving the DSO failed: "..., 57Renaming/moving the DSO failed: Invalid cross-device link) = 57
[pid 2322] write(1, "\n", 1
) = 1
[pid 2322] exit_group(1) = ?
[pid 2322] +++ exited with 1 +++
_______________________________________________
linux-snps-arc mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-snps-arc
Quoted 6 lines · Vineet Gupta
No, I'm running this is a cross-compiled setup where the test artifacts are on a NFS mounted host. Here's the full strace for test
$ strace_static -f ~/br/build/glibc-867196a7635/build/elf/tst-ldconfig-ld_so_conf-update
This is a manual run. Even with a cross setup, you still run test-container on the cross target:
$ strace_static -f ~/br/build/glibc-867196a7635/build/support/test-container \ ~/br/build/glibc-867196a7635/build/elf/tst-ldconfig-ld_so_conf-update
The containerized tests are (in this case) containerized because they rely on setup files (like /etc/ld.so.conf) inside the container to run the test. Otherwise you end up corrupting the host OS.
The test infrastructure knows how to run containerized tests on remote machines, though... any reason why you're not using that setup?
Note: if containers aren't yet supported on your platform, it's OK to just skip those tests. Also, it's not always a good idea to run a containerized test outside the container; the tests assume they can trash the container as part of the test.
_______________________________________________
linux-snps-arc mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-snps-arc
Quoted 10 lines · DJ Delorie via Libc-alpha
Quoted 6 lines · Vineet Gupta
No, I'm running this is a cross-compiled setup where the test artifacts are on a NFS mounted host. Here's the full strace for test
$ strace_static -f ~/br/build/glibc-867196a7635/build/elf/tst-ldconfig-ld_so_conf-updateThis is a manual run. Even with a cross setup, you still run test-container on the cross target:
Sorry for derailing you. The strace itself was a manual run to see/show what was going on - but I forgot that the very act of observing changed the execution/outcome ;-)
Quoted 11 lines
$ strace_static -f ~/br/build/glibc-867196a7635/build/support/test-container \ ~/br/build/glibc-867196a7635/build/elf/tst-ldconfig-ld_so_conf-updateThe containerized tests are (in this case) containerized because they rely on setup files (like
/etc/ld.so.conf) inside the container to run the test. Otherwise you end up corrupting the host OS.The test infrastructure knows how to run containerized tests on remote machines, though... any reason why you're not using that setup?
I was using that setup all along: this was my original host cmdline:
$ make test-wrapper='<full path to>/br/build/glibc-867196a7635/scripts/cross-test-ssh.sh [email protected]' xcheck subdirs=elf
Quoted 4 lines
Note: if containers aren't yet supported on your platform, it's OK to just skip those tests. Also, it's not always a good idea to run a containerized test outside the container; the tests assume they can trash the container as part of the test.
When you say containers is this linux cgroups or something at a higher level: does it need any specific distro container package. Please remember this is a constrained system built off of buildroot.
_______________________________________________
linux-snps-arc mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-snps-arc
Quoted 11 lines · Vineet Gupta
Quoted 6 lines
The containerized tests are (in this case) containerized because they rely on setup files (like
/etc/ld.so.conf) inside the container to run the test. Otherwise you end up corrupting the host OS.The test infrastructure knows how to run containerized tests on remote machines, though... any reason why you're not using that setup?
I was using that setup all along: this was my original host cmdline:
$ make test-wrapper='<full path to>/br/build/glibc-867196a7635/scripts/cross-test-ssh.sh [email protected]' xcheck subdirs=elf
FWIW the original failures were here
lock_fd = open (concat (pristine_root_path, "/lock.fd", NULL),
O_CREAT | O_TRUNC | O_RDWR, 0666);
if (lock_fd < 0)
FAIL_EXIT1 ("Cannot create testroot lock.\n"); <----_______________________________________________
linux-snps-arc mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-snps-arc
Quoted 10 lines · Vineet Gupta
Quoted 3 lines
$ make test-wrapper='<full path to>/br/build/glibc-867196a7635/scripts/cross-test-ssh.sh [email protected]' xcheck subdirs=elfFWIW the original failures were here
lock_fd= open (concat (pristine_root_path, "/lock.fd", NULL),O_CREAT | O_TRUNC | O_RDWR, 0666); if (lock_fd < 0) FAIL_EXIT1 ("Cannot create testroot lock.\n"); <----
That's inside test-container.c and should be referring to the test-root's root (i.e. <full path to>/br/build/glibc-867196a7635/testroot.root/lock.fd
Is there a UID mismatch between the two systems? Did you run a full "make check" at least once, to build the initial testroot? It does a full "make install" into $build/testroot.pristine/ to use as the basis for the container's root.
_______________________________________________
linux-snps-arc mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-snps-arc
Quoted 12 lines · DJ Delorie via Libc-alpha
Quoted 10 lines · Vineet Gupta
Quoted 3 lines
$ make test-wrapper='<full path to>/br/build/glibc-867196a7635/scripts/cross-test-ssh.sh [email protected]' xcheck subdirs=elfFWIW the original failures were here
lock_fd= open (concat (pristine_root_path, "/lock.fd", NULL),O_CREAT | O_TRUNC | O_RDWR, 0666); if (lock_fd < 0) FAIL_EXIT1 ("Cannot create testroot lock.\n"); <----
Quoted 4 lines
That's inside
test-container.cand should be referring to the test-root's root (i.e. <full path to>/br/build/glibc-867196a7635/testroot.root/lock.fdIs there a UID mismatch between the two systems?
Possibly because I'm vineetg on host and running testsuite on target as root.
Quoted 4 lines
Did you run a full
"make check" at least once, to build the initial testroot? It does a full "make install" into $build/testroot.pristine/ to use as the basis for the container's root.
I definitely did not do that - let me try that.
_______________________________________________
linux-snps-arc mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-snps-arc
Quoted 18 lines · Vineet Gupta via Libc-alpha
Quoted 12 lines · DJ Delorie via Libc-alpha
Quoted 10 lines · Vineet Gupta
Quoted 3 lines
$ make test-wrapper='<full path to>/br/build/glibc-867196a7635/scripts/cross-test-ssh.sh [email protected]' xcheck subdirs=elfFWIW the original failures were here
lock_fd= open (concat (pristine_root_path, "/lock.fd", NULL),O_CREAT | O_TRUNC | O_RDWR, 0666); if (lock_fd < 0) FAIL_EXIT1 ("Cannot create testroot lock.\n"); <----Quoted 4 lines
That's inside
test-container.cand should be referring to the test-root's root (i.e. <full path to>/br/build/glibc-867196a7635/testroot.root/lock.fdIs there a UID mismatch between the two systems?
Quoted 8 lines
Possibly because I'm vineetg on host and running testsuite on target as root.
Quoted 4 lines
Did you run a full
"make check" at least once, to build the initial testroot? It does a full "make install" into $build/testroot.pristine/ to use as the basis for the container's root.I definitely did not do that - let me try that.
That helps, atleast they no longer FAIL :-)
UNSUPPORTED: elf/tst-ldconfig-bad-aux-cache
UNSUPPORTED: elf/tst-ldconfig-ld_so_conf-update
...
_______________________________________________
linux-snps-arc mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-snps-arc
Quoted 9 lines · Vineet Gupta via Libc-alpha
Quoted 5 lines
Quoted 4 lines
Did you run a full
"make check" at least once, to build the initial testroot? It does a full "make install" into $build/testroot.pristine/ to use as the basis for the container's root.I definitely did not do that - let me try that.
That helps, atleast they no longer FAIL :-)
UNSUPPORTED: elf/tst-ldconfig-bad-aux-cache
UNSUPPORTED: elf/tst-ldconfig-ld_so_conf-update
After enabling the full namespace support in kernel
Quoted 3 lines
CONFIG_UTS_NS=yCONFIG_USER_NS=yCONFIG_PID_NS=y
there's just one failure left.
PASS: elf/tst-dlopen-self-container
PASS: elf/tst-dlopen-tlsmodid-container
PASS: elf/tst-ldconfig-bad-aux-cache
PASS: elf/tst-pldd
FAIL: elf/tst-ldconfig-ld_so_conf-update
I enabled verbose output in test-container, but don't see any obvious issue except it failing in the very last step.
| error: tst-ldconfig-ld_so_conf-update.c:112: not true: dlopen (DSO, RTLD_NOW | | RTLD_GLOBAL) != NULL
I'll rerun the whole suite tomorrow. Thx much for you help.
-Vineet
_______________________________________________
linux-snps-arc mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-snps-arc
Quoted 3 lines · Vineet Gupta
When you say containers is this linux cgroups or something at a higher
level: does it need any specific distro container package. Please remember this is a constrained system built off of buildroot.
It should not require anything beyond what kernel/glibc provides - we even build our own /bin/sh for in-container use. All the containerization code is in support/test-container.c. However, some kernels and/or OSs are *configured* (i.e. for security reasons) to disallow certain types of namespace unsharing - those should be detected by test-container and flagged as unsupported tests.
By "container" I mean a simple filesystem/pid namespace using unshare, sort of a fancy chroot() but it changes your UID and PID also.
See https://developers.redhat.com/blog/2018/11/16/microcontainers-for-unit-testing/
for some background info.
_______________________________________________
linux-snps-arc mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-snps-arc