508958 FreeBSD: add getgroups and setgroups wrappers
509103 Fix tests/arm64/bug484935.c build with "-O2 -flto -ffat-lto-objects"
509107 memcheck/tests/duplicate_align_size_errors.cpp fails
+509139 Update BadSize error messages
To see details of a given bug, visit
https://bugs.kde.org/show_bug.cgi?id=XXXXXX
#if defined(VGO_linux)
+ FREE_ALIGNED_SIZED(VG_Z_LIBC_SONAME, free_aligned_sized, free, FreeAlignedSized );
+ FREE_ALIGNED_SIZED(SO_SYN_MALLOC, free_aligned_sized, free, FreeAlignedSized );
#elif defined(VGO_freebsd)
FREE_ALIGNED_SIZED(VG_Z_LIBC_SONAME, free_aligned_sized, free, FreeAlignedSized );
Err_FishyValue,
Err_ReallocSizeZero,
Err_BadAlign,
- Err_BadSize,
+ Err_UnsafeZeroSize,
Err_SizeMismatch,
Err_AlignMismatch,
}
struct {
AddrInfo ai;
- SizeT size;
- const HChar *func;
- } BadSize;
+ } UnsafeZeroSize;
// Call to strcpy, memcpy, etc, with overlapping blocks.
struct {
}
break;
- case Err_BadSize:
+ case Err_UnsafeZeroSize:
if (xml) {
emit( " <kind>InvalidSize</kind>\n" );
- emit( " <what>%s invalid size value: %lu</what>\n",
- extra->Err.BadSize.func, extra->Err.BadSize.size );
+ emit( " <what>Unsafe allocation with size of zero is implementation-defined</what>\n");
VG_(pp_ExeContext)( VG_(get_error_where)(err) );
} else {
- emit( "%s invalid size value: %lu\n",
- extra->Err.BadSize.func, extra->Err.BadSize.size );
+ emit( "Unsafe allocation with size of zero is implementation-defined\n");
VG_(pp_ExeContext)( VG_(get_error_where)(err) );
}
break;
VG_(maybe_record_error)( tid, Err_BadAlign, /*addr*/0, /*s*/NULL, &extra );
}
-void MC_(record_bad_size) ( ThreadId tid, SizeT size, const HChar *function )
+void MC_(record_unsafe_zero_size) ( ThreadId tid )
{
- MC_Error extra;
tl_assert(VG_INVALID_THREADID != tid);
- extra.Err.BadSize.size= size;
- extra.Err.BadSize.func = function;
- VG_(maybe_record_error)( tid, Err_BadSize, /*addr*/0, /*s*/NULL, &extra );
+ VG_(maybe_record_error)( tid, Err_UnsafeZeroSize, /*addr*/0, /*s*/NULL, /*extra*/NULL );
}
void MC_(record_illegal_mempool_error) ( ThreadId tid, Addr a )
case Err_Overlap:
case Err_Cond:
case Err_ReallocSizeZero:
+ case Err_UnsafeZeroSize:
return True;
case Err_FishyValue:
extra2->Err.BadAlign.dealloc_align;
}
- case Err_BadSize:
- // sized delete mismatch
- return extra1->Err.BadSize.size ==
- extra2->Err.BadSize.size;
-
case Err_SizeMismatch:
return extra1->Err.SizeMismatch.size ==
extra2->Err.SizeMismatch.size;
// we make it consistent with the others.
case Err_Leak:
case Err_BadAlign:
- case Err_BadSize:
+ case Err_UnsafeZeroSize:
case Err_SizeMismatch:
case Err_AlignMismatch:
return sizeof(MC_Error);
MempoolSupp, // Memory pool suppression.
FishyValueSupp, // Fishy value suppression.
ReallocSizeZeroSupp, // realloc size 0 suppression
- BadAlignSupp, // Alignment not 2
- BadSizeSupp, // aligned alloc with size 0
- SizeMismatch, // Sized deallocation did not match allocation size
- AlignMismatch, // Aligned deallocation did not match aligned allocation
+ BadAlignSupp, // Alignment not 2
+ UnsafeZeroSizeSupp, // aligned alloc with size 0
+ SizeMismatch, // Sized deallocation did not match allocation size
+ AlignMismatch, // Aligned deallocation did not match aligned allocation
}
MC_SuppKind;
else if (VG_STREQ(name, "FishyValue")) skind = FishyValueSupp;
else if (VG_STREQ(name, "ReallocZero")) skind = ReallocSizeZeroSupp;
else if (VG_STREQ(name, "BadAlign")) skind = BadAlignSupp;
- else if (VG_STREQ(name, "BadSize")) skind = BadSizeSupp;
+ else if (VG_STREQ(name, "UnsafeZeroSize")) skind = UnsafeZeroSizeSupp;
else if (VG_STREQ(name, "SizeMismatch")) skind = SizeMismatch;
else if (VG_STREQ(name, "AlignMismatch")) skind = AlignMismatch;
else
case BadAlignSupp:
return (ekind == Err_BadAlign);
- case BadSizeSupp:
- return (ekind == Err_BadSize);
+ case UnsafeZeroSizeSupp:
+ return (ekind == Err_UnsafeZeroSize);
case SizeMismatch:
return (ekind == Err_SizeMismatch);
case Err_FishyValue: return "FishyValue";
case Err_ReallocSizeZero: return "ReallocZero";
case Err_BadAlign: return "BadAlign";
- case Err_BadSize: return "BadSize";
+ case Err_UnsafeZeroSize: return "UnsafeZeroSize";
case Err_SizeMismatch: return "SizeMismatch";
case Err_AlignMismatch: return "AlignMismatch";
case Err_Addr: {
void MC_(record_freemismatch_error) ( ThreadId tid, MC_Chunk* mc );
void MC_(record_realloc_size_zero) ( ThreadId tid, Addr a );
void MC_(record_bad_alignment) ( ThreadId tid, SizeT align, SizeT size, const HChar *msg);
-void MC_(record_bad_size) ( ThreadId tid, SizeT align, const HChar *function);
+void MC_(record_unsafe_zero_size) ( ThreadId tid);
void MC_(record_overlap_error) ( ThreadId tid, const HChar* function,
Addr src, Addr dst, SizeT szB );
}
// size zero not allowed on all platforms (e.g. Illumos)
if (aligned_alloc_info->size == 0) {
- MC_(record_bad_size) ( tid, aligned_alloc_info->size, "memalign()" );
+ MC_(record_unsafe_zero_size) ( tid );
}
break;
case AllocKindPosixMemalign:
MC_(record_bad_alignment) ( tid, aligned_alloc_info->orig_alignment , 0U, " (should be non-zero, a power of 2 and a multiple of sizeof(void*))" );
}
if (aligned_alloc_info->size == 0) {
- MC_(record_bad_size) ( tid, aligned_alloc_info->size, "posix_memalign()" );
+ MC_(record_unsafe_zero_size) ( tid);
}
break;
case AllocKindAlignedAlloc:
MC_(record_bad_alignment) ( tid, aligned_alloc_info->orig_alignment , aligned_alloc_info->size, " (size should be a multiple of alignment)" );
}
if (aligned_alloc_info->size == 0) {
- MC_(record_bad_size) ( tid, aligned_alloc_info->size, "aligned_alloc()" );
+ MC_(record_unsafe_zero_size) ( tid );
}
break;
case AllocKindDeleteSized:
}
break;
case AllocKindFreeAlignedSized:
- // same alignment checks as aligned_alloc
+ // same alignment checks as aligned_alloc, but allow a size of 0
if ((aligned_alloc_info->orig_alignment & (aligned_alloc_info->orig_alignment - 1)) != 0) {
MC_(record_bad_alignment) ( tid, aligned_alloc_info->orig_alignment , 0U, " (should be a power of 2)" );
}
aligned_alloc_info->size % aligned_alloc_info->orig_alignment != 0U) {
MC_(record_bad_alignment) ( tid, aligned_alloc_info->orig_alignment , aligned_alloc_info->size, " (size should be a multiple of alignment)" );
}
- if (aligned_alloc_info->size == 0) {
- MC_(record_bad_size) ( tid, aligned_alloc_info->size, "free_aligned_sized()" );
- }
mc = VG_(HT_lookup) ( MC_(malloc_list), (UWord)aligned_alloc_info->mem );
if (mc && aligned_alloc_info->orig_alignment != mc->alignB) {
MC_(record_align_mismatch_error) ( tid, mc, aligned_alloc_info->orig_alignment, False, "aligned_alloc/free_aligned_sized");
mem = nullptr;
}
- // Err.BadSize
+ // Err.UnsafeZeroSize
mem = aligned_alloc(64U, 0U);
if (mem)
{
at 0x........: aligned_alloc (vg_replace_malloc.c:...)
by 0x........: main (duplicate_align_size_errors.cpp:25)
-aligned_alloc() invalid size value: 0
+Unsafe allocation with size of zero is implementation-defined
at 0x........: aligned_alloc (vg_replace_malloc.c:...)
by 0x........: main (duplicate_align_size_errors.cpp:33)
at 0x........: operator delete(void*, std::align_val_t, std::nothrow_t const&) (vg_replace_malloc.c:...)
by 0x........: main (duplicate_align_size_errors.cpp:20)
-memalign() invalid size value: 0
+Unsafe allocation with size of zero is implementation-defined
at 0x........: memalign (vg_replace_malloc.c:...)
by 0x........: main (duplicate_align_size_errors.cpp:33)
{
aligned_alloc bad size
- Memcheck:BadSize
+ Memcheck:UnsafeZeroSize
fun:aligned_alloc
fun:main
}
at 0x........: posix_memalign (vg_replace_malloc.c:...)
by 0x........: main (errno_aligned_allocs.c:20)
-aligned_alloc() invalid size value: 0
+Unsafe allocation with size of zero is implementation-defined
at 0x........: aligned_alloc (vg_replace_malloc.c:...)
by 0x........: main (errno_aligned_allocs.c:60)
at 0x........: memalign (vg_replace_malloc.c:...)
by 0x........: main (memalign.c:78)
-memalign() invalid size value: 0
+Unsafe allocation with size of zero is implementation-defined
at 0x........: memalign (vg_replace_malloc.c:...)
by 0x........: main (memalign.c:87)
at 0x........: memalign (vg_replace_malloc.c:...)
by 0x........: main (memalign.c:145)
-memalign() invalid size value: 0
+Unsafe allocation with size of zero is implementation-defined
at 0x........: memalign (vg_replace_malloc.c:...)
by 0x........: main (memalign.c:155)
-posix_memalign() invalid size value: 0
+Unsafe allocation with size of zero is implementation-defined
at 0x........: posix_memalign (vg_replace_malloc.c:...)
by 0x........: main (posix_memalign.c:32)
{
posix_memalign size
- Memcheck:BadSize
+ Memcheck:UnsafeZeroSize
fun:posix_memalign
fun:main
}
# Darwin uses zones
{
- posix_memalign size
- Memcheck:BadSize
+ posix_memalign zero size
+ Memcheck:UnsafeZeroSize
fun:malloc_zone_memalign
fun:posix_memalign
fun:main
<unique>0x........</unique>
<tid>...</tid>
<kind>InvalidSize</kind>
- <what>posix_memalign() invalid size value: 0</what>
+ <what>Unsafe allocation with size of zero is implementation-defined</what>
<stack>
<frame>
<ip>0x........</ip>
-memalign() invalid size value: 0
+Unsafe allocation with size of zero is implementation-defined
at 0x........: memalign (vg_replace_malloc.c:...)
by 0x........: main (memalign.c:29)