Bug 397424 - glibc 2.27 and gdb_server tests
Summary: glibc 2.27 and gdb_server tests
Status: RESOLVED FIXED
Alias: None
Product: valgrind
Classification: Developer tools
Component: general (other bugs)
Version First Reported In: 3.14 SVN
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Julian Seward
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-08-13 15:51 UTC by Dimitrije Nikolic
Modified: 2018-09-03 21:27 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments
glibc2-27 & gdbserver problem (7.88 KB, patch)
2018-08-13 15:51 UTC, Dimitrije Nikolic
Details
glibc2-27 & gdbserver problem v2 (8.22 KB, patch)
2018-08-14 17:05 UTC, Dimitrije Nikolic
Details
glibc2-27 & gdbserver problem v3 (8.83 KB, patch)
2018-08-15 12:40 UTC, Dimitrije Nikolic
Details
glibc2-27_gdbserver_v4_part2 (14.53 KB, patch)
2018-08-29 14:00 UTC, Dimitrije Nikolic
Details
glibc2-27_gdbserver_v4_part1 (6.49 KB, patch)
2018-08-29 14:07 UTC, Dimitrije Nikolic
Details
diff_mips_x86 (1.54 KB, patch)
2018-08-29 14:43 UTC, Dimitrije Nikolic
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Dimitrije Nikolic 2018-08-13 15:51:27 UTC
Created attachment 114421 [details]
glibc2-27 & gdbserver problem

In version 2.27 of glibc is added file sysdeps/unix/sysv/linux/select.c, which contains wrapper for select sys-call, so some tests (mcinfcallWSRU, nlcontrolc, nlvgdbsigqueue; all from gdb_server group of tests) have different output from excepted.
Also, output of glibc is different among architectures.
I suggest following patch, which introduce more restrictive filter.
Comment 1 Petar Jovanovic 2018-08-13 18:00:09 UTC
I can confirm that we have 4 failurs in gdbserver_tests on x86 with 2.27 glibc.

== 26 tests, 1 stderr failure, 0 stdout failures, 1 stderrB failure, 2 stdoutB failures, 0 post failures ==
gdbserver_tests/mcinfcallWSRU            (stderrB)
gdbserver_tests/mcmain_pic               (stderr)
gdbserver_tests/nlcontrolc               (stdoutB)
gdbserver_tests/nlvgdbsigqueue           (stdoutB)


After appling the patch, we have issue remaining.

-- Finished tests in gdbserver_tests -----------------------------------

== 26 tests, 1 stderr failure, 0 stdout failures, 0 stderrB failures, 0 stdoutB failures, 0 post failures ==
gdbserver_tests/mcmain_pic               (stderr)
Comment 2 Philippe Waroquiers 2018-08-13 20:20:05 UTC
filter_gdb already contains some sed expressions to canononicalise
select syscalls e.g.
...
    -e 's/in select ()$/in syscall .../'                                                              \
    -e 's/in \.__select ()$/in syscall .../'                                                          \
    -e 's/in select () at \.\.\/sysdeps\/unix\/syscall-template\.S.*$/in syscall .../'                \
...

Isn't there a way to use or extend this technique instead of adding a new filter_select ?
Comment 3 Dimitrije Nikolic 2018-08-14 17:05:25 UTC
Created attachment 114437 [details]
glibc2-27 & gdbserver problem v2

I changed filter as you suggested and also melt patch which fixes tests gdbserver_tests/mcmain_pic.
Comment 4 Philippe Waroquiers 2018-08-14 20:37:35 UTC
Sorry, it looks like I was not very clear in my comment :
I see you have kept the 'START_DELETE/END_DELETE' technique,
which you have integrated in filter_gdb.
I was more thinking to 'canonicalise' the select syscall,
with sed expressions like the 
  -e 's/in select ()$/in syscall .../'         

(it looks somewhat preferrable to keep the somewhat edited output, rather than
deleting it).

Would it be difficult to add some sed expressions, like for the other
syscalls or glibc versions ?

(for both the select syscall differences, but also for
mcmain_pic.stderr.exp-glibc-2_27
as maintaining different .exp files is painful: changing something
implies to change all the copies, and for sure test everywhere.

Thanks
Comment 5 Dimitrije Nikolic 2018-08-15 12:40:24 UTC
Created attachment 114443 [details]
glibc2-27 & gdbserver problem v3

I was trying for a few days to solve this problem like you suggested (before sending first patch), but it's too complicated to make sed expression which will filter all possible outputs result on the same way. There are too many differences between versions of glibc and platforms.

For mcmain_pic: I removed added exp file, and added filter_mcmain which replace number of bytes and blocks to "xx".
Comment 6 Dimitrije Nikolic 2018-08-20 16:24:38 UTC
Philippe,
Can you take a look at this patch?
Comment 7 Dimitrije Nikolic 2018-08-24 13:20:40 UTC
Philippe,
Do you need any more modifications for this?
Comment 8 Philippe Waroquiers 2018-08-25 20:41:34 UTC
(In reply to Dimitrije Nikolic from comment #5)
Finally replying, after some holidays ;).

> Created attachment 114443 [details]
> glibc2-27 & gdbserver problem v3
> 
> I was trying for a few days to solve this problem like you suggested (before
> sending first patch), but it's too complicated to make sed expression which
> will filter all possible outputs result on the same way. There are too many
> differences between versions of glibc and platforms.
Yes, all these differences are very painful (and these differences
are the reasons why we already have about 60 sed expressions
in filter_gdb).
It is not very clear to me why the output of glibc 2-27 cannot
be handled similarly to the other differences we had up to now.
Can you clarify this by showing an (unfiltered) stacktrace
produced by glibc 2-27 ?
(e.g. attach the unfiltered output of mcinfcallWSRU obtained by
running the test with --keep-unfiltered).

Otherwise, if we reach the conclusion that the 'start/end delete'
technique is the best, I think we already have this technique 
supported in filter_gdb via:
    -e '/filter_gdb BEGIN drop/,/filter_gdb END drop/d'                                               \

> 
> For mcmain_pic: I removed added exp file, and added filter_mcmain which
> replace number of bytes and blocks to "xx".
As I do not believe that we have any need to check the 'in use at exit'
in any vgdb tests, I think we better do the sed expression to change
    in use at exit: [0-9][0-9]* bytes in [0-9][0-9]* blocks
to 
    in use at exit: ... bytes in ... blocks
as part of filter_gdb.
If you prefer, you can do this part as a separate first patch.

Thanks for the patience ...
Comment 9 Dimitrije Nikolic 2018-08-29 13:58:34 UTC
(In reply to Philippe Waroquiers from comment #8)

> > 
> > For mcmain_pic: I removed added exp file, and added filter_mcmain which
> > replace number of bytes and blocks to "xx".
> As I do not believe that we have any need to check the 'in use at exit'
> in any vgdb tests, I think we better do the sed expression to change
>     in use at exit: [0-9][0-9]* bytes in [0-9][0-9]* blocks
> to 
>     in use at exit: ... bytes in ... blocks
> as part of filter_gdb.
> If you prefer, you can do this part as a separate first patch.

I changed filter_memcheck_monitor (not filer_gdb as you suggested) and 
also changed exp files of those tests whose output have changed.
I attached that patch as glibc2-27_gdbserver_v4_part2.diff
Comment 10 Dimitrije Nikolic 2018-08-29 14:00:16 UTC
Created attachment 114681 [details]
glibc2-27_gdbserver_v4_part2

glibc 2.27 and gdb_server tests
    
Remove checks for "in use at exit" bytes.
After resolving glibc bug #17730, memcheck's outputs of some gdbserver tests
are different in "in use at exit" parts which is not relevant for tests execution.
    
Fixed : gdbserver_tests/mcmain_pic
Comment 11 Dimitrije Nikolic 2018-08-29 14:06:42 UTC
(In reply to Philippe Waroquiers from comment #8)
> (In reply to Dimitrije Nikolic from comment #5)
> Finally replying, after some holidays ;).
> 
> > Created attachment 114443 [details]
> > glibc2-27 & gdbserver problem v3
> > 
> > I was trying for a few days to solve this problem like you suggested (before
> > sending first patch), but it's too complicated to make sed expression which
> > will filter all possible outputs result on the same way. There are too many
> > differences between versions of glibc and platforms.
> Yes, all these differences are very painful (and these differences
> are the reasons why we already have about 60 sed expressions
> in filter_gdb).
> It is not very clear to me why the output of glibc 2-27 cannot
> be handled similarly to the other differences we had up to now.
> Can you clarify this by showing an (unfiltered) stacktrace
> produced by glibc 2-27 ?
> (e.g. attach the unfiltered output of mcinfcallWSRU obtained by
> running the test with --keep-unfiltered).
> 
> Otherwise, if we reach the conclusion that the 'start/end delete'
> technique is the best, I think we already have this technique 
> supported in filter_gdb via:
>     -e '/filter_gdb BEGIN drop/,/filter_gdb END drop/d'                     
> \
> 

I attached differences between output of test on MIPS and X86 architectures. (with glibc 2.27)
Both of these outputs are different from present exp file.
I suggest that we use technique 
> supported in filter_gdb via:
>     -e '/filter_gdb BEGIN drop/,/filter_gdb END drop/d'
and I attached patch glibc2-27_gdbserver_v4_part1.diff
Comment 12 Dimitrije Nikolic 2018-08-29 14:07:39 UTC
Created attachment 114682 [details]
glibc2-27_gdbserver_v4_part1
Comment 13 Dimitrije Nikolic 2018-08-29 14:43:51 UTC
Created attachment 114683 [details]
diff_mips_x86
Comment 14 Philippe Waroquiers 2018-08-29 20:54:07 UTC
Thanks for this work. I will look at all that in the coming days
(probably this week-end).
Comment 15 Philippe Waroquiers 2018-09-01 16:56:19 UTC
I have looked at the patch v4_part2.
The patch filters more than just the 'use at exit'.
That means that e.g. we do not check anymore (or check less)
the incremental leak values/behaviour.

So, I have pushed a214595da, which changes filter_memcheck_monitor
to just change the 'in use at exit'.

Please confirm that is good enough for the glibc 2.27 memory related differences.
Comment 16 Philippe Waroquiers 2018-09-01 17:05:43 UTC
(In reply to Dimitrije Nikolic from comment #11)

> I attached differences between output of test on MIPS and X86 architectures.
> (with glibc 2.27)

Can you rather attach the full unfiltered output on MIPS and X86,
as produced for one of the failing tests with:
  perl tests/vg_regtest --keep-unfiltered gdbserver_tests/mcinfcallWSRU.vgtest

That should produce some files matching
 mcinfcallWSRU.*unfiltered.out
Please attach these files for MIPS and X86.

thanks

> Both of these outputs are different from present exp file.
> I suggest that we use technique 
> > supported in filter_gdb via:
> >     -e '/filter_gdb BEGIN drop/,/filter_gdb END drop/d'
> and I attached patch glibc2-27_gdbserver_v4_part1.diff
Thanks for the patch, I would first like to take a look at
the unfiltered output before applying this filter.

Thanks

Philippe
Comment 17 Philippe Waroquiers 2018-09-02 12:25:33 UTC
Commit 0822ebca8f964f1685d667e0c21fea926633bb92 should make the gdbserver
tests working with glibc 2.27
(at least it does on Ubuntu 18.04 which has a glibc 2.27)


Please confirm this also works on mips.

Thanks

Philippe
Comment 18 Dimitrije Nikolic 2018-09-03 10:50:23 UTC
(In reply to Philippe Waroquiers from comment #17)
> Commit 0822ebca8f964f1685d667e0c21fea926633bb92 should make the gdbserver
> tests working with glibc 2.27
> (at least it does on Ubuntu 18.04 which has a glibc 2.27)
> 
> 
> Please confirm this also works on mips.
> 
> Thanks
> 
> Philippe

Hi Philippe,

It works on mips, too.

Dimitrije
Comment 19 Philippe Waroquiers 2018-09-03 21:27:42 UTC
Thanks for the feedback, closing the bug then.