You can subscribe to this list here.
| 2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
(122) |
Nov
(152) |
Dec
(69) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2003 |
Jan
(6) |
Feb
(25) |
Mar
(73) |
Apr
(82) |
May
(24) |
Jun
(25) |
Jul
(10) |
Aug
(11) |
Sep
(10) |
Oct
(54) |
Nov
(203) |
Dec
(182) |
| 2004 |
Jan
(307) |
Feb
(305) |
Mar
(430) |
Apr
(312) |
May
(187) |
Jun
(342) |
Jul
(487) |
Aug
(637) |
Sep
(336) |
Oct
(373) |
Nov
(441) |
Dec
(210) |
| 2005 |
Jan
(385) |
Feb
(480) |
Mar
(636) |
Apr
(544) |
May
(679) |
Jun
(625) |
Jul
(810) |
Aug
(838) |
Sep
(634) |
Oct
(521) |
Nov
(965) |
Dec
(543) |
| 2006 |
Jan
(494) |
Feb
(431) |
Mar
(546) |
Apr
(411) |
May
(406) |
Jun
(322) |
Jul
(256) |
Aug
(401) |
Sep
(345) |
Oct
(542) |
Nov
(308) |
Dec
(481) |
| 2007 |
Jan
(427) |
Feb
(326) |
Mar
(367) |
Apr
(255) |
May
(244) |
Jun
(204) |
Jul
(223) |
Aug
(231) |
Sep
(354) |
Oct
(374) |
Nov
(497) |
Dec
(362) |
| 2008 |
Jan
(322) |
Feb
(482) |
Mar
(658) |
Apr
(422) |
May
(476) |
Jun
(396) |
Jul
(455) |
Aug
(267) |
Sep
(280) |
Oct
(253) |
Nov
(232) |
Dec
(304) |
| 2009 |
Jan
(486) |
Feb
(470) |
Mar
(458) |
Apr
(423) |
May
(696) |
Jun
(461) |
Jul
(551) |
Aug
(575) |
Sep
(134) |
Oct
(110) |
Nov
(157) |
Dec
(102) |
| 2010 |
Jan
(226) |
Feb
(86) |
Mar
(147) |
Apr
(117) |
May
(107) |
Jun
(203) |
Jul
(193) |
Aug
(238) |
Sep
(300) |
Oct
(246) |
Nov
(23) |
Dec
(75) |
| 2011 |
Jan
(133) |
Feb
(195) |
Mar
(315) |
Apr
(200) |
May
(267) |
Jun
(293) |
Jul
(353) |
Aug
(237) |
Sep
(278) |
Oct
(611) |
Nov
(274) |
Dec
(260) |
| 2012 |
Jan
(303) |
Feb
(391) |
Mar
(417) |
Apr
(441) |
May
(488) |
Jun
(655) |
Jul
(590) |
Aug
(610) |
Sep
(526) |
Oct
(478) |
Nov
(359) |
Dec
(372) |
| 2013 |
Jan
(467) |
Feb
(226) |
Mar
(391) |
Apr
(281) |
May
(299) |
Jun
(252) |
Jul
(311) |
Aug
(352) |
Sep
(481) |
Oct
(571) |
Nov
(222) |
Dec
(231) |
| 2014 |
Jan
(185) |
Feb
(329) |
Mar
(245) |
Apr
(238) |
May
(281) |
Jun
(399) |
Jul
(382) |
Aug
(500) |
Sep
(579) |
Oct
(435) |
Nov
(487) |
Dec
(256) |
| 2015 |
Jan
(338) |
Feb
(357) |
Mar
(330) |
Apr
(294) |
May
(191) |
Jun
(108) |
Jul
(142) |
Aug
(261) |
Sep
(190) |
Oct
(54) |
Nov
(83) |
Dec
(22) |
| 2016 |
Jan
(49) |
Feb
(89) |
Mar
(33) |
Apr
(50) |
May
(27) |
Jun
(34) |
Jul
(53) |
Aug
(53) |
Sep
(98) |
Oct
(206) |
Nov
(93) |
Dec
(53) |
| 2017 |
Jan
(65) |
Feb
(82) |
Mar
(102) |
Apr
(86) |
May
(187) |
Jun
(67) |
Jul
(23) |
Aug
(93) |
Sep
(65) |
Oct
(45) |
Nov
(35) |
Dec
(17) |
| 2018 |
Jan
(26) |
Feb
(35) |
Mar
(38) |
Apr
(32) |
May
(8) |
Jun
(43) |
Jul
(27) |
Aug
(30) |
Sep
(43) |
Oct
(42) |
Nov
(38) |
Dec
(67) |
| 2019 |
Jan
(32) |
Feb
(37) |
Mar
(53) |
Apr
(64) |
May
(49) |
Jun
(18) |
Jul
(14) |
Aug
(53) |
Sep
(25) |
Oct
(30) |
Nov
(49) |
Dec
(31) |
| 2020 |
Jan
(87) |
Feb
(45) |
Mar
(37) |
Apr
(51) |
May
(99) |
Jun
(36) |
Jul
(11) |
Aug
(14) |
Sep
(20) |
Oct
(24) |
Nov
(40) |
Dec
(23) |
| 2021 |
Jan
(14) |
Feb
(53) |
Mar
(85) |
Apr
(15) |
May
(19) |
Jun
(3) |
Jul
(14) |
Aug
(1) |
Sep
(57) |
Oct
(73) |
Nov
(56) |
Dec
(22) |
| 2022 |
Jan
(3) |
Feb
(22) |
Mar
(6) |
Apr
(55) |
May
(46) |
Jun
(39) |
Jul
(15) |
Aug
(9) |
Sep
(11) |
Oct
(34) |
Nov
(20) |
Dec
(36) |
| 2023 |
Jan
(79) |
Feb
(41) |
Mar
(99) |
Apr
(169) |
May
(48) |
Jun
(16) |
Jul
(16) |
Aug
(57) |
Sep
(19) |
Oct
|
Nov
|
Dec
|
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
|
1
|
2
|
3
|
4
|
5
|
6
|
7
(2) |
|
8
|
9
(8) |
10
(4) |
11
(1) |
12
|
13
(1) |
14
(2) |
|
15
|
16
|
17
|
18
(1) |
19
(6) |
20
(4) |
21
(1) |
|
22
(1) |
23
(1) |
24
(1) |
25
|
26
|
27
(8) |
28
|
|
29
|
30
(1) |
31
(4) |
|
|
|
|
|
From: Paul F. <pa...@so...> - 2022-05-09 20:57:27
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=978eb7f1ab4ea5990bf08e68a7a417933271e11b commit 978eb7f1ab4ea5990bf08e68a7a417933271e11b Author: Paul Floyd <pj...@wa...> Date: Mon May 9 22:53:04 2022 +0200 Bug 446754 Improve error codes from alloc functions under memcheck I've made these changes only for FreeBSD and Solaris for the moment. I don't know what should be done on Linux for aligned_alloc/memalign. The current Valgrind code refects the glibc implementation, but not what the documentation says. Diff: --- .gitignore | 1 + NEWS | 1 + coregrind/m_replacemalloc/vg_replace_malloc.c | 72 +++++++++++++++++++++- memcheck/tests/freebsd/Makefile.am | 6 +- memcheck/tests/freebsd/errno_aligned_allocs.c | 49 +++++++++++++++ .../tests/freebsd/errno_aligned_allocs.stderr.exp | 10 +++ memcheck/tests/freebsd/errno_aligned_allocs.vgtest | 3 + 7 files changed, 137 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 78ea5819a6..c7202fab3a 100644 --- a/.gitignore +++ b/.gitignore @@ -1342,6 +1342,7 @@ /memcheck/tests/freebsd/realpathat /memcheck/tests/freebsd/scalar_13_plus /memcheck/tests/freebsd/452275 +/memcheck/tests/freebsd/errno_aligned_allocs # /memcheck/tests/amd64-freebsd /memcheck/tests/amd64-freebsd/*.stderr.diff diff --git a/NEWS b/NEWS index 05eb34d1f6..dac9a1ce2a 100644 --- a/NEWS +++ b/NEWS @@ -35,6 +35,7 @@ bugzilla (https://bugs.kde.org/enter_bug.cgi?product=valgrind) rather than mailing the developers (or mailing lists) directly -- bugs that are not entered into bugzilla tend to get forgotten about or ignored. +446754 Improve error codes from alloc functions under memcheck 452274 memcheck crashes with Assertion 'sci->status.what == SsIdle' failed 452779 Valgrind fails to build on FreeBSD 13.0 with llvm-devel (15.0.0) 453055 shared_timed_mutex drd test fails with "Lock shared failed" message diff --git a/coregrind/m_replacemalloc/vg_replace_malloc.c b/coregrind/m_replacemalloc/vg_replace_malloc.c index 9711b6573a..164c9ed910 100644 --- a/coregrind/m_replacemalloc/vg_replace_malloc.c +++ b/coregrind/m_replacemalloc/vg_replace_malloc.c @@ -193,15 +193,27 @@ static void init(void); if (info.clo_trace_malloc) { \ VALGRIND_INTERNAL_PRINTF(format, ## args ); } -/* Tries to set ERRNO to ENOMEM if possible. - Only implemented for glibc at the moment. -*/ +/* Tries to set ERRNO to ENOMEM/EINVAL if possible. */ #if defined(VGO_linux) extern int *__errno_location (void) __attribute__((weak)); #define SET_ERRNO_ENOMEM if (__errno_location) \ (*__errno_location ()) = VKI_ENOMEM; +#define SET_ERRNO_EINVAL {} +#elif defined(VGO_freebsd) +extern int *__error (void) __attribute__((weak)); +#define SET_ERRNO_ENOMEM if (__error) \ + (*__error ()) = VKI_ENOMEM; +#define SET_ERRNO_EINVAL if (__error) \ + (*__error ()) = VKI_EINVAL; +#elif defined(VGO_solaris) +extern int *___errno (void) __attribute__((weak)); +#define SET_ERRNO_ENOMEM if (___errno) \ + (*___errno ()) = VKI_ENOMEM; +#define SET_ERRNO_EINVAL if (___errno) \ + (*___errno ()) = VKI_EINVAL; #else #define SET_ERRNO_ENOMEM {} +#define SET_ERRNO_EINVAL {} #endif /* Below are new versions of malloc, __builtin_new, free, @@ -1482,6 +1494,7 @@ extern int *__errno_location (void) __attribute__((weak)); \ v = (void*)VALGRIND_NON_SIMD_CALL2( info.tl_memalign, alignment, n ); \ MALLOC_TRACE(" = %p\n", v ); \ + if (!v) SET_ERRNO_ENOMEM; \ return v; \ } @@ -1703,6 +1716,32 @@ extern int *__errno_location (void) __attribute__((weak)); /*---------------------- aligned_alloc ----------------------*/ + /* + * No OS does things the same way. + * + * Linux, the man page claims that the alignment must be a power + * of two and that size should be a multiple of alignment. + * However the only case that returns EINVAL (glibc 2.34) + * is if the alignement is > SIZE_MAX / 2 + 1 + * Also this is just a weak alias for memalign so this wrapper + * has no effect on Linux. + * + * FreeBSD. the man page claims alignment must be a power of 2. + * UB if size is not an integral multiple of alignment. + * The code checks that the alignment is a power of + * 2 and not less than the minumum alignment (1) + * + * Solaris: doesn't seem to exist on 11.3 + * Illumos: invalid if the size is 0, the alignment is 0, the + * alignment is not a multiple of 4 (no power of 2 + * requirement even though the manpage claims is) or the + * alignment is greater than MAX_ALIGN (whatever that is). + * Wrapper function that just calls memalign + * + */ + +#if defined (VGO_linux) + #define ALIGNED_ALLOC(soname, fnname) \ \ void* VG_REPLACE_FUNCTION_EZU(10170,soname,fnname) \ @@ -1725,6 +1764,33 @@ extern int *__errno_location (void) __attribute__((weak)); return mem; \ } +#else + + #define ALIGNED_ALLOC(soname, fnname) \ + \ + void* VG_REPLACE_FUNCTION_EZU(10170,soname,fnname) \ + ( SizeT alignment, SizeT size ); \ + void* VG_REPLACE_FUNCTION_EZU(10170,soname,fnname) \ + ( SizeT alignment, SizeT size ) \ + { \ + void *mem; \ + \ + if (alignment == 0 \ + || size % alignment != 0 \ + || (alignment & (alignment - 1)) != 0) { \ + SET_ERRNO_EINVAL; \ + return 0; \ + } \ + \ + mem = VG_REPLACE_FUNCTION_EZU(10110,VG_Z_LIBC_SONAME,memalign) \ + (alignment, size); \ + \ + if (!mem) SET_ERRNO_ENOMEM; \ + \ + return mem; \ + } +#endif + #if defined(VGO_linux) ALIGNED_ALLOC(VG_Z_LIBC_SONAME, aligned_alloc); ALIGNED_ALLOC(SO_SYN_MALLOC, aligned_alloc); diff --git a/memcheck/tests/freebsd/Makefile.am b/memcheck/tests/freebsd/Makefile.am index f70e822a41..b9dc4a6d76 100644 --- a/memcheck/tests/freebsd/Makefile.am +++ b/memcheck/tests/freebsd/Makefile.am @@ -79,14 +79,16 @@ EXTRA_DIST = \ eventfd1.vgtest \ eventfd1.stderr.exp eventfd1.stdout.exp \ eventfd2.vgtest \ - eventfd2.stderr.exp eventfd2.stdout.exp + eventfd2.stderr.exp eventfd2.stdout.exp \ + errno_aligned_allocs.vgtest \ + errno_aligned_allocs.stderr.exp check_PROGRAMS = \ statfs pdfork_pdkill getfsstat inlinfo inlinfo_nested.so extattr \ sigwait chflags get_set_login revoke scalar capsicum getfh \ linkat scalar_fork scalar_thr_exit scalar_abort2 scalar_pdfork \ scalar_vfork stat file_locking_wait6 utimens access chmod_chown \ - misc get_set_context utimes static_allocs fexecve + misc get_set_context utimes static_allocs fexecve errno_aligned_allocs AM_CFLAGS += $(AM_FLAG_M3264_PRI) AM_CXXFLAGS += $(AM_FLAG_M3264_PRI) diff --git a/memcheck/tests/freebsd/errno_aligned_allocs.c b/memcheck/tests/freebsd/errno_aligned_allocs.c new file mode 100644 index 0000000000..50c4959af6 --- /dev/null +++ b/memcheck/tests/freebsd/errno_aligned_allocs.c @@ -0,0 +1,49 @@ +#include <stdlib.h> +#if defined(__FreeBSD__) +#include <malloc_np.h> +#endif +#include <assert.h> +#include <errno.h> + +int main(void) +{ + char* p = NULL; + int res; + + // zero alignment + res = posix_memalign((void**)&p, 0, 8); + assert(p == NULL && res == EINVAL); + // non multiple of alignment passes on FreeBSD + //res = posix_memalign((void**)&p, 8, 25); + //assert(p == NULL && res == EINVAL); + // align not multiple of sizeof(void*) + res = posix_memalign((void**)&p, 2, 32); + assert(p == NULL && res == EINVAL); + // align not power of two + res = posix_memalign((void**)&p, 40, 160); + assert(p == NULL && res == EINVAL); + // too big + res = posix_memalign((void**)&p, 16, 1UL<<48); + assert(p == NULL && res == ENOMEM); + errno = 0; + + + // if ever we make this multi-platform, Solaris doesn't support this + // zero size + p = aligned_alloc(0, 8); + assert(p == NULL && errno == EINVAL); + errno = 0; + // non multiple of alignment passes on FreeBSD + //p = aligned_alloc(8, 25); + //assert(p == NULL && errno == EINVAL); + //errno = 0; + // align not power of 2 + p = aligned_alloc(40, 160); + assert(p == NULL && errno == EINVAL); + errno = 0; + // too big + p = aligned_alloc(16, 1UL<<48); + assert(p == NULL && errno == ENOMEM); +} + + diff --git a/memcheck/tests/freebsd/errno_aligned_allocs.stderr.exp b/memcheck/tests/freebsd/errno_aligned_allocs.stderr.exp new file mode 100644 index 0000000000..eb42921c60 --- /dev/null +++ b/memcheck/tests/freebsd/errno_aligned_allocs.stderr.exp @@ -0,0 +1,10 @@ + + +HEAP SUMMARY: + in use at exit: 0 bytes in 0 blocks + total heap usage: 0 allocs, 0 frees, 0 bytes allocated + +For a detailed leak analysis, rerun with: --leak-check=full + +For lists of detected and suppressed errors, rerun with: -s +ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0) diff --git a/memcheck/tests/freebsd/errno_aligned_allocs.vgtest b/memcheck/tests/freebsd/errno_aligned_allocs.vgtest new file mode 100644 index 0000000000..c5dc4696e8 --- /dev/null +++ b/memcheck/tests/freebsd/errno_aligned_allocs.vgtest @@ -0,0 +1,3 @@ +prog: errno_aligned_allocs + + |
|
From: Paul F. <pa...@so...> - 2022-05-09 19:29:05
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=35fcf875c6b7ba107e468d7a9d88df1e70058edd commit 35fcf875c6b7ba107e468d7a9d88df1e70058edd Author: Paul Floyd <pj...@wa...> Date: Mon May 9 21:27:36 2022 +0200 FreeBSD shm_open2 also accepts first argument as SHM_ANON Add an extra test to scalar Diff: --- memcheck/tests/freebsd/scalar_13_plus.c | 6 +++++- memcheck/tests/freebsd/scalar_13_plus.stderr.exp | 22 ++++++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/memcheck/tests/freebsd/scalar_13_plus.c b/memcheck/tests/freebsd/scalar_13_plus.c index 4ba48efa60..b22152ebb2 100644 --- a/memcheck/tests/freebsd/scalar_13_plus.c +++ b/memcheck/tests/freebsd/scalar_13_plus.c @@ -1,4 +1,5 @@ #include "scalar.h" +#include <sys/mman.h> int main(void) { @@ -7,7 +8,10 @@ int main(void) /* SYS_shm_open2 571 */ GO(SYS_shm_open2, " 5s 2m"); - SY(SYS_shm_open2, x0, x0+1, x0+2, x0+3, x0+4); FAIL; + SY(SYS_shm_open2, x0+0xf00c, x0+1, x0+2, x0+3, x0+4); FAIL; + + GO(SYS_shm_open2, " 5s 1m"); + SY(SYS_shm_open2, x0+SHM_ANON, x0+1, x0+2, x0+3, x0+4); FAIL; /* SYS___realpathat 574 */ GO(SYS___realpathat, " 5s 2m"); diff --git a/memcheck/tests/freebsd/scalar_13_plus.stderr.exp b/memcheck/tests/freebsd/scalar_13_plus.stderr.exp index 02447b53ae..489646810b 100644 --- a/memcheck/tests/freebsd/scalar_13_plus.stderr.exp +++ b/memcheck/tests/freebsd/scalar_13_plus.stderr.exp @@ -24,6 +24,28 @@ Syscall param shm_open2(name) points to unaddressable byte(s) ... Address 0x........ is not stack'd, malloc'd or (recently) free'd +--------------------------------------------------------- +571: SYS_shm_open2 5s 1m +--------------------------------------------------------- +Syscall param shm_open2(path) contains uninitialised byte(s) + ... + +Syscall param shm_open2(flags) contains uninitialised byte(s) + ... + +Syscall param shm_open2(mode) contains uninitialised byte(s) + ... + +Syscall param shm_open2(shmflags) contains uninitialised byte(s) + ... + +Syscall param shm_open2(name) contains uninitialised byte(s) + ... + +Syscall param shm_open2(name) points to unaddressable byte(s) + ... + Address 0x........ is not stack'd, malloc'd or (recently) free'd + --------------------------------------------------------- 574: SYS___realpathat 5s 2m --------------------------------------------------------- |
|
From: Paul F. <pa...@so...> - 2022-05-09 10:00:25
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=d99b369c094145fd0203fbde59bd6d173b8bc5d0 commit d99b369c094145fd0203fbde59bd6d173b8bc5d0 Author: Paul Floyd <pj...@wa...> Date: Mon May 9 11:58:45 2022 +0200 FreeBSD shm_open2 arg5 seems to be optional This syscall doesn't have a libc interface and manpage so the documentation is skimpy. Diff: --- coregrind/m_syswrap/syswrap-freebsd.c | 4 +++- memcheck/tests/freebsd/scalar_13_plus.c | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/coregrind/m_syswrap/syswrap-freebsd.c b/coregrind/m_syswrap/syswrap-freebsd.c index eed1b5a6da..0f2c2681d3 100644 --- a/coregrind/m_syswrap/syswrap-freebsd.c +++ b/coregrind/m_syswrap/syswrap-freebsd.c @@ -6241,7 +6241,9 @@ PRE(sys_shm_open2) PRE_MEM_RASCIIZ( "shm_open2(path)", ARG1 ); } - PRE_MEM_RASCIIZ( "shm_open2(name)", ARG5 ); + if (ARG5) { + PRE_MEM_RASCIIZ( "shm_open2(name)", ARG5 ); + } *flags |= SfMayBlock; } diff --git a/memcheck/tests/freebsd/scalar_13_plus.c b/memcheck/tests/freebsd/scalar_13_plus.c index a0f5dfe363..4ba48efa60 100644 --- a/memcheck/tests/freebsd/scalar_13_plus.c +++ b/memcheck/tests/freebsd/scalar_13_plus.c @@ -7,7 +7,7 @@ int main(void) /* SYS_shm_open2 571 */ GO(SYS_shm_open2, " 5s 2m"); - SY(SYS_shm_open2, x0, x0+1, x0+2, x0+3, x0); FAIL; + SY(SYS_shm_open2, x0, x0+1, x0+2, x0+3, x0+4); FAIL; /* SYS___realpathat 574 */ GO(SYS___realpathat, " 5s 2m"); |
|
From: Paul F. <pa...@so...> - 2022-05-09 09:06:23
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=3a883a6c1d46782e8f1d7c1b2bb773728ed61355 commit 3a883a6c1d46782e8f1d7c1b2bb773728ed61355 Author: Paul Floyd <pj...@wa...> Date: Mon May 9 11:05:49 2022 +0200 Add FreeBSD shm_open2 syscall wrapper Diff: --- coregrind/m_syswrap/priv_syswrap-freebsd.h | 2 +- coregrind/m_syswrap/syswrap-freebsd.c | 40 ++++++++++++++++++++++-- memcheck/tests/freebsd/scalar_13_plus.c | 4 +++ memcheck/tests/freebsd/scalar_13_plus.stderr.exp | 26 +++++++++++++++ 4 files changed, 69 insertions(+), 3 deletions(-) diff --git a/coregrind/m_syswrap/priv_syswrap-freebsd.h b/coregrind/m_syswrap/priv_syswrap-freebsd.h index 36a48ac1ff..5d6bec529c 100644 --- a/coregrind/m_syswrap/priv_syswrap-freebsd.h +++ b/coregrind/m_syswrap/priv_syswrap-freebsd.h @@ -533,7 +533,7 @@ DECL_TEMPLATE(freebsd, sys___sysctlbyname) // 570 #if (FREEBSD_VERS >= FREEBSD_13_0) // looks like close_range got backported // to 12.2 leaving these 4 marked as UNIMPL in 12.2 -// unimpl __NR_shm_open2 571 +DECL_TEMPLATE(freebsd, sys_shm_open2) // 571 // unimpl __NR_shm_rename 572 // unimpl __NR_sigfastblock 573 DECL_TEMPLATE(freebsd, sys___realpathat) // 574 diff --git a/coregrind/m_syswrap/syswrap-freebsd.c b/coregrind/m_syswrap/syswrap-freebsd.c index 64260f8a9a..eed1b5a6da 100644 --- a/coregrind/m_syswrap/syswrap-freebsd.c +++ b/coregrind/m_syswrap/syswrap-freebsd.c @@ -6221,7 +6221,43 @@ POST(sys___sysctlbyname) #if (FREEBSD_VERS >= FREEBSD_13_0) -// SYS___realpathat 474 +// SYS_shm_open2 571 +// from syscalls.master +// int shm_open2(_In_z_ const char *path, +// int flags, +// mode_t mode, +// int shmflags, +// _In_z_ const char *name); +PRE(sys_shm_open2) +{ + PRE_REG_READ5(int, "shm_open2", + const char *, path, int, flags, vki_mode_t, mode, int, shmflags, const char*, name); + if (ARG1 == VKI_SHM_ANON) { + PRINT("sys_shm_open2(%#" FMT_REGWORD "x(SHM_ANON), %" FMT_REGWORD "u, %hu, %d, %#" FMT_REGWORD "x(%s))", + ARG1, ARG2, (vki_mode_t)ARG3, (Int)ARG4, ARG5, (HChar*)ARG5); + } else { + PRINT("sys_shm_open2(%#" FMT_REGWORD "x(%s), %" FMT_REGWORD "u, %hu, %d, %#" FMT_REGWORD "x(%s))", + ARG1, (HChar *)ARG1, ARG2, (vki_mode_t)ARG3, (Int)ARG4, ARG5, (HChar*)ARG5); + PRE_MEM_RASCIIZ( "shm_open2(path)", ARG1 ); + } + + PRE_MEM_RASCIIZ( "shm_open2(name)", ARG5 ); + *flags |= SfMayBlock; +} + +POST(sys_shm_open2) +{ + vg_assert(SUCCESS); + if (!ML_(fd_allowed)(RES, "shm_open2", tid, True)) { + VG_(close)(RES); + SET_STATUS_Failure( VKI_EMFILE ); + } else { + if (VG_(clo_track_fds)) + ML_(record_fd_open_with_given_name)(tid, RES, (HChar*)ARG1); + } +} + +// SYS___realpathat 574 // from syscalls.master // int __realpathat(int fd, // _In_z_ const char *path, @@ -6969,7 +7005,7 @@ const SyscallTableEntry ML_(syscall_table)[] = { BSDXY(__NR___sysctlbyname, sys___sysctlbyname), // 570 #if (FREEBSD_VERS >= FREEBSD_13_0) - // unimpl __NR_shm_open2 571 + BSDXY(__NR_shm_open2, sys_shm_open2), // 571 // unimpl __NR_shm_rename 572 // unimpl __NR_sigfastblock 573 BSDXY( __NR___realpathat, sys___realpathat), // 574 diff --git a/memcheck/tests/freebsd/scalar_13_plus.c b/memcheck/tests/freebsd/scalar_13_plus.c index 5cb8102465..a0f5dfe363 100644 --- a/memcheck/tests/freebsd/scalar_13_plus.c +++ b/memcheck/tests/freebsd/scalar_13_plus.c @@ -5,6 +5,10 @@ int main(void) long *px = malloc(2*sizeof(long)); x0 = px[0]; + /* SYS_shm_open2 571 */ + GO(SYS_shm_open2, " 5s 2m"); + SY(SYS_shm_open2, x0, x0+1, x0+2, x0+3, x0); FAIL; + /* SYS___realpathat 574 */ GO(SYS___realpathat, " 5s 2m"); SY(SYS___realpathat, x0+0xffff, x0, x0, x0+100, x0+2); FAIL; diff --git a/memcheck/tests/freebsd/scalar_13_plus.stderr.exp b/memcheck/tests/freebsd/scalar_13_plus.stderr.exp index 91721fc7af..02447b53ae 100644 --- a/memcheck/tests/freebsd/scalar_13_plus.stderr.exp +++ b/memcheck/tests/freebsd/scalar_13_plus.stderr.exp @@ -1,3 +1,29 @@ +--------------------------------------------------------- +571: SYS_shm_open2 5s 2m +--------------------------------------------------------- +Syscall param shm_open2(path) contains uninitialised byte(s) + ... + +Syscall param shm_open2(flags) contains uninitialised byte(s) + ... + +Syscall param shm_open2(mode) contains uninitialised byte(s) + ... + +Syscall param shm_open2(shmflags) contains uninitialised byte(s) + ... + +Syscall param shm_open2(name) contains uninitialised byte(s) + ... + +Syscall param shm_open2(path) points to unaddressable byte(s) + ... + Address 0x........ is not stack'd, malloc'd or (recently) free'd + +Syscall param shm_open2(name) points to unaddressable byte(s) + ... + Address 0x........ is not stack'd, malloc'd or (recently) free'd + --------------------------------------------------------- 574: SYS___realpathat 5s 2m --------------------------------------------------------- |
|
From: Paul F. <pa...@so...> - 2022-05-09 07:50:45
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=a17b8d0198b994567576cd7cd0673ea875ef54a6 commit a17b8d0198b994567576cd7cd0673ea875ef54a6 Author: Paul Floyd <pj...@wa...> Date: Mon May 9 09:47:12 2022 +0200 Add FreeBSD-specific expected for memcheck/tests/gone_abrt_xml The difference is in the si_code. Linux has a value of 0, FreeBSD has 65537. This is correct. From vki-freebsd.h /* * si_code values */ and indeed this signal gets sent by kill() Diff: --- memcheck/tests/Makefile.am | 1 + memcheck/tests/gone_abrt_xml.stderr.exp-freebsd | 63 +++++++++++++++++++++++++ 2 files changed, 64 insertions(+) diff --git a/memcheck/tests/Makefile.am b/memcheck/tests/Makefile.am index eb6725f8d2..eb9487272d 100644 --- a/memcheck/tests/Makefile.am +++ b/memcheck/tests/Makefile.am @@ -163,6 +163,7 @@ EXTRA_DIST = \ fprw.stderr.exp-freebsd-x86 \ fwrite.stderr.exp fwrite.vgtest fwrite.stderr.exp-kfail \ gone_abrt_xml.vgtest gone_abrt_xml.stderr.exp gone_abrt_xml.stderr.exp-solaris \ + gone_abrt_xml.stderr.exp-freebsd \ holey_buffer_too_small.vgtest holey_buffer_too_small.stdout.exp \ holey_buffer_too_small.stderr.exp \ inits.stderr.exp inits.vgtest \ diff --git a/memcheck/tests/gone_abrt_xml.stderr.exp-freebsd b/memcheck/tests/gone_abrt_xml.stderr.exp-freebsd new file mode 100644 index 0000000000..c97485faf4 --- /dev/null +++ b/memcheck/tests/gone_abrt_xml.stderr.exp-freebsd @@ -0,0 +1,63 @@ +<?xml version="1.0"?> + +<valgrindoutput> + +<protocolversion>4</protocolversion> +<protocoltool>memcheck</protocoltool> + +<preamble> + <line>...</line> + <line>...</line> + <line>...</line> + <line>...</line> +</preamble> + +<pid>...</pid> +<ppid>...</ppid> +<tool>memcheck</tool> + +<args> + <vargv>...</vargv> + <argv> + <exe>./../../gdbserver_tests/gone</exe> + <arg>abort</arg> + </argv> +</args> + +<status> + <state>RUNNING</state> + <time>...</time> +</status> + +starting ... +aborting ... +<fatal_signal> + <tid>...</tid> + <signo>6</signo> + <signame>SIGABRT</signame> + <sicode>65537</sicode> + <stack> + <frame> + <ip>0x........</ip> + <obj>...</obj> + <fn>main</fn> + <dir>...</dir> + <file>gone.c</file> + <line>...</line> + </frame> + </stack> +</fatal_signal> + + +<status> + <state>FINISHED</state> + <time>...</time> +</status> + +<errorcounts> +</errorcounts> + +<suppcounts>...</suppcounts> + +</valgrindoutput> + |
|
From: Paul F. <pa...@so...> - 2022-05-09 07:18:33
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=1ec5d23e7386e6f2687f0f2087fbbc1a0c0e945b commit 1ec5d23e7386e6f2687f0f2087fbbc1a0c0e945b Author: Paul Floyd <pj...@wa...> Date: Mon May 9 09:16:48 2022 +0200 Make memcheck/tests/clientperm clang-friendly The use of the ternary operator was causing diffs compared to GCC output. Switching to use two 'ifs' should remove this difference. Diff: --- memcheck/tests/clientperm.c | 10 ++++++++-- memcheck/tests/clientperm.stderr.exp | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/memcheck/tests/clientperm.c b/memcheck/tests/clientperm.c index ac7574788d..12e2123fca 100644 --- a/memcheck/tests/clientperm.c +++ b/memcheck/tests/clientperm.c @@ -26,14 +26,20 @@ int main ( void ) for (i = 0; i < 100; i++) sum += aa[i]; - printf("sum is %s\n", sum > 0 ? "positive" : "non-positive"); + if (sum > 0) + printf("sum is positive\n"); + else + printf("sum is non-positive\n"); m = VALGRIND_DISCARD(m); printf("m_rm: returned value is %d\n", m ); for (i = 0; i < 100; i++) sum += aa[i]; - printf("sum is %s\n", sum > 0 ? "positive" : "non-positive"); + if (sum > 0) + printf("sum is positive\n"); + else + printf("sum is non-positive\n"); return 0; } diff --git a/memcheck/tests/clientperm.stderr.exp b/memcheck/tests/clientperm.stderr.exp index cb838c9ed8..76c4f5cab1 100644 --- a/memcheck/tests/clientperm.stderr.exp +++ b/memcheck/tests/clientperm.stderr.exp @@ -2,5 +2,5 @@ Conditional jump or move depends on uninitialised value(s) at 0x........: main (clientperm.c:29) Conditional jump or move depends on uninitialised value(s) - at 0x........: main (clientperm.c:36) + at 0x........: main (clientperm.c:39) |
|
From: Paul F. <pa...@so...> - 2022-05-09 06:17:56
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=54ee45d20808e02fcb162b29ef5f4d708c491884 commit 54ee45d20808e02fcb162b29ef5f4d708c491884 Author: Paul Floyd <pj...@wa...> Date: Mon May 9 08:15:06 2022 +0200 Update clang version of insn-pmovmskb expected. I'm not sure when this output changed. This expected differs from the main GCC expected due to clang emitting a cmovne for the ternary expression in 'use': fprintf(stderr, "%d: Invalid value is %s\n", index, invalid ? "true" : "false"); Diff: --- .../tests/amd64/insn-pmovmskb.stderr.exp-clang | 51 +++++++++++++++++++++- 1 file changed, 49 insertions(+), 2 deletions(-) diff --git a/memcheck/tests/amd64/insn-pmovmskb.stderr.exp-clang b/memcheck/tests/amd64/insn-pmovmskb.stderr.exp-clang index 6d32a1f331..e76c9ba126 100644 --- a/memcheck/tests/amd64/insn-pmovmskb.stderr.exp-clang +++ b/memcheck/tests/amd64/insn-pmovmskb.stderr.exp-clang @@ -1,22 +1,55 @@ -Conditional jump or move depends on uninitialised value(s) +Use of uninitialised value of size 8 + at 0x........: strlen (vg_replace_strmem.c:...) ... by 0x........: use (insn-pmovmskb.c:48) by 0x........: doit (insn-pmovmskb.c:69) by 0x........: main (insn-pmovmskb.c:140) Use of uninitialised value of size 8 + at 0x........: strlen (vg_replace_strmem.c:...) ... by 0x........: use (insn-pmovmskb.c:48) by 0x........: doit (insn-pmovmskb.c:69) by 0x........: main (insn-pmovmskb.c:140) -Use of uninitialised value of size 8 +Conditional jump or move depends on uninitialised value(s) + at 0x........: is_overlap (vg_replace_strmem.c:...) + by 0x........: memcpy (vg_replace_strmem.c:...) + ... + by 0x........: use (insn-pmovmskb.c:48) + by 0x........: doit (insn-pmovmskb.c:69) + by 0x........: main (insn-pmovmskb.c:140) + +Conditional jump or move depends on uninitialised value(s) + at 0x........: memcpy (vg_replace_strmem.c:...) + ... + by 0x........: use (insn-pmovmskb.c:48) + by 0x........: doit (insn-pmovmskb.c:69) + by 0x........: main (insn-pmovmskb.c:140) + +Conditional jump or move depends on uninitialised value(s) + at 0x........: memcpy (vg_replace_strmem.c:...) + ... + by 0x........: use (insn-pmovmskb.c:48) + by 0x........: doit (insn-pmovmskb.c:69) + by 0x........: main (insn-pmovmskb.c:140) + +Conditional jump or move depends on uninitialised value(s) + at 0x........: memcpy (vg_replace_strmem.c:...) + ... + by 0x........: use (insn-pmovmskb.c:48) + by 0x........: doit (insn-pmovmskb.c:69) + by 0x........: main (insn-pmovmskb.c:140) + +Conditional jump or move depends on uninitialised value(s) + at 0x........: memcpy (vg_replace_strmem.c:...) ... by 0x........: use (insn-pmovmskb.c:48) by 0x........: doit (insn-pmovmskb.c:69) by 0x........: main (insn-pmovmskb.c:140) Use of uninitialised value of size 8 + at 0x........: memcpy (vg_replace_strmem.c:...) ... by 0x........: use (insn-pmovmskb.c:48) by 0x........: doit (insn-pmovmskb.c:69) @@ -32,6 +65,20 @@ Use of uninitialised value of size 8 7: Invalid value is false 8: Invalid value is false 9: Invalid value is false +Use of uninitialised value of size 8 + at 0x........: memcpy (vg_replace_strmem.c:...) + ... + by 0x........: use (insn-pmovmskb.c:48) + by 0x........: doit (insn-pmovmskb.c:109) + by 0x........: main (insn-pmovmskb.c:140) + +Use of uninitialised value of size 8 + at 0x........: memcpy (vg_replace_strmem.c:...) + ... + by 0x........: use (insn-pmovmskb.c:48) + by 0x........: doit (insn-pmovmskb.c:109) + by 0x........: main (insn-pmovmskb.c:140) + 10: Invalid value is false 11: Invalid value is false 12: Invalid value is false |
|
From: Paul F. <pa...@so...> - 2022-05-09 05:50:42
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=407c00c2e9ef2bf3e87412d01e8ebc7baefbe8ef commit 407c00c2e9ef2bf3e87412d01e8ebc7baefbe8ef Author: Paul Floyd <pj...@wa...> Date: Mon May 9 07:49:56 2022 +0200 FreeBSD: only set osrel for executables. Diff: --- coregrind/m_debuginfo/readelf.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/coregrind/m_debuginfo/readelf.c b/coregrind/m_debuginfo/readelf.c index c586e3f332..998bc08fab 100644 --- a/coregrind/m_debuginfo/readelf.c +++ b/coregrind/m_debuginfo/readelf.c @@ -1147,6 +1147,12 @@ void read_and_set_osrel(DiImage* img) ElfXX_Ehdr ehdr; ML_(img_get)(&ehdr, img, 0, sizeof(ehdr)); + + /* only set osrel for executable files, not for subsequent shared libraries */ + if (ehdr.e_type != ET_EXEC) { + return; + } + /* Skip the phdrs when we have to search the shdrs. In separate .debug files the phdrs might not be valid (they are a copy of the main ELF file) and might trigger assertions when getting |