Bug 215019 - sys/kern/coredump_phnum_test:coredump_phnum is broken (the value it's parsing for isn't correct)
Summary: sys/kern/coredump_phnum_test:coredump_phnum is broken (the value it's parsing...
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: tests (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Some People
Assignee: Conrad Meyer
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-12-03 02:14 UTC by Enji Cooper
Modified: 2021-01-27 08:44 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Enji Cooper freebsd_committer freebsd_triage 2016-12-03 02:14:31 UTC
Kernel is GENERIC-NODEBUG. No special sysctls or tunables set on my VM:

[ngie@fbsd12 /usr/tests]$ sudo kyua -v test_suites.FreeBSD.allow_sysctl_side_effects=1 debug sys/kern/coredump_phnum_test:coredump_phnum                                                                    
kern.coredump: 1 -> 1
kern.corefile: %N.core -> /tmp/kyua.WvTTRC/2/work/coredump_phnum_helper.core
Executing command [ /usr/tests/sys/kern/coredump_phnum_helper ]
Executing command [ grep Number of program headers: ]
Executing command [ grep -1 program headers ]
Executing command [ grep -A1 ^  \[ 0\]  ]
Executing command [ wc -l ]
kern.coredump: 1 -> 1
kern.corefile: /tmp/kyua.WvTTRC/2/work/coredump_phnum_helper.core -> %N.core
Fail: regexp 65535 \(66169\) not in stdout
  Number of program headers:         65535
Fail: regexp There are 66169 program headers not in stdout
Entry point 0x0
There are 65535 program headers, starting at offset 64

Fail: regexp  0000000000000001 .* 66169  not in stdout
  [ 0] (null)            NULL             0000000000000000  00000000
       0000000000000000  0000000000000000           0     0     0
Fail: regexp 66545 not in stdout
   66546
Files left in work directory after failure: coredump_phnum_helper.core, coredump_phnum_restore_state.sh
sys/kern/coredump_phnum_test:coredump_phnum  ->  failed: Test case body returned a non-ok exit code, but this is not allowed
[ngie@fbsd12 /usr/tests]$ uname -a
FreeBSD fbsd12 12.0-CURRENT FreeBSD 12.0-CURRENT #7 r309448: Fri Dec  2 15:39:37 PST 2016     ngie@fbsd12:/usr/obj/usr/src/svn/sys/GENERIC-NODEBUG  amd64
[ngie@fbsd12 /usr/tests]$ sh -c 'ulimit -a'
cpu time               (seconds, -t)  unlimited
file size           (512-blocks, -f)  unlimited
data seg size           (kbytes, -d)  33554432
stack size              (kbytes, -s)  524288
core file size      (512-blocks, -c)  unlimited
max memory size         (kbytes, -m)  unlimited
locked memory           (kbytes, -l)  64
max user processes              (-u)  7578
open files                      (-n)  87516
virtual mem size        (kbytes, -v)  unlimited
swap limit              (kbytes, -w)  unlimited
socket buffer size       (bytes, -b)  unlimited
pseudo-terminals                (-p)  unlimited
kqueues                         (-k)  unlimited
umtx shared locks               (-o)  unlimited
Comment 1 commit-hook freebsd_committer freebsd_triage 2016-12-03 02:18:37 UTC
A commit references this bug:

Author: ngie
Date: Sat Dec  3 02:17:50 UTC 2016
New revision: 309463
URL: https://svnweb.freebsd.org/changeset/base/309463

Log:
  Expect :coredump_phnum to fail

  The number of program headers on my system (GENERIC-NODEBUG) don't match the
  expected (hardcoded) number in the test

  PR:	215019

Changes:
  head/tests/sys/kern/coredump_phnum_test.sh
Comment 2 Conrad Meyer freebsd_committer freebsd_triage 2016-12-03 22:32:59 UTC
> Number of program headers:         65535

This piece is a deficiency in base's readelf.  Elfutils' version prints the real number of program headers after the first, in the extended case.

(The actual number of sections dumped still doesn't match, though.)
Comment 3 Conrad Meyer freebsd_committer freebsd_triage 2016-12-03 23:02:41 UTC
https://reviews.freebsd.org/D8701 , https://reviews.freebsd.org/D8702 for the readelf issue.
Comment 4 Conrad Meyer freebsd_committer freebsd_triage 2016-12-03 23:18:51 UTC
(In reply to Conrad E. Meyer from comment #2)
> Elfutils' version prints the real number of program headers after the first, in the extended case.

Whoops, I meant binutils' version (from ports).  Elfutils' version also prints the right number but the formatting is more different from the other two.
Comment 5 Conrad Meyer freebsd_committer freebsd_triage 2016-12-03 23:40:49 UTC
A related elftoolchain fix for 'readelf -l': https://reviews.freebsd.org/D8703
Comment 6 Conrad Meyer freebsd_committer freebsd_triage 2016-12-04 02:41:06 UTC
One last fix needed for elftoolchain readelf: https://reviews.freebsd.org/D8707

I'll work on making the test more flexible in terms of the exact number of sections, but won't mark the test as non-broken until base readelf can be used to run the test.
Comment 7 commit-hook freebsd_committer freebsd_triage 2016-12-04 03:51:08 UTC
A commit references this bug:

Author: cem
Date: Sun Dec  4 03:50:57 UTC 2016
New revision: 309525
URL: https://svnweb.freebsd.org/changeset/base/309525

Log:
  coredump_phnum_test: Make expected pheader count more flexible

  Note: this test still requires binutils readelf (from ports) to pass, until a
  few issues are resolved in elftoolchain.

  PR:		215019
  Reported by:	ngie@
  Sponsored by:	Dell EMC Isilon

Changes:
  head/tests/sys/kern/coredump_phnum_test.sh
Comment 8 Enji Cooper freebsd_committer freebsd_triage 2017-07-11 02:47:17 UTC
Uh... now it's passing with GENERIC-NODEBUG using elftoolchain's readelf and binutil's readelf >_>..
Comment 9 Conrad Meyer freebsd_committer freebsd_triage 2017-07-11 04:04:40 UTC
Why did you reopen this if it's passing?
Comment 10 Enji Cooper freebsd_committer freebsd_triage 2017-07-11 04:08:24 UTC
(In reply to Conrad Meyer from comment #9)

It's expected to fail on 12.0-CURRENT, and it no longer fails on my machine :/. For some odd reason it fails on GENERIC with ci.freebsd.org though.
Comment 11 commit-hook freebsd_committer freebsd_triage 2017-07-19 16:08:41 UTC
A commit references this bug:

Author: ngie
Date: Wed Jul 19 16:08:08 UTC 2017
New revision: 321210
URL: https://svnweb.freebsd.org/changeset/base/321210

Log:
  Remove expected failure for :coredump_phnum

  The testcase no longer fails on ^/head because readelf has established parity
  with binutils' copy of readelf.

  This issue is not seen on Jenkins because
  `test_suites.FreeBSD.allow_sysctl_side_effects` isn't set in kyua.conf on
  the CI host, i.e., the test is skipped.

  PR:	215019
  Tested with:	binutils (amd64-binutils-2.28,1); elftoolchain (r3561M)

Changes:
  head/tests/sys/kern/coredump_phnum_test.sh
Comment 12 Enji Cooper freebsd_committer freebsd_triage 2017-07-19 16:10:07 UTC
(In reply to Ngie Cooper from comment #10)

It technically wasn't passing after emaste made the necessary changes to readelf in elftoolchain; please see the commit referenced in comment # 11.
Comment 13 Jaime Meredith 2021-01-27 08:44:39 UTC
MARKED AS SPAM