Re: How to elf/tst-ldconfig-* in cross test setup

2020-03-11 Thread Vineet Gupta
On 3/11/20 3:56 PM, Vineet Gupta via Libc-alpha wrote:
>>>  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

> CONFIG_UTS_NS=y
> CONFIG_USER_NS=y
> CONFIG_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
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


Re: How to elf/tst-ldconfig-* in cross test setup

2020-03-11 Thread Vineet Gupta
On 3/11/20 3:28 PM, DJ Delorie via Libc-alpha wrote:
> Vineet Gupta  writes:
>>> $ make test-wrapper='>> to>/br/build/glibc-867196a7635/scripts/cross-test-ssh.sh root@192.168.0.20' 
>>> 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");   <
> 
> That's inside test-container.c and should be referring to the
> test-root's root (i.e.  to>/br/build/glibc-867196a7635/testroot.root/lock.fd
> 
> Is there a UID mismatch between the two systems?

Possibly because I'm vineetg on host and running testsuite on target as root.

>  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
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


Re: How to elf/tst-ldconfig-* in cross test setup

2020-03-11 Thread DJ Delorie
Vineet Gupta  writes:
>> $ make test-wrapper='> to>/br/build/glibc-867196a7635/scripts/cross-test-ssh.sh root@192.168.0.20' 
>> 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");   <

That's inside test-container.c and should be referring to the
test-root's root (i.e. /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
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


Re: How to elf/tst-ldconfig-* in cross test setup

2020-03-11 Thread DJ Delorie
Vineet Gupta  writes:
> 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
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


Re: How to elf/tst-ldconfig-* in cross test setup

2020-03-11 Thread Vineet Gupta
On 3/11/20 3:14 PM, Vineet Gupta wrote:
>> 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=' to>/br/build/glibc-867196a7635/scripts/cross-test-ssh.sh root@192.168.0.20' 
> 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
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


Re: How to elf/tst-ldconfig-* in cross test setup

2020-03-11 Thread Vineet Gupta
On 3/11/20 3:07 PM, DJ Delorie via Libc-alpha wrote:
> Vineet Gupta  writes:
>> 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:

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 ;-)

> 
> $ 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?

I was using that setup all along: this was my original host cmdline:

$ make test-wrapper='/br/build/glibc-867196a7635/scripts/cross-test-ssh.sh root@192.168.0.20' 
xcheck
subdirs=elf


> 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
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


Re: How to elf/tst-ldconfig-* in cross test setup

2020-03-11 Thread DJ Delorie
Vineet Gupta  writes:
> 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
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


Re: How to elf/tst-ldconfig-* in cross test setup

2020-03-11 Thread Vineet Gupta
On 3/11/20 2:36 PM, DJ Delorie via Libc-alpha wrote:
> Vineet Gupta via Libc-alpha  writes:
>> 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.
> 
> 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"...], 0x5dc4 /* 11 va0
brk(NULL)   = 0x1a000
uname({sysname="Linux", nodename="hsdk", ...}) = 0
faccessat(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, 0x5164) = -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, ...}) = 0
mmap2(NULL, 16516, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 
0x2002
mmap2(0x20022000, 16384, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0) = 0x20022000
close(3)= 0
openat(AT_FDCWD, "/lib/libc.so.6", 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\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, ...}) = 0
mmap2(NULL, 1060392, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) =
0x20026000
mprotect(0x20122000, 8192, PROT_NONE)   = 0
mmap2(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)= 0
mmap2(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},  
[pid  2322] prlimit64(0, RLIMIT_CORE, {rlim_cur=0, rlim_max=0},  
[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 
[pid  2321] setitimer(ITIMER_REAL, {it_interval={tv_sec=0, tv_usec=20},
it_value={tv_sec=20, tv_usec=894348}},  
[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,  
[pid  2321] rt_sigaction(SIGINT, {sa_handler=0x123f8, sa_mask=[INT],
sa_flags=SA_RESTORER|SA_RESTART, sa_restorer=0x200513f8},  
[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,  
[pid  2321] wait4(2322,  
[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", 

Re: How to elf/tst-ldconfig-* in cross test setup

2020-03-11 Thread DJ Delorie
Vineet Gupta via Libc-alpha  writes:
> 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.

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
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc