|
|
Home » Community » U++ community news and announcements » U++ 2019.1.rc4 released
|
Re: U++ 2019.1.rc4 released [message #51621 is a reply to message #51620] |
Sat, 20 April 2019 04:46 |
Novo
Messages: 1358 Registered: December 2006
|
Ultimate Contributor |
|
|
mirek wrote on Fri, 19 April 2019 19:06Will check all those too, but
Ops.h:3:51: runtime error: load of misaligned address
(and stores)
- that one is impossible to fix, it is meant to be.
Note #ifdef CPU_UNALIGNED before it...
Mirek
Do you mind adding code below to Defs.h and marking PeekXXle and PokeXXle with NO_UBSAN ?
// ***** Sanitizer-related
#if defined(__has_feature)
#if __has_feature(address_sanitizer)
#define NO_ASAN __attribute__((no_sanitize_address))
#else
#define NO_ASAN
#endif
#if __has_feature(memory_sanitizer)
#define NO_MSAN __attribute__((no_sanitize_memory))
#else
#define NO_MSAN
#endif
#else
// gcc doesn't have __has_feature
#if defined (__GNUC__)
#define NO_ASAN __attribute__((no_sanitize_address))
#else
#define NO_ASAN
#endif
// gcc doesn't support memory sanitizer.
#define NO_MSAN
// gcc doesn't support safe-stack sanitizer.
// gcc doesn't support shadow-call-stack sanitizer.
#endif
#if defined(__clang__) || defined (__GNUC__)
#define NO_UBSAN __attribute__((no_sanitize("undefined")))
#else
#define NO_UBSAN
#endif
Thank you in advance.
Regards,
Novo
|
|
|
|
|
Re: U++ 2019.1.rc4 released [message #51646 is a reply to message #51628] |
Tue, 23 April 2019 09:53 |
|
mirek
Messages: 13975 Registered: November 2005
|
Ultimate Member |
|
|
TheIDE now seems to run 'ubsan clean' (with GCC), but I really have mixed feeling about santizing bools:
struct Foo { bool a, b; };
Foo a, b;
a = b;
Above code fails with ubsan, as a / b are uninitialized. In practice this means you have to initialize all bool member variables if the struct is to be copied even if code logic absolutely does not need it....
[Updated on: Tue, 23 April 2019 09:54] Report message to a moderator
|
|
|
Re: U++ 2019.1.rc4 released [message #51653 is a reply to message #51628] |
Tue, 23 April 2019 15:05 |
Novo
Messages: 1358 Registered: December 2006
|
Ultimate Contributor |
|
|
mirek wrote on Mon, 22 April 2019 05:08"__interceptor_malloc" - It is very unlikely that U++ called that malloc (normally we do not allocated memory via malloc).
I'm using standard allocator with static build + shared libraries. Otherwise it won't link.
"All shared" will link fine with U++ allocator, if I remember correctly.
Regards,
Novo
|
|
|
Re: U++ 2019.1.rc4 released [message #51654 is a reply to message #51646] |
Tue, 23 April 2019 15:33 |
Novo
Messages: 1358 Registered: December 2006
|
Ultimate Contributor |
|
|
mirek wrote on Tue, 23 April 2019 03:53TheIDE now seems to run 'ubsan clean' (with GCC), but I really have mixed feeling about santizing bools:
struct Foo { bool a, b; };
Foo a, b;
a = b;
Above code fails with ubsan, as a / b are uninitialized. In practice this means you have to initialize all bool member variables if the struct is to be copied even if code logic absolutely does not need it....
I'm personally not getting any messages with ubsan + gcc + C++17 + Debug in this case. Everything is clean.
I'm getting them with ubsan + clang + C++17 + Debug.
/home/ssg/dvlp/cpp/upp/git/uppsrc/Core/Hash.cpp:308:33: runtime error: load of misaligned address 0x0000008c646e for type 'const unsigned int', which requires 4 byte alignment
0x0000008c646e: note: pointer points here
41 47 45 00 45 6d 70 74 79 20 64 72 69 76 65 00 44 72 69 76 65 20 76 61 63 c3 ad 6f 00 4c 65 65
^
/home/ssg/dvlp/cpp/upp/git/uppsrc/Core/Ops.h:7:63: runtime error: store to misaligned address 0x7f7ca993b222 for type 'Upp::dword' (aka 'unsigned int'), which requires 4 byte alignment
0x7f7ca993b222: note: pointer points here
65 65 46 72 65 65 46 72 65 65 46 72 65 65 46 72 65 65 46 72 65 65 46 72 65 65 46 72 65 65 46 72
^
/home/ssg/dvlp/cpp/upp/git/uppsrc/Core/Ops.h:3:59: runtime error: load of misaligned address 0x7f7ca993b222 for type 'const Upp::dword' (aka 'const unsigned int'), which requires 4 byte alignment
0x7f7ca993b222: note: pointer points here
35 00 46 72 fe 4c 6c 56 65 65 46 72 65 65 46 72 65 65 46 72 65 65 46 72 65 65 46 72 65 65 46 72
^
It doesn't look like NOUBSAN is defined for Clang.
I'm also getting a bunch of warnings with Clang + C++17.
In file included from /home/ssg/dvlp/cpp/upp/git/uppsrc/Core/Core.h:280:
/home/ssg/dvlp/cpp/upp/git/uppsrc/Core/Stream.h:94:141: warning: add explicit braces to avoid dangling else [-Wdangling-else]
void Put(const void *data, int size) { ASSERT(size >= 0); if(size) if(ptr + size <= wrlim) { memcpy(ptr, data, size);
ptr += size; } else _Put(data, size); }
One of the reasons why I'm using Clang on Linux is because it has the best support for sanitizers.
I attached my project and build methods for clang and gcc.
Regards,
Novo
|
|
|
|
Goto Forum:
Current Time: Sun Apr 28 04:44:52 CEST 2024
Total time taken to generate the page: 0.04336 seconds
|
|
|