Message ID | 20211006200732.1857173-1-hjl.tools@gmail.com |
---|---|
Headers | show |
Series | libsanitizer: Merge with upstream commit fdf4c035225d | expand |
On Wed, 6 Oct 2021, H.J. Lu via Gcc-patches wrote:
> I am checking in these patches to merge with upstream commit:
Thus breaking bootstrap on FreeBSD:
GCC-HEAD/libsanitizer/sanitizer_common/sanitizer_platform_limits_freebsd.cpp:370:36: error: 'MD5_CTX' was not declared in this scope
370 | const unsigned MD5_CTX_sz = sizeof(MD5_CTX);
| ^~~~~~~
GCC-HEAD/libsanitizer/sanitizer_common/sanitizer_platform_limits_freebsd.cpp:371:36: error:
'MD5_DIGEST_STRING_LENGTH' was not declared in this scope; did you mean
'SHA256_DIGEST_STRING_LENGTH'?
371 | const unsigned MD5_return_length = MD5_DIGEST_STRING_LENGTH;
| ^~~~~~~~~~~~~~~~~~~~~~~~
| SHA256_DIGEST_STRING_LENGTH
I stared the the sources for minutes and FreeBSD include files and could
not find what was wrong.
Then I realized: GCC has its own include/md5 which misses some of these!
Looking how old md5 is (and deprecated) I cannot help wonder whether you
merged something that wasn't new, but intentionally left out originally?
Or include paths are broken.
Gerald
PS: At this point I am counting about *seven* distinct bootstrap
breakages on my nightly testers in the last six weeks or so. :-(
On Thu, Oct 7, 2021 at 2:41 PM Gerald Pfeifer <gerald@pfeifer.com> wrote: > > On Wed, 6 Oct 2021, H.J. Lu via Gcc-patches wrote: > > I am checking in these patches to merge with upstream commit: > > Thus breaking bootstrap on FreeBSD: > > GCC-HEAD/libsanitizer/sanitizer_common/sanitizer_platform_limits_freebsd.cpp:370:36: error: 'MD5_CTX' was not declared in this scope > 370 | const unsigned MD5_CTX_sz = sizeof(MD5_CTX); > | ^~~~~~~ > GCC-HEAD/libsanitizer/sanitizer_common/sanitizer_platform_limits_freebsd.cpp:371:36: error: > 'MD5_DIGEST_STRING_LENGTH' was not declared in this scope; did you mean > 'SHA256_DIGEST_STRING_LENGTH'? > 371 | const unsigned MD5_return_length = MD5_DIGEST_STRING_LENGTH; > | ^~~~~~~~~~~~~~~~~~~~~~~~ > | SHA256_DIGEST_STRING_LENGTH > > I stared the the sources for minutes and FreeBSD include files and could > not find what was wrong. compiler-rt sync brought in commit 18a7ebda99044473fdbce6376993714ff54e6690 Author: David Carlier <devnexen@gmail.com> Date: Wed Oct 6 06:01:50 2021 +0100 [Sanitizers] intercept md5 and sha* apis on FreeBSD. Reviewed By: vitalybuka Differential Revision: https://reviews.llvm.org/D110989 diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_freebsd.cpp b/libsanitizer/sanitizer_common/sanitizer_platform_limits_freebsd.cpp index bfe3eea464d..64535805e40 100644 --- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_freebsd.cpp +++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_freebsd.cpp @@ -69,6 +69,11 @@ #include <semaphore.h> #include <signal.h> #include <stddef.h> +#include <md5.h> +#include <sha224.h> +#include <sha256.h> +#include <sha384.h> +#include <sha512.h> #include <stdio.h> #include <stringlist.h> #include <term.h> @@ -361,6 +366,22 @@ const int si_SEGV_MAPERR = SEGV_MAPERR; const int si_SEGV_ACCERR = SEGV_ACCERR; const int unvis_valid = UNVIS_VALID; const int unvis_validpush = UNVIS_VALIDPUSH; + +const unsigned MD5_CTX_sz = sizeof(MD5_CTX); +const unsigned MD5_return_length = MD5_DIGEST_STRING_LENGTH; + +#define SHA2_CONST(LEN) \ + const unsigned SHA##LEN##_CTX_sz = sizeof(SHA##LEN##_CTX); \ + const unsigned SHA##LEN##_return_length = SHA##LEN##_DIGEST_STRING_LENGTH; \ + const unsigned SHA##LEN##_block_length = SHA##LEN##_BLOCK_LENGTH; \ + const unsigned SHA##LEN##_digest_length = SHA##LEN##_DIGEST_LENGTH + +SHA2_CONST(224); +SHA2_CONST(256); +SHA2_CONST(384); +SHA2_CONST(512); + +#undef SHA2_CONST } // namespace __sanitizer Does compiler-rt compile on FreeBSD? If not, please file a compiler-rt bug. If yes, why doesn't it work in GCC? > Then I realized: GCC has its own include/md5 which misses some of these! > > > Looking how old md5 is (and deprecated) I cannot help wonder whether you > merged something that wasn't new, but intentionally left out originally? > > Or include paths are broken. > > > Gerald > > > PS: At this point I am counting about *seven* distinct bootstrap > breakages on my nightly testers in the last six weeks or so. :-(
On Thu, 7 Oct 2021, H.J. Lu wrote: >> Thus breaking bootstrap on FreeBSD: >> >> GCC-HEAD/libsanitizer/sanitizer_common/sanitizer_platform_limits_freebsd.cpp:370:36: error: 'MD5_CTX' was not declared in this scope > 370 | const unsigned MD5_CTX_sz = sizeof(MD5_CTX); >> | ^~~~~~~ >> GCC-HEAD/libsanitizer/sanitizer_common/sanitizer_platform_limits_freebsd.cpp:371:36: error: >> 'MD5_DIGEST_STRING_LENGTH' was not declared in this scope > compiler-rt sync brought in > > commit 18a7ebda99044473fdbce6376993714ff54e6690 > Author: David Carlier <devnexen@gmail.com> > Date: Wed Oct 6 06:01:50 2021 +0100 > > [Sanitizers] intercept md5 and sha* apis on FreeBSD. > > Reviewed By: vitalybuka > > Differential Revision: https://reviews.llvm.org/D110989 > > diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_freebsd.cpp > b/libsanitizer/sanitizer_common/sanitizer_platform_limits_freebsd.cpp > index bfe3eea464d..64535805e40 100644 > --- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_freebsd.cpp > +++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_freebsd.cpp > @@ -69,6 +69,11 @@ > #include <semaphore.h> > #include <signal.h> > #include <stddef.h> > +#include <md5.h> Yep, and here is the problem: In the case of Clang this uses FreeBSD's <md5.h>. In the case of GCC apparently this uses our own, bare-bone md5.h - include/md5.h. Boom. Regression. Bootstrap failure on every platfor and version of FreeBSD. (FreeBSD 11.x is also broken by this patch, in a different way, alas went end of life a week ago.) I now filed https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102675 and sadly don't have an idea how to tackle this. Gerald