<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugzilla.yoctoproject.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugzilla.yoctoproject.org/"
          
          maintainer="it-coreprojects-helpdesk@linuxfoundation.org"
>

    <bug>
          <bug_id>14223</bug_id>
          
          <creation_ts>2021-02-05 18:16:33 +0000</creation_ts>
          <short_desc>valgrind ptest failing on qemux86-64</short_desc>
          <delta_ts>2026-01-22 16:05:29 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>10</classification_id>
          <classification>QA/Testing</classification>
          <product>Package Testing (ptest)</product>
          <component>ptest</component>
          <version>3.3</version>
          <rep_platform>Other</rep_platform>
          <op_sys>x86_64</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Medium+</priority>
          <bug_severity>enhancement</bug_severity>
          <target_milestone>6.99</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Jon Mason">jon.mason</reporter>
          <assigned_to name="Mingli Yu">mingli.yu</assigned_to>
          <cc>alexandre.belloni</cc>
    
    <cc>flowergom</cc>
    
    <cc>Jagadheesan_Duraisamy</cc>
    
    <cc>joaomarcos.costa</cc>
    
    <cc>leonardo.sandoval</cc>
    
    <cc>raj.khem</cc>
    
    <cc>randy.macleod</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>No (bug/feature does not impact docs)</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>89152</commentid>
    <comment_count>0</comment_count>
    <who name="Jon Mason">jon.mason</who>
    <bug_when>2021-02-05 18:16:33 +0000</bug_when>
    <thetext>Seeing valgrind ptest failing in multiple runs with the new glibc.  For example:


WARNING: core-image-sato-sdk-ptest-1.0-r0 do_testimage: There were failing ptests.
Traceback (most recent call last):
  File &quot;/home/pokybuild/yocto-worker/qemux86-64-ptest/build/meta/lib/oeqa/core/decorator/__init__.py&quot;, line 36, in wrapped_f
    return func(*args, **kwargs)
  File &quot;/home/pokybuild/yocto-worker/qemux86-64-ptest/build/meta/lib/oeqa/core/decorator/__init__.py&quot;, line 36, in wrapped_f
    return func(*args, **kwargs)
  File &quot;/home/pokybuild/yocto-worker/qemux86-64-ptest/build/meta/lib/oeqa/core/decorator/__init__.py&quot;, line 36, in wrapped_f
    return func(*args, **kwargs)
  File &quot;/home/pokybuild/yocto-worker/qemux86-64-ptest/build/meta/lib/oeqa/runtime/cases/ptest.py&quot;, line 25, in test_ptestrunner_expectfail
    self.do_ptestrunner()
  File &quot;/home/pokybuild/yocto-worker/qemux86-64-ptest/build/meta/lib/oeqa/runtime/cases/ptest.py&quot;, line 112, in do_ptestrunner
    self.fail(failmsg)
AssertionError: Failed ptests:
{&apos;valgrind&apos;: [&apos;gdbserver_tests/nlcontrolc&apos;]}
Cannot run ptests without @expectedFailure as ptests are expected to fail
RESULTS:
RESULTS - ping.PingTest.test_ping: PASSED (0.61s)
RESULTS - ssh.SSHTest.test_ssh: PASSED (0.17s)
RESULTS - ptest.PtestRunnerTest.test_ptestrunner_expectsuccess: SKIPPED (0.00s)
RESULTS - ptest.PtestRunnerTest.test_ptestrunner_expectfail: EXPECTEDFAIL (10957.28s)
SUMMARY:
core-image-sato-sdk-ptest () - Ran 4 tests in 10958.078s
core-image-sato-sdk-ptest - OK - All required tests passed (successes=2, skipped=1, failures=0, errors=0)
NOTE: recipe core-image-sato-sdk-ptest-1.0-r0: task do_testimage: Succeeded
NOTE: Tasks Summary: Attempted 910 tasks of which 909 didn&apos;t need to be rerun and all succeeded.


See https://autobuilder.yoctoproject.org/typhoon/#/builders/81/builds/1769
https://autobuilder.yoctoproject.org/typhoon/#/builders/81/builds/1772
https://autobuilder.yoctoproject.org/typhoon/#/builders/81/builds/1774</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>89159</commentid>
    <comment_count>1</comment_count>
    <who name="Minjae Kim">flowergom</who>
    <bug_when>2021-02-08 03:23:15 +0000</bug_when>
    <thetext>Happened again:
https://autobuilder.yoctoproject.org/typhoon/#/builders/81/builds/1777/steps/12/logs/stdio

WARNING: core-image-sato-sdk-ptest-1.0-r0 do_testimage: There were failing ptests.
Traceback (most recent call last):
  File &quot;/home/pokybuild/yocto-worker/qemux86-64-ptest/build/meta/lib/oeqa/core/decorator/__init__.py&quot;, line 36, in wrapped_f
    return func(*args, **kwargs)
  File &quot;/home/pokybuild/yocto-worker/qemux86-64-ptest/build/meta/lib/oeqa/core/decorator/__init__.py&quot;, line 36, in wrapped_f
    return func(*args, **kwargs)
  File &quot;/home/pokybuild/yocto-worker/qemux86-64-ptest/build/meta/lib/oeqa/core/decorator/__init__.py&quot;, line 36, in wrapped_f
    return func(*args, **kwargs)
  File &quot;/home/pokybuild/yocto-worker/qemux86-64-ptest/build/meta/lib/oeqa/runtime/cases/ptest.py&quot;, line 25, in test_ptestrunner_expectfail
    self.do_ptestrunner()
  File &quot;/home/pokybuild/yocto-worker/qemux86-64-ptest/build/meta/lib/oeqa/runtime/cases/ptest.py&quot;, line 112, in do_ptestrunner
    self.fail(failmsg)
AssertionError: Failed ptests:
{&apos;valgrind&apos;: [&apos;gdbserver_tests/nlcontrolc&apos;]}
Cannot run ptests without @expectedFailure as ptests are expected to fail</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>89163</commentid>
    <comment_count>2</comment_count>
    <who name="Minjae Kim">flowergom</who>
    <bug_when>2021-02-08 08:10:02 +0000</bug_when>
    <thetext>Happened again:

https://autobuilder.yoctoproject.org/typhoon/#/builders/81/builds/1781/steps/12/logs/stdio

WARNING: core-image-sato-sdk-ptest-1.0-r0 do_testimage: There were failing ptests.
Traceback (most recent call last):
  File &quot;/home/pokybuild/yocto-worker/qemux86-64-ptest/build/meta/lib/oeqa/core/decorator/__init__.py&quot;, line 36, in wrapped_f
    return func(*args, **kwargs)
  File &quot;/home/pokybuild/yocto-worker/qemux86-64-ptest/build/meta/lib/oeqa/core/decorator/__init__.py&quot;, line 36, in wrapped_f
    return func(*args, **kwargs)
  File &quot;/home/pokybuild/yocto-worker/qemux86-64-ptest/build/meta/lib/oeqa/core/decorator/__init__.py&quot;, line 36, in wrapped_f
    return func(*args, **kwargs)
  File &quot;/home/pokybuild/yocto-worker/qemux86-64-ptest/build/meta/lib/oeqa/runtime/cases/ptest.py&quot;, line 25, in test_ptestrunner_expectfail
    self.do_ptestrunner()
  File &quot;/home/pokybuild/yocto-worker/qemux86-64-ptest/build/meta/lib/oeqa/runtime/cases/ptest.py&quot;, line 112, in do_ptestrunner
    self.fail(failmsg)
AssertionError: Failed ptests:
{&apos;valgrind&apos;: [&apos;gdbserver_tests/nlcontrolc&apos;]}</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>89170</commentid>
    <comment_count>3</comment_count>
    <who name="Minjae Kim">flowergom</who>
    <bug_when>2021-02-09 01:01:30 +0000</bug_when>
    <thetext>Happened again:

https://autobuilder.yoctoproject.org/typhoon/#/builders/81/builds/1785/steps/12/logs/stdio

Bitbake still alive (5000s)
WARNING: core-image-sato-sdk-ptest-1.0-r0 do_testimage: There were failing ptests.
Traceback (most recent call last):
  File &quot;/home/pokybuild/yocto-worker/qemux86-64-ptest/build/meta/lib/oeqa/core/decorator/__init__.py&quot;, line 36, in wrapped_f
    return func(*args, **kwargs)
  File &quot;/home/pokybuild/yocto-worker/qemux86-64-ptest/build/meta/lib/oeqa/core/decorator/__init__.py&quot;, line 36, in wrapped_f
    return func(*args, **kwargs)
  File &quot;/home/pokybuild/yocto-worker/qemux86-64-ptest/build/meta/lib/oeqa/core/decorator/__init__.py&quot;, line 36, in wrapped_f
    return func(*args, **kwargs)
  File &quot;/home/pokybuild/yocto-worker/qemux86-64-ptest/build/meta/lib/oeqa/runtime/cases/ptest.py&quot;, line 25, in test_ptestrunner_expectfail
    self.do_ptestrunner()
  File &quot;/home/pokybuild/yocto-worker/qemux86-64-ptest/build/meta/lib/oeqa/runtime/cases/ptest.py&quot;, line 112, in do_ptestrunner
    self.fail(failmsg)
AssertionError: Failed ptests:
{&apos;valgrind&apos;: [&apos;gdbserver_tests/nlcontrolc&apos;]}</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>89171</commentid>
    <comment_count>4</comment_count>
    <who name="Minjae Kim">flowergom</who>
    <bug_when>2021-02-09 01:03:51 +0000</bug_when>
    <thetext>Happened again:
https://autobuilder.yoctoproject.org/typhoon/#/builders/81/builds/1789/steps/12/logs/stdio

WARNING: core-image-sato-sdk-ptest-1.0-r0 do_testimage: There were failing ptests.
Traceback (most recent call last):
  File &quot;/home/pokybuild/yocto-worker/qemux86-64-ptest/build/meta/lib/oeqa/core/decorator/__init__.py&quot;, line 36, in wrapped_f
    return func(*args, **kwargs)
  File &quot;/home/pokybuild/yocto-worker/qemux86-64-ptest/build/meta/lib/oeqa/core/decorator/__init__.py&quot;, line 36, in wrapped_f
    return func(*args, **kwargs)
  File &quot;/home/pokybuild/yocto-worker/qemux86-64-ptest/build/meta/lib/oeqa/core/decorator/__init__.py&quot;, line 36, in wrapped_f
    return func(*args, **kwargs)
  File &quot;/home/pokybuild/yocto-worker/qemux86-64-ptest/build/meta/lib/oeqa/runtime/cases/ptest.py&quot;, line 25, in test_ptestrunner_expectfail
    self.do_ptestrunner()
  File &quot;/home/pokybuild/yocto-worker/qemux86-64-ptest/build/meta/lib/oeqa/runtime/cases/ptest.py&quot;, line 112, in do_ptestrunner
    self.fail(failmsg)
AssertionError: Failed ptests:
{&apos;valgrind&apos;: [&apos;gdbserver_tests/nlcontrolc&apos;]}</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>89172</commentid>
    <comment_count>5</comment_count>
    <who name="Minjae Kim">flowergom</who>
    <bug_when>2021-02-09 01:05:41 +0000</bug_when>
    <thetext>Happened again:
https://autobuilder.yoctoproject.org/typhoon/#/builders/81/builds/1782/steps/12/logs/stdio</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>89205</commentid>
    <comment_count>6</comment_count>
    <who name="Minjae Kim">flowergom</who>
    <bug_when>2021-02-11 13:45:47 +0000</bug_when>
    <thetext>Happened again:

https://autobuilder.yoctoproject.org/typhoon/#/builders/81/builds/1795/steps/12/logs/stdio</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>89208</commentid>
    <comment_count>7</comment_count>
    <who name="Minjae Kim">flowergom</who>
    <bug_when>2021-02-11 13:48:18 +0000</bug_when>
    <thetext>Happened again:
https://autobuilder.yoctoproject.org/typhoon/#/builders/81/builds/1792/steps/12/logs/stdio</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>89234</commentid>
    <comment_count>8</comment_count>
    <who name="Yi Fan Yu">yf3yu</who>
    <bug_when>2021-02-11 17:17:25 +0000</bug_when>
    <thetext>When I quickly ran locally, maybe not with the most up todate version of poky
I see the test was skipped. 
my head is sitting at f5188da2f12bee03e087c20d90720250e65e2922

SKIP: gdbserver_tests/nlcontrolc</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>89239</commentid>
    <comment_count>9</comment_count>
    <who name="Yi Fan Yu">yf3yu</who>
    <bug_when>2021-02-11 20:52:05 +0000</bug_when>
    <thetext>reproduced... last comment was on arm silly me.

2021-02-11T20:36
BEGIN: /usr/lib/valgrind/ptest
Hide valgrind tests that are non-deterministic
Reported at https://bugs.kde.org/show_bug.cgi?id=430321
mv: cannot stat &apos;drd/tests/bar_bad.vgtest&apos;: No such file or directory
mv: cannot stat &apos;drd/tests/bar_bad_xml.vgtest&apos;: No such file or directory
timed out
PASS: gdbserver_tests/hginfo
timed out
PASS: gdbserver_tests/hgtls
PASS: gdbserver_tests/mcblocklistsearch
PASS: gdbserver_tests/mcbreak
PASS: gdbserver_tests/mcclean_after_fork
PASS: gdbserver_tests/mchelp
timed out
PASS: gdbserver_tests/mcinfcallRU
timed out
FAIL: gdbserver_tests/mcinfcallWSRU
PASS: gdbserver_tests/mcinvokeRU
PASS: gdbserver_tests/mcinvokeWS
PASS: gdbserver_tests/mcleak
PASS: gdbserver_tests/mcmain_pic
PASS: gdbserver_tests/mcsignopass
PASS: gdbserver_tests/mcsigpass
PASS: gdbserver_tests/mcvabits
timed out
FAIL: gdbserver_tests/mcwatchpoints
PASS: gdbserver_tests/mssnapshot
timed out
FAIL: gdbserver_tests/nlcontrolc
PASS: gdbserver_tests/nlfork_chain

seems to be a timeout issue... again</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>89244</commentid>
    <comment_count>10</comment_count>
    <who name="Yi Fan Yu">yf3yu</who>
    <bug_when>2021-02-12 01:19:28 +0000</bug_when>
    <thetext>downgraded to glibc2.32: no timeout failures

seems related to the recent glibc2.33 uprev</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>89250</commentid>
    <comment_count>11</comment_count>
    <who name="Yi Fan Yu">yf3yu</who>
    <bug_when>2021-02-12 16:10:14 +0000</bug_when>
    <thetext>on poky commit: (prior to glibc2.33)

commit 03bf6b3ec0aaa24e9f81b3b0024c59f7cc77b410 (HEAD)
Author: Mingli Yu &lt;mingli.yu@windriver.com&gt;
Date:   Thu Feb 4 17:07:14 2021 +0800

timed out
FAIL: drd/tests/annotate_barrier

=== Test Summary ===                                                                                    
TOTAL: 726                         
PASSED: 687                         
FAILED: 1                       
SKIPPED: 38                       
DURATION: 1260</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>89255</commentid>
    <comment_count>12</comment_count>
    <who name="Yi Fan Yu">yf3yu</who>
    <bug_when>2021-02-12 20:03:25 +0000</bug_when>
    <thetext>nlcontrolc hangs on archlinux with glibc2.33 and valgrind 3.16.1 built from source

trying to see if valgrind master fixed this issue</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>89256</commentid>
    <comment_count>13</comment_count>
    <who name="Yi Fan Yu">yf3yu</who>
    <bug_when>2021-02-12 20:05:41 +0000</bug_when>
    <thetext>clarification: archlinux keeps most up to date packages unlike other distro


only valgrind was built from source, every other tool was from their most up-date repo.

https://archlinux.org/packages/core/x86_64/glibc/</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>89257</commentid>
    <comment_count>14</comment_count>
    <who name="Yi Fan Yu">yf3yu</who>
    <bug_when>2021-02-12 21:19:07 +0000</bug_when>
    <thetext>filed a bug report, a similar bug was reported couple months ago for arm64

https://bugs.kde.org/show_bug.cgi?id=432870</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>89269</commentid>
    <comment_count>15</comment_count>
    <who name="Jagadheesan">Jagadheesan_Duraisamy</who>
    <bug_when>2021-02-16 10:57:54 +0000</bug_when>
    <thetext>Happened again:
https://autobuilder.yoctoproject.org/typhoon/#/builders/81/builds/1809/steps/12/logs/stdio

WARNING: core-image-sato-sdk-ptest-1.0-r0 do_testimage: There were failing ptests.
Traceback (most recent call last):
  File &quot;/home/pokybuild/yocto-worker/qemux86-64-ptest/build/meta/lib/oeqa/core/decorator/__init__.py&quot;, line 36, in wrapped_f
    return func(*args, **kwargs)
  File &quot;/home/pokybuild/yocto-worker/qemux86-64-ptest/build/meta/lib/oeqa/core/decorator/__init__.py&quot;, line 36, in wrapped_f
    return func(*args, **kwargs)
  File &quot;/home/pokybuild/yocto-worker/qemux86-64-ptest/build/meta/lib/oeqa/core/decorator/__init__.py&quot;, line 36, in wrapped_f
    return func(*args, **kwargs)
  File &quot;/home/pokybuild/yocto-worker/qemux86-64-ptest/build/meta/lib/oeqa/runtime/cases/ptest.py&quot;, line 25, in test_ptestrunner_expectfail
    self.do_ptestrunner()
  File &quot;/home/pokybuild/yocto-worker/qemux86-64-ptest/build/meta/lib/oeqa/runtime/cases/ptest.py&quot;, line 112, in do_ptestrunner
    self.fail(failmsg)
AssertionError: Failed ptests:

 &apos;valgrind&apos;: [&apos;gdbserver_tests/nlcontrolc&apos;]}

Cannot run ptests without @expectedFailure as ptests are expected to fail</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>89274</commentid>
    <comment_count>16</comment_count>
    <who name="Yi Fan Yu">yf3yu</who>
    <bug_when>2021-02-16 17:56:03 +0000</bug_when>
    <thetext>this commit for glibc (present in 2.33 but not 2.32) is causing this test to fail
when i rebuilt glibc with a patch to revert this commit, the test *passes*.

```
commit 2433d39b69743f100f972e7886f91a2e21795ef0
Author: Adhemerval Zanella &lt;adhemerval.zanella@linaro.org&gt;
Date:   Mon Jul 6 16:06:51 2020 -0300

    linux: Add time64 select support

```

since this commit is the root cause, dropping that particular patch as a temporary workaround is the easiest solution as it is a high priority bug (until a fix for either valgrind or glibc is implemented)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>89277</commentid>
    <comment_count>17</comment_count>
    <who name="Yi Fan Yu">yf3yu</who>
    <bug_when>2021-02-17 04:53:46 +0000</bug_when>
    <thetext>nlcontrolc basically means sending a &quot;ctrl-c&quot; to the process in gdb.

the test runs `LOOP` amount of `select` syscall to select which does nothing other than wait for the `TIMEOUT` (4th arg) to expire.
Also note that 3 other threads (4 total) are also doing the exact same thing.

`TIMEOUT` and `LOOP` are very large numbers, so the test would hang...

unless the user sends a ctrl-c with gdb (which basically means causing a SIGTRAP) -&gt; giving control back to gdb.

we change TIMEOUT to 0 (for all 4 threads) and let the process run again

if we are able to do it successfully, the test would complete much faster and on the next SIGTRAP we send, we should be no longer stuck in the the `select` syscall.


Obviously in our bug, we probably weren&apos;t able to successfully get out of `select`, maybe because in linux(glibc), `select` actually updates the remaining amount of timeout in the same spot that gdb is trying to overwrite (so another thread/process can read that value) 

Looking into this interaction:

https://man7.org/linux/man-pages/man2/select.2.html:
```
On Linux, select() modifies timeout to reflect the amount of time
       not slept; most other implementations do not do this.  (POSIX.1
       permits either behavior.) 
```</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>89278</commentid>
    <comment_count>18</comment_count>
    <who name="Yi Fan Yu">yf3yu</who>
    <bug_when>2021-02-17 05:44:22 +0000</bug_when>
    <thetext>Update: `LOOP` doesn&apos;t even matter, the burn time and the sleep(select timeout) is long enough already. setting the timeout argument to 0 will just make the threads go to burn (also taking a long time)


Another update:
seems like we have an compiler optimization problem after running the test manually:
./sleepers 1000000000 1000000000 1000000000 BSBSBSBS 1
info threads

```
* 1    Thread 0x7ffff7ddb740 (LWP 340) &quot;sleepers&quot; 0x00007ffff7ecf619 in __GI___select (nfds=0, readfds=0x0, writefds=0x0, exceptfds=0x0, timeout=&lt;optimized out&gt;)
```

not really sure why it would happen when we add that glibc patch, how does glibc deal with timeout?

testing with volatile</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>89279</commentid>
    <comment_count>19</comment_count>
    <who name="Yi Fan Yu">yf3yu</who>
    <bug_when>2021-02-17 06:17:23 +0000</bug_when>
    <thetext>looking more like a glibc issue (at least for the glibc 2.32-&gt;2.33 failure on x86-64) 

if the timeout parameter gets optimized out by the compiler. There is no reason for the compiler to optimize it out since the timeout parameter gets filled by a value coming from argv.

the only reason I suspect that would happen is a problem down in glibc where timeout doesn&apos;t get used at all.

could it be that valgrind calls it the &quot;wrong&quot; way? very *unlikely* because its an API call defined by the POSIX standard. It might be doing something fishy by changing the last argument during the call (setting `timeout-&gt;sec_tv` 0)
using gdb.


here is syscall trace on glibc2.33 (with the bug present) :
5th argument seems to be garbage (expected to be in sequence t[0], t[1] t[2], t[3])

```
root@qemux86-64:/usr/lib/valgrind/ptest/gdbserver_tests# valgrind --trace-syscalls=yes  ./sleepers 1000000000 1000000000 1000000000 BSBSBSBS 2&gt;&amp;1 | grep pselect6
SYSCALL[365,2](270) sys_pselect6 ( 0, 0x0, 0x0, 0x0, 0x5634e00, 0x0 ) --&gt; [async] ...
SYSCALL[365,3](270) sys_pselect6 ( 0, 0x0, 0x0, 0x0, 0x5e35e00, 0x0 ) --&gt; [async] ...
SYSCALL[365,1](270) sys_pselect6 ( 0, 0x0, 0x0, 0x0, 0x1fff000a50, 0x0 ) --&gt; [async] ...
SYSCALL[365,4](270) sys_pselect6 ( 0, 0x0, 0x0, 0x0, 0x6636e00, 0x0 ) --&gt; [async] ...


things to investigate further: 
* turning off compiler optimization on glibc or valgrind</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>89285</commentid>
    <comment_count>20</comment_count>
    <who name="Yi Fan Yu">yf3yu</who>
    <bug_when>2021-02-17 17:15:42 +0000</bug_when>
    <thetext>nlcontrolc expects to change the behaviour of a syscall by changing the argument `timeout` during that syscall (while it is blocked and probably getting woken up periodically by the system timer)


Here is what i think is the root cause:

From looking at that particular glibc commit, 
this is dependent on the compiler&apos;s optimization. 

- glibc creates a wrapper around the real syscall and converts the timeout type `timeval` to `timespec`, a new variable. Compiler can decide to optimize for space and actually have them be the same variable. nlcontrolc takes advantage of that by modifying it.

in newest glibc2.33, they added the time64 support, but compiler is less likely to say that `timeval32` looks like `timespec64`

Currently testing this theory if i build 2.32 with no optimization.
expected behaviour is a hang in nlcontrolc

another way to test it is actually changing the input to the argument to the underlying syscall. expected behaviour is no hang in nlcontrol</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>89286</commentid>
    <comment_count>21</comment_count>
    <who name="Yi Fan Yu">yf3yu</who>
    <bug_when>2021-02-17 17:38:44 +0000</bug_when>
    <thetext>Here is a working call to sleepers *without* the select update patch in 2.33
My previous assumption about compiler optimization is wrong, it used to directly passes timeout to the underlying syscall.


```
root@qemux86-64:/usr/lib/valgrind/ptest/gdbserver_tests# valgrind --trace-syscalls=yes  ./sleepers 1000000000 1000000000 1000000000 BSBSBSBS 2&gt;&amp;1 | grep select
SYSCALL[6021,2](23) sys_select ( 0, 0x0, 0x0, 0x0, 0x4041b0 ) --&gt; [async] ...
SYSCALL[6021,3](23) sys_select ( 0, 0x0, 0x0, 0x0, 0x4041c0 ) --&gt; [async] ...
SYSCALL[6021,1](23) sys_select ( 0, 0x0, 0x0, 0x0, 0x4041a0 ) --&gt; [async] ...
SYSCALL[6021,4](23) sys_select ( 0, 0x0, 0x0, 0x0, 0x4041d0 ) --&gt; [async] ...
```

It used to pass timeout directly to `select`, now it calls `select6`
```
-__select (int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
-         struct timeval *timeout)
+__select64 (int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
+           struct __timeval64 *timeout)
 {
-#ifdef __NR_select
-  return SYSCALL_CANCEL (select, nfds, readfds, writefds, exceptfds,
-                        timeout);
```

here is how it calls it now 
```
+  r = SYSCALL_CANCEL (pselect6, nfds, readfds, writefds, exceptfds, pts32,
+                     NULL);
```</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>89287</commentid>
    <comment_count>22</comment_count>
    <who name="Yi Fan Yu">yf3yu</who>
    <bug_when>2021-02-17 21:04:15 +0000</bug_when>
    <thetext>TLDR:

## glibc patch that causes failure

```
commit 2433d39b69743f100f972e7886f91a2e21795ef0
Author: Adhemerval Zanella &lt;adhemerval.zanella@linaro.org&gt;
Date:   Mon Jul 6 16:06:51 2020 -0300

    linux: Add time64 select support

```

## what changed in this patch to cause it to fail?

timeout argument the user passes no longer makes its way to the syscall.
Glibc copies it over and converts into a different format to call a different syscall `pselect`

the failing test tries to modify said timeout argument to make the syscall end faster. Unfortunately doesn&apos;t work.

## what is the fix for this?

disable it now in YP

## what about actually fixing this bug though?

talking to valgrind about the purpose of nlcontrolc test
    - can we use a different syscall to sleep for a duration?
    - what is the exact purpose if this test

## other questions that arise
Is glibc setting a new standard? what is the expected libc implementation of select? 
Grey area... 

according to `man select`
```
On Linux, select() modifies timeout to reflect the amount of time not slept; most other implementations do not do this. (POSIX.1-2001 permits either behavior.) 
```
Did glibc violate the &quot;linux standard&quot;?

## other mentions
the same test has been disabled for arm64 for around 6months now.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>89288</commentid>
    <comment_count>23</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2021-02-17 21:26:40 +0000</bug_when>
    <thetext>Added Khem to CC since he knows how to spell glibc. :)
I thought Alistair was in the YP BZ but he&apos;s not. I&apos;ll forward this thread to him.

Is this commit:
   commit 2433d39b69743f100f972e7886f91a2e21795ef0
   Author: Adhemerval Zanella &lt;adhemerval.zanella@linaro.org&gt;
   Date:   Mon Jul 6 16:06:51 2020 -0300

    linux: Add time64 select support

    The syscall __NR_pselect6_time64 (32-bit) or __NR_pselect6 (64-bit)
    is used as default.  For architectures with __ASSUME_TIME64_SYSCALLS
    the 32-bit fallback uses __NR_select/__NR__newselect or __NR_pselect6
    (it should cover the microblaze case where older kernels do not
    provide __NR_pselect6).
    
    Checked on x86_64-linux-gnu and i686-linux-gnu (on 5.4 and on 4.15
    kernel).
    
    Reviewed-by: Alistair Francis &lt;alistair.francis@wdc.com&gt;

a problem for any other package that you all know of?

See Yi&apos;s previous comment for a good short summary of what&apos;s going wrong.
Yi please look at the musl select behaviour/implementation.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>89289</commentid>
    <comment_count>24</comment_count>
    <who name="Yi Fan Yu">yf3yu</who>
    <bug_when>2021-02-18 03:56:04 +0000</bug_when>
    <thetext>musl master source code src/select/select.c
    tv is timeoutvalue
    s and ns are based on tv-&gt;tv_sec and tv-&gt;tv_usec

    ```
    r = __syscall_cp(SYS_pselect6_time64, n, rfds, wfds, efds,
                    tv ? ((long long[]){s, ns}) : 0,
    ``
a new array is created,
so musl select implementation looks to align with the new gibc one
      
current nlcontrolc should fail also with musl... checking</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>89290</commentid>
    <comment_count>25</comment_count>
    <who name="Khem Raj">raj.khem</who>
    <bug_when>2021-02-18 04:43:06 +0000</bug_when>
    <thetext>Please try to reproduce this with gdb master and if it works then we need to search for a relevant fix perhaps try applying

https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=439706e6a907b54658714a358b220febc63a0182</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>89318</commentid>
    <comment_count>26</comment_count>
    <who name="Jagadheesan">Jagadheesan_Duraisamy</who>
    <bug_when>2021-02-19 11:44:16 +0000</bug_when>
    <thetext>For record, happened in:
https://autobuilder.yoctoproject.org/typhoon/#/builders/81/builds/1821/steps/12/logs/stdio</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>89322</commentid>
    <comment_count>27</comment_count>
    <who name="Yi Fan Yu">yf3yu</who>
    <bug_when>2021-02-19 15:10:36 +0000</bug_when>
    <thetext>temporary fix to skip test
https://git.openembedded.org/openembedded-core/commit/?id=bb991a24952ebf02cf0092c194d2b3a54a8b2e5b</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>89328</commentid>
    <comment_count>28</comment_count>
    <who name="Jagadheesan">Jagadheesan_Duraisamy</who>
    <bug_when>2021-02-19 18:47:15 +0000</bug_when>
    <thetext>(In reply to comment #26)
&gt; For record, happened in:
&gt; https://autobuilder.yoctoproject.org/typhoon/#/builders/81/builds/1821/steps/
&gt; 12/logs/stdio

Also in https://autobuilder.yoctoproject.org/typhoon/#/builders/81/builds/1813/steps/12/logs/stdio</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>89330</commentid>
    <comment_count>29</comment_count>
    <who name="Yi Fan Yu">yf3yu</who>
    <bug_when>2021-02-19 23:28:55 +0000</bug_when>
    <thetext>khem: built newest gdb (had to remove some patches and depend on gmp)

test still fails

```
timed out
FAIL: gdbserver_tests/nlcontrolc
PASS: gdbserver_tests/nlfork_chain
PASS: gdbserver_tests/nlgone_abrt
c^C
root@qemux86-64:/usr/lib/valgrind/ptest# ^C
 --version86-64:/usr/lib/valgrind/ptest# gdb
GNU gdb (GDB) 11.0.50.20210219-git
Copyright (C) 2021 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later &lt;http://gnu.org/licenses/gpl.html&gt;
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
```</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>89352</commentid>
    <comment_count>30</comment_count>
    <who name="Leonardo Sandoval">leonardo.sandoval</who>
    <bug_when>2021-02-23 15:47:01 +0000</bug_when>
    <thetext>Another failure event [1]

WARNING: core-image-sato-sdk-ptest-1.0-r0 do_testimage: There were failing ptests.
Traceback (most recent call last):
  File &quot;/home/pokybuild/yocto-worker/qemux86-64-ptest/build/meta/lib/oeqa/core/decorator/__init__.py&quot;, line 36, in wrapped_f
    return func(*args, **kwargs)
  File &quot;/home/pokybuild/yocto-worker/qemux86-64-ptest/build/meta/lib/oeqa/core/decorator/__init__.py&quot;, line 36, in wrapped_f
    return func(*args, **kwargs)
  File &quot;/home/pokybuild/yocto-worker/qemux86-64-ptest/build/meta/lib/oeqa/core/decorator/__init__.py&quot;, line 36, in wrapped_f
    return func(*args, **kwargs)
  File &quot;/home/pokybuild/yocto-worker/qemux86-64-ptest/build/meta/lib/oeqa/runtime/cases/ptest.py&quot;, line 25, in test_ptestrunner_expectfail
    self.do_ptestrunner()
  File &quot;/home/pokybuild/yocto-worker/qemux86-64-ptest/build/meta/lib/oeqa/runtime/cases/ptest.py&quot;, line 112, in do_ptestrunner
    self.fail(failmsg)
AssertionError: Failed ptests:
{&apos;valgrind&apos;: [&apos;gdbserver_tests/nlcontrolc&apos;]}


[1] https://autobuilder.yoctoproject.org/typhoon/#/builders/81/builds/1811/steps/12/logs/stdio</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>89407</commentid>
    <comment_count>31</comment_count>
    <who name="Yi Fan Yu">yf3yu</who>
    <bug_when>2021-02-25 16:37:28 +0000</bug_when>
    <thetext>(In reply to comment #30)
&gt; AssertionError: Failed ptests:
&gt; {&apos;valgrind&apos;: [&apos;gdbserver_tests/nlcontrolc&apos;]}
&gt; 
&gt; 
&gt; [1]
&gt; https://autobuilder.yoctoproject.org/typhoon/#/builders/81/builds/1811/steps/
&gt; 12/logs/stdio

this failure 9 days ago, the patch was committed around 7 days ago.


https://autobuilder.yoctoproject.org/typhoon/#/builders/81/builds/1842
a similar test with &apos;master-next&apos; 1 day ago
AssertionError: Failed ptests:
{&apos;python3&apos;: [&apos;test_many_processes&apos;]}</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>89410</commentid>
    <comment_count>32</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2021-02-25 17:16:55 +0000</bug_when>
    <thetext>Lowering to M+ since we are skipping the test and working with upstream valgrind and/or gdb (glibc?) devs to get to the root cause and a fix.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>89416</commentid>
    <comment_count>33</comment_count>
    <who name="Alexandre Belloni">alexandre.belloni</who>
    <bug_when>2021-02-26 01:45:15 +0000</bug_when>
    <thetext>An other similar failure from before the patch:

https://autobuilder.yoctoproject.org/typhoon/#/builders/81/builds/1810

And other failures seen:
&apos;valgrind&apos;: [&apos;memcheck/tests/linux/timerfd-syscall&apos;]

https://autobuilder.yoctoproject.org/typhoon/#/builders/82/builds/1556/steps/12/logs/stdio
https://autobuilder.yoctoproject.org/typhoon/#/builders/82/builds/1548/steps/12/logs/stdio

&apos;valgrind&apos;: [&apos;drd/tests/std_list&apos;]
https://autobuilder.yoctoproject.org/typhoon/#/builders/82/builds/1550/steps/12/logs/stdio</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>89420</commentid>
    <comment_count>34</comment_count>
    <who name="Alexandre Belloni">alexandre.belloni</who>
    <bug_when>2021-02-26 02:00:22 +0000</bug_when>
    <thetext>An other valgrind ptest failing:

{&apos;valgrind&apos;: [&apos;drd/tests/thread_name&apos;, &apos;drd/tests/thread_name_xml&apos;]}

https://autobuilder.yoctoproject.org/typhoon/#/builders/82/builds/1549/steps/10/logs/step1c</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>89548</commentid>
    <comment_count>35</comment_count>
    <who name="Yi Fan Yu">yf3yu</who>
    <bug_when>2021-03-09 15:56:02 +0000</bug_when>
    <thetext>https://git.openembedded.org/openembedded-core/commit/?id=aac00b1c8042e41cd6bb1aea8e3033a1c6dd2b05
should make the test pass more frequently,

upstream has fixed nlcontrolc by redesigning the test
https://sourceware.org/git/?p=valgrind.git;a=commit;h=c79180a3afcf65902e578646c3b716cc749db406

a patch to oe-core is in master-next</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>89571</commentid>
    <comment_count>36</comment_count>
    <who name="Alexandre Belloni">alexandre.belloni</who>
    <bug_when>2021-03-11 14:40:13 +0000</bug_when>
    <thetext>So far failures happened:

3 times on opensuse151-ty-1
4 times on ubuntu1804-arm-1
2 times on tumbleweed-ty-1
2 times on centos8-ty-1
2 times on debian10-ty-2
2 times on opensuse152-ty-1
2 times on ubuntu1804-ty-2
1 time  on ubuntu1804-ty-1
1 time  on ubuntu2004-ty-1
1 time  on fedora33-ty-1</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>89627</commentid>
    <comment_count>37</comment_count>
    <who name="Yi Fan Yu">yf3yu</who>
    <bug_when>2021-03-15 19:43:44 +0000</bug_when>
    <thetext>resolving this...
please open new bug for other failures

this ticket was for nlcontrolc

https://git.openembedded.org/openembedded-core/commit/?id=64f98a731adaf86c9185c90436db1a6eb8e16b42</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>100828</commentid>
    <comment_count>38</comment_count>
    <who name="João Marcos Costa">joaomarcos.costa</who>
    <bug_when>2025-02-03 16:38:22 +0000</bug_when>
    <thetext>https://autobuilder.yoctoproject.org/valkyrie/#/builders/73/builds/866/steps/12/logs/stdio

nlcontrolc appeared again:

{&apos;valgrind&apos;: [&apos;gdbserver_tests/mcinfcallWSRU&apos;,
              &apos;gdbserver_tests/nlcontrolc&apos;,
              &apos;gdbserver_tests/nlvgdbsigqueue&apos;,
              &apos;memcheck/tests/sendmsg&apos;,
              &apos;drd/tests/fork-parallel&apos;,
              &apos;drd/tests/fork-serial&apos;,
              &apos;drd/tests/threaded-fork-vcs&apos;,
              &apos;drd/tests/threaded-fork&apos;,
              &apos;none/tests/fdleak_ipv4&apos;,
              &apos;none/tests/file_dclose&apos;,
              &apos;none/tests/socket_close&apos;]}

qemux86-64-ptest rocky9-vk-1</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>100832</commentid>
    <comment_count>39</comment_count>
    <who name="João Marcos Costa">joaomarcos.costa</who>
    <bug_when>2025-02-03 16:46:52 +0000</bug_when>
    <thetext>Reopening.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>100834</commentid>
    <comment_count>40</comment_count>
    <who name="João Marcos Costa">joaomarcos.costa</who>
    <bug_when>2025-02-03 16:48:48 +0000</bug_when>
    <thetext>https://autobuilder.yoctoproject.org/valkyrie/#/builders/61/builds/864/steps/12/logs/stdio

Failed ptests:
{&apos;valgrind&apos;: [&apos;gdbserver_tests/mcinfcallWSRU&apos;,
              &apos;gdbserver_tests/nlcontrolc&apos;,
              &apos;gdbserver_tests/nlvgdbsigqueue&apos;,
              &apos;memcheck/tests/sendmsg&apos;,
              &apos;drd/tests/fork-parallel&apos;,
              &apos;drd/tests/fork-serial&apos;,
              &apos;drd/tests/threaded-fork-vcs&apos;,
              &apos;drd/tests/threaded-fork&apos;,
              &apos;none/tests/fdleak_ipv4&apos;,
              &apos;none/tests/file_dclose&apos;,
              &apos;none/tests/socket_close&apos;]}

qemuarm64-ptest ubuntu2204-vk-arm1</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>100857</commentid>
    <comment_count>41</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2025-02-06 15:09:12 +0000</bug_when>
    <thetext>This was with glibc-2.41.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>104027</commentid>
    <comment_count>42</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2026-01-22 16:04:49 +0000</bug_when>
    <thetext>Mingli is working with valgrind upstream to try to improve the test approach so that we don&apos;t have as big a patchset and hopefully one that has fewer if any intermittent problems.

We have disabled valgrind ptests on master:
https://git.openembedded.org/openembedded-core/commit/?id=8fc31fb235af12530475ec5055f6c00ccfafadfa</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>