67 Commits

Author SHA1 Message Date
Ivo Raisr
6fbb3ddfe5 Add .stderr.exp file for memcheck/tests/linux/capget when running inside Docker container. 2017-11-15 23:37:17 +01:00
Mark Wielaard
2b5eab6a8d memcheck/tests: Use ucontext_t instead of struct ucontext
glibc 2.26 does not expose struct ucontext anymore.

Signed-off-by: Khem Raj <raj.khem@gmail.com>

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16457
2017-06-29 15:26:30 +00:00
Mark Wielaard
3ac87cf927 epoll_pwait can have a NULL sigmask.
According to the epoll_pwait(2) man page:

       The  sigmask  argument  may  be  specified  as  NULL,  in  which  case
       epoll_pwait() is equivalent to epoll_wait().

But doing that under valgrind gives:

==13887== Syscall param epoll_pwait(sigmask) points to unaddressable byte(s)
==13887==    at 0x4F2B940: epoll_pwait (epoll_pwait.c:43)
==13887==    by 0x400ADE: main (syscalls-2007.c:89)
==13887==  Address 0x0 is not stack'd, malloc'd or (recently) free'd

This is because the sys_epoll_pwait wrapper has:

   if (ARG4)
      PRE_MEM_READ( "epoll_pwait(sigmask)", ARG5, sizeof(vki_sigset_t) );

Which looks like a typo (ARG4 is timeout and ARG5 is sigmask).

This shows up with newer glibc which translates an epoll_wait call into
an epoll_pwait call with NULL sigmask.

Fix typo and add a testcase.

https://bugs.kde.org/show_bug.cgi?id=381289

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16451
2017-06-17 13:49:22 +00:00
Ivo Raisr
f8a8e3de4d Fix expected output of brk tests after r16407.
n-i-bz


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16410
2017-05-23 21:22:31 +00:00
Petar Jovanovic
795ee051e6 mips32: add support for ptrace syscall
Add wrapers for ptrace syscall for mips32.

Patch by Aleksandra Karadzic.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16211
2017-01-27 17:01:49 +00:00
Philippe Waroquiers
268ff84f7b Document brk segment limitation, reference manual in limit reached msg.
The msg telling brk cannot be extended confuses some users
so improve the documentation and have the msg referencing the doc.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15880
2016-05-22 20:48:09 +00:00
Mark Wielaard
dcb119cf41 Squash glibc warning about _BSD_SOURCE being deprecated tests.
glibc 2.20 deprecated _BSD_SOURCE and _SVID_SOURCE and now requires
_DEFAULT_SOURCE to be defined instead. Add _DEFAULT_SOURCE define to
prevent warnings like:

In file included from /usr/include/stdio.h:27:0,
                 from stack_switch.c:5:
/usr/include/features.h:148:3: warning: #warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE" [-Wcpp]
 # warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE"
   ^

See https://sourceware.org/glibc/wiki/Release/2.20#Packaging_Changes

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15768
2016-01-22 13:49:22 +00:00
Bart Van Assche
d138ed7448 regression tests: Remove superfluous backticks
Backticks are not needed around a shell statement that does not produce
any output.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15439
2015-07-23 02:47:42 +00:00
Florian Krohm
97b35b97f6 Issue an error message if then brk segment overflows.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15155
2015-04-29 12:59:16 +00:00
Florian Krohm
ac9506ad26 Disable testcase because the ptrace system call is not
supported on ppc64.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15010
2015-03-14 09:30:36 +00:00
Florian Krohm
27df6d48bf Followup to r14646. The symbol TIOCSIG is not necessarily defined,
e.g. on s390x with glibc 2.3.4. Modify the testcase to bypass the ioctl
call in that case.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14649
2014-10-22 09:25:03 +00:00
Florian Krohm
17fe8c0a09 Add support for ioctl(fd, TIOCSIG, signal_number) which used
to issue a false complaint. Fixes BZ #339706
Source patch by David Herrmann (dh.herrmann@gmail.com).
Testcase by myself.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14646
2014-10-21 07:20:20 +00:00
Philippe Waroquiers
eb2b193943 Fix dangling ref in m_errormgr.c + report all uninit fields in a syscall param
Some syscall verification code is allocating memory to generate 
the string used to build an error, e.g. syswrap-generic.c verifying fields of
e.g socket addresses (pre_mem_read_sockaddr) or sendmsg/recvmsg args 
(msghdr_foreachfield)

The allocated pointer was copied in the error created by VG_(maybe_record_error).

This was wrong for 2 reasons:
1. If the error is a new error, it is stored in a list of errors,
   but the string memory was freed by pre_mem_read_sockaddr, msghdr_foreachfield, ...
   This causes a dangling reference. Was at least visible when giving -v, which
   re-prints all errors at the end of execution.
   Probably this could have some consequences during run while generating new errors,
   and comparing for equality with a recorded error having a dangling reference.
2. the same allocated string is re-used for each piece/field of the verified struct.
   The code in mc_errors.c that checks that 2 errors are identical was then wrongly
   considereing that 2 successive errors for 2 different fields for the same syscall
   arg are identical, just because the error string happened to be produced at
   the same address.
(it is believed that initially, the error string was assumed to be a static
string, which is not the case anymore, causing the above 2 problems).

Changes:
* The fix consists in duplicating in m_errormgr.c the given error string when
  the error is recorded. In other words, the error string is now duplicated similarly
  to the (optional) extra component of the error.

* memcheck/tests/linux/rfcomm.c test modified as now an error is reported
  for each uninit field.

* socketaddr unknown family is also better reported (using sa_data field name,
  rather than an empty field name.

* minor reformatting in m_errormgr.c, to be below 80 characters.

Some notes:
1. the string is only duplicated if the error is recorded
   (ie. printed or the first time an error matches a suppression).
   The string is not duplicated for duplicated errors or following errors
   matching the first (suppressed) error.
   The string is also not duplicated for 'unique errors' (that are printed
   and then not recorded).
2. duplicating the string for each recorded error is not deemed to
   use a lot of memory:
     * error strings are usually NULL or short (often 10 bytes or so).
     * we expect no program has a huge number of errors
   If ever this string duplicate would be significant, having a DedupPoolAlloc
   in m_errormgr.c for these strings would reduce this memory (as we expect to
   have very few different strings, even with millions of errors).



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14214
2014-07-30 22:20:29 +00:00
Philippe Waroquiers
9b67d18f11 Improve address description for address in the stack.
--read-var-info=yes is very memory and cpu intensive.
This patch ensures that even witout --read-var-info=yes that
the frame where the address point is reported in the address
description.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13991
2014-05-22 23:48:24 +00:00
Mark Wielaard
86f74d6026 Support Linux kernel AF_BLUETOOTH for bind().
Bug #320116. sockaddr_rc might contain some padding which might not be
initialized. Explicitly check the sockaddr_rc fields are set. That also
produces better diagnostics about which field is unitialized.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13404
2013-05-22 10:21:10 +00:00
Florian Krohm
8c76e43290 Make sys-openat test conditional upon the existence of AT_FDCWD.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13171
2012-12-08 19:26:03 +00:00
Julian Seward
12a820fcbf Fix some gcc complaints about unused variables in these tests.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13167
2012-12-06 23:11:19 +00:00
Julian Seward
36468d9ae2 For sys-openat the dirfd argument should be ignored when the pathname
is absolute.  Fixes #307103.  (Mark Wielaard, mjw@redhat.com)



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13159
2012-12-06 16:05:18 +00:00
Petar Jovanovic
516de0bcd6 Correctly skip memcheck's getregset for MIPS.
Previous change r13145 incorrectly disables getregset test for all architectures
rather than just for MIPS arch. Issue spotted by Bart Van Assche and reported on
the list.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13148
2012-12-03 00:31:42 +00:00
Petar Jovanovic
a167c7a54d Skip memcheck's getregset for MIPS.
Skip the getregset test for MIPS since we still does not have TRACEHOOK
support in MIPS kernel for it, and that is needed to support PTRACE_GETREGSET.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13145
2012-12-02 03:37:36 +00:00
Christian Borntraeger
73744bb25f GETREGSET was introduced with 2.6.33.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13115
2012-11-09 08:06:14 +00:00
Christian Borntraeger
4155f1b382 add s390 specific fix for getregset
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13112
2012-11-08 20:10:10 +00:00
Christian Borntraeger
b5bb5fa736 wire up testcase
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13111
2012-11-08 19:46:29 +00:00
Christian Borntraeger
6c0b993485 Add ptrace getreset testcase from Andreas Arnez
arnez AT  linux DOT vnet DOT ibm DOT com



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13110
2012-11-08 19:42:00 +00:00
Florian Krohm
9e5f501978 Some older kernels on s390 do not provide AT_PLATFORM.
Add a prerequisite condition to make sure it's there.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13023
2012-10-05 23:29:38 +00:00
Tom Hughes
f74befe896 Implement a fake /proc/self/auxv file for linux systems.
Patch from Mark Wielaard to fix BZ#253519.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13019
2012-10-04 20:27:38 +00:00
Julian Seward
084b7cb10b Fix #284384 (clang 3.1 -Wunused-value warnings in valgrind.h,
memcheck.h) by changing a bunch of VALGRIND_DO_CLIENT_REQUEST_EXPR
into VALGRIND_DO_CLIENT_REQUEST_STMT for cases where the return value
of the former would be unused.  (Bart Van Assche, bart.vanassche@gmail.com)



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12226
2011-10-24 13:21:57 +00:00
Bart Van Assche
399aea2c1b memcheck/tests/linux/Makefile.am: Add four .vgtest files to the distribution tarball and remove the capget binary
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12155
2011-10-14 09:32:46 +00:00
Florian Krohm
ad7a355b4a Improve filtering of backtrace noise in the memcheck bucket
and update exp files accordingly. This works well for x86
and all testcases pass on my machine.
New file filter_memcheck to do the work. 
There is a bit of a ripple here as filter_memcheck requires
command line arguments to be passed in. So all users of 
filter_memcheck (direct or indirect) were updated as well.
filter_stderr was simplified as was filter_libc.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12091
2011-10-03 23:39:54 +00:00
Bart Van Assche
11ce1f16fa memcheck/tests/linux/timerfd-syscall: Avoid failure on heavily loaded systems
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11997
2011-08-20 11:08:48 +00:00
Florian Krohm
c9c6767b83 Fix prerequisite for memcheck/tests/linux/timerfd-syscall.
The testcase was executed despite uname -r being 2.6.9-42.EL
Extend tests/os_test.c to take an optional 2nd argument
which is a minimum version number. Use os_test in the
prerequisite expression.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11954
2011-07-31 03:22:45 +00:00
Tom Hughes
af8ec0a591 Define _GNU_SOURCE for access to CLONE_XXX flags with gibc 2.14 headers.
Based on patch from Dmitry Djachenko <dimhen@gmail.com>.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11802
2011-06-07 22:53:21 +00:00
Bart Van Assche
9a36fe677e Get rid of the remaining "set but not used" warnings reported by gcc 4.6 by
swapping the roles of the VALGRIND_DO_CLIENT_REQUEST() and
VALGRIND_DO_CLIENT_REQUEST_EXPR() macros. Also, many __attribute__((unused))
declarations on variables have been eliminated. Closes #269778.

Note: so far this patch has been tested on x86/Linux, amd64/Linux and
ppc64/Linux but not yet on any other supported CPU/OS combination.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11755
2011-05-15 07:04:03 +00:00
Bart Van Assche
bd7dbb42d3 timerfd-syscall regression test: Allow even more scheduler variation.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11692
2011-04-12 10:28:31 +00:00
Bart Van Assche
8a3e9fdd7c git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11682 2011-04-03 17:42:19 +00:00
Bart Van Assche
44a6867773 timerfd-syscall regression test: Allow even more scheduler variation.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11676
2011-03-29 10:56:32 +00:00
Bart Van Assche
61e5d45e0c Replaced a Unicode character by an ASCII character in a source code comment.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11652
2011-03-17 11:00:11 +00:00
Bart Van Assche
9a8cdf03cb Moved two Linux-specific syscalls to the linux subdirectory.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11651
2011-03-17 10:57:49 +00:00
Bart Van Assche
1ecd0141bd Fixed a recently introduced compiler warning.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11649
2011-03-17 10:24:53 +00:00
Bart Van Assche
4a32a7d8be Yet another attempt to make the timerfd-syscall test reliable.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11647
2011-03-17 07:45:46 +00:00
Bart Van Assche
75e3bb63ce Avoid that small time variations make the timerfd-syscall regression test fail.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11641
2011-03-13 09:42:56 +00:00
Julian Seward
dae0b7a571 'make dist' fixes following s390x-linux merge. (Christian Borntraeger
<borntraeger@de.ibm.com>)



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11616
2011-03-10 12:36:09 +00:00
Julian Seward
6107fd666c Add a port to IBM z/Architecture (s390x) running Linux -- Valgrind
side components. (Florian Krohm <britzel@acm.org> and Christian
Borntraeger <borntraeger@de.ibm.com>).  Fixes #243404.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11604
2011-03-07 16:05:35 +00:00
Bart Van Assche
ad86d78a6c E-mail address update.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11420
2010-10-10 18:07:31 +00:00
Bart Van Assche
75ac57dc3a Made timerfd-syscall test more robust by improving the time rounding algorithm.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11368
2010-09-19 17:21:31 +00:00
Bart Van Assche
3169936a1b Fixed a typo.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11367
2010-09-19 17:16:39 +00:00
Bart Van Assche
e7b5c2eb6e memcheck/tests/linux/timerfd-syscall: send output to stderr instead of stdout.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11366
2010-09-19 17:13:53 +00:00
Bart Van Assche
e8e16af0dc Made sure that the sigqueue regression test passes on 32-bit and on 64-bit systems.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10922
2009-10-30 11:37:35 +00:00
Bart Van Assche
0e5846e018 Fixed expected output.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10916
2009-10-28 10:13:20 +00:00
Bart Van Assche
8e84bb3784 Added a comment that explains the purpose of the sigqueue.c test program.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10915
2009-10-28 10:13:03 +00:00