Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 892079 - sys-devel/gcc-12.2.1_p20230121-r1[sanitize] - .../sanitizer_common/sanitizer_linux.cpp: In function 'void __sanitizer::GetPcSpBp(void*, uptr*, uptr*, uptr*)': .../sanitizer_linux.cpp:2074:31: error: 'struct mcontext_t' has no member named 'regs' (on musl)
Summary: sys-devel/gcc-12.2.1_p20230121-r1[sanitize] - .../sanitizer_common/sanitizer_...
Status: CONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: PPC Linux
: Normal normal (vote)
Assignee: Gentoo Toolchain Maintainers
URL:
Whiteboard:
Keywords: PMASKED
Depends on:
Blocks: musl-porting
  Show dependency tree
 
Reported: 2023-01-26 11:45 UTC by ernsteiswuerfel
Modified: 2024-03-08 01:17 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
build.log.xz (gcc-12.2.1_p20230121-r1:20230125-201411.log.xz,170.31 KB, application/x-xz)
2023-01-26 11:45 UTC, ernsteiswuerfel
Details
emerge --info (file_892079.txt,6.89 KB, text/plain)
2023-01-26 11:47 UTC, ernsteiswuerfel
Details
build.log.xz (ppc64, 12.2.1_p20230121-r1) (gcc-12.2.1_p20230121-r1:20230127-103023.log.xz,127.50 KB, application/x-xz)
2023-01-27 14:41 UTC, ernsteiswuerfel
Details
build.log.xz (ppc64, 13.0.1_pre20230122) (gcc-13.0.1_pre20230122:20230127-174456.log.xz,129.10 KB, application/x-xz)
2023-01-27 23:14 UTC, ernsteiswuerfel
Details

Note You need to log in before you can comment on or make changes to this bug.
Description ernsteiswuerfel archtester 2023-01-26 11:45:36 UTC
Created attachment 849237 [details]
build.log.xz

Building gcc-12.2.1_p20230121-r1 with +sanitize errors out on several occasions:

$ grep error: gcc-12.2.1_p20230121-r1\:20230125-201411.log
/var/tmp/portage/sys-devel/gcc-12.2.1_p20230121-r1/work/gcc-12-20230121/libsanitizer/sanitizer_common/sanitizer_linux.cpp:2074:31: error: 'struct mcontext_t' has no member named 'regs'; did you mean 'gregs'?
/var/tmp/portage/sys-devel/gcc-12.2.1_p20230121-r1/work/gcc-12-20230121/libsanitizer/sanitizer_common/sanitizer_linux.cpp:2075:31: error: 'struct mcontext_t' has no member named 'regs'; did you mean 'gregs'?
/var/tmp/portage/sys-devel/gcc-12.2.1_p20230121-r1/work/gcc-12-20230121/libsanitizer/sanitizer_common/sanitizer_linux.cpp:2075:41: error: 'PT_R1' was not declared in this scope
/var/tmp/portage/sys-devel/gcc-12.2.1_p20230121-r1/work/gcc-12-20230121/libsanitizer/sanitizer_common/sanitizer_linux.cpp:2078:31: error: 'struct mcontext_t' has no member named 'regs'; did you mean 'gregs'?
/var/tmp/portage/sys-devel/gcc-12.2.1_p20230121-r1/work/gcc-12-20230121/libsanitizer/sanitizer_common/sanitizer_linux.cpp:2078:41: error: 'PT_R31' was not declared in this scope

Building without USE=sanitize works ok.
Comment 1 ernsteiswuerfel archtester 2023-01-26 11:47:09 UTC
Created attachment 849239 [details]
emerge --info
Comment 2 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-01-27 08:04:33 UTC
Didn't hit on amd64 so I'm guessing ppc specific given the issues we've had with context before?
Comment 3 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-01-27 08:12:32 UTC
Out of interest, is 13 okay?
Comment 4 ernsteiswuerfel archtester 2023-01-27 09:55:49 UTC
(In reply to Sam James from comment #2)
> Didn't hit on amd64 so I'm guessing ppc specific given the issues we've had
> with context before?
Didn't happen on my amd64 boxes either. Only on musl ppc so far but I have to check musl ppc64 yet.

Also did not try GCC 13 yet, but I could have a look on it the next few days. Will report back here.
Comment 5 ernsteiswuerfel archtester 2023-01-27 14:41:51 UTC
Created attachment 849289 [details]
build.log.xz (ppc64, 12.2.1_p20230121-r1)

Same on ppc64.
Comment 6 ernsteiswuerfel archtester 2023-01-27 23:14:56 UTC
Created attachment 849309 [details]
build.log.xz (ppc64, 13.0.1_pre20230122)

(In reply to Sam James from comment #3)
> Out of interest, is 13 okay?
Same issue with GCC 13 (ppc64) as it turns out.
Comment 7 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-01-29 09:26:46 UTC
[2023-01-28T00:55:20+0000] <@sam_> it should be the same sort of thing as with gnulib before
[2023-01-28T00:55:29+0000] <@sam_> something is assuming the layout of mcontext_t, need to ifdef 
[2023-01-28T01:03:46+0000] <+gyakovlev> that sounds familiar wrt regs, we had that patch somewhere, can't remember where.
[2023-01-28T01:04:32+0000] <+gyakovlev> aha grep/diffutils
[2023-01-28T01:20:53+0000] <+gyakovlev> some explanations are here btw, helpful
[2023-01-28T01:20:53+0000] <+gyakovlev> https://www.openwall.com/lists/musl/2018/02/22/1
[2023-01-28T01:24:53+0000] <+gyakovlev> sorry I would not be able to dig it, enotime.
[2023-01-28T01:24:53+0000] <+gyakovlev> but your assessment is spot on.
[2023-01-28T01:24:53+0000] <+gyakovlev> https://github.com/gcc-mirror/gcc/blob/master/libsanitizer/sanitizer_common/sanitizer_linux.cpp#L2175
[2023-01-28T01:24:53+0000] <+gyakovlev> something around here has to be ifdefed and replaced with musl/kernel compatible layout behind ifdef.
Comment 8 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-01-29 10:33:04 UTC
https://cgit.adelielinux.org/packages/tree/system/gcc/401-libsanitizer-linux.patch?id=0dd86764f0e6c25e6f6e6f38c72c35f4d34d6988 is likely relevant but can't try it yet (hitting an unrelated issue)
Comment 9 Larry the Git Cow gentoo-dev 2023-01-29 21:59:27 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=71fed2eb85ab1c869705fb7ce8ed0bc9248886b8

commit 71fed2eb85ab1c869705fb7ce8ed0bc9248886b8
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2023-01-29 21:58:41 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2023-01-29 21:58:41 +0000

    profiles/default/linux: mask sys-devel/gcc[sanitize] on musl ppc* profiles
    
    mcontext parts of libsanitizer need porting.
    
    Bug: https://bugs.gentoo.org/892079
    Signed-off-by: Sam James <sam@gentoo.org>

 profiles/default/linux/ppc/17.0/musl/package.use.mask     | 7 +++++++
 profiles/default/linux/ppc64/17.0/musl/package.use.mask   | 7 ++++++-
 profiles/default/linux/ppc64le/17.0/musl/package.use.mask | 7 +++++++
 3 files changed, 20 insertions(+), 1 deletion(-)
Comment 10 David Flogeras 2023-02-04 11:05:17 UTC
I think arm will need a second pass as well.  Failed with a whole bunch of these

/var/tmp/portage/sys-devel/gcc-12.2.1_p20230121-r1/work/gcc-12-20230121/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h:1442:64: error: static assertion failed
 1442 |   COMPILER_CHECK(sizeof(((__sanitizer_##CLASS *)NULL)->MEMBER) == \
      |                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
 1443 |                  sizeof(((CLASS *)NULL)->MEMBER));                \
      |                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/var/tmp/portage/sys-devel/gcc-12.2.1_p20230121-r1/work/gcc-12-20230121/libsanitizer/sanitizer_common/sanitizer_internal_defs.h:348:44: note: in definition of macro 'COMPILER_CHECK'
  348 | #define COMPILER_CHECK(pred) static_assert(pred, "")
      |                                            ^~~~
/var/tmp/portage/sys-devel/gcc-12.2.1_p20230121-r1/work/gcc-12-20230121/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cpp:1044:1: note: in expansion of macro 'CHECK_SIZE_AND_OFFSET'
 1044 | CHECK_SIZE_AND_OFFSET(dirent, d_ino);
      | ^~~~~~~~~~~~~~~~~~~~~
/var/tmp/portage/sys-devel/gcc-12.2.1_p20230121-r1/work/gcc-12-20230121/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h:1442:64: note: the comparison reduces to '(4 == 8)'
 1442 |   COMPILER_CHECK(sizeof(((__sanitizer_##CLASS *)NULL)->MEMBER) == \
      |                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
 1443 |                  sizeof(((CLASS *)NULL)->MEMBER));                \
      |                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/var/tmp/portage/sys-devel/gcc-12.2.1_p20230121-r1/work/gcc-12-20230121/libsanitizer/sanitizer_common/sanitizer_internal_defs.h:348:44: note: in definition of macro 'COMPILER_CHECK'
  348 | #define COMPILER_CHECK(pred) static_assert(pred, "")
      |                                            ^~~~
/var/tmp/portage/sys-devel/gcc-12.2.1_p20230121-r1/work/gcc-12-20230121/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cpp:1044:1: note: in expansion of macro 'CHECK_SIZE_AND_OFFSET'
 1044 | CHECK_SIZE_AND_OFFSET(dirent, d_ino);
      | ^~~~~~~~~~~~~~~~~~~~~
/var/tmp/portage/sys-devel/gcc-12.2.1_p20230121-r1/work/gcc-12-20230121/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h:1442:64: error: static assertion failed
 1442 |   COMPILER_CHECK(sizeof(((__sanitizer_##CLASS *)NULL)->MEMBER) == \
      |                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
 1443 |                  sizeof(((CLASS *)NULL)->MEMBER));                \
      |                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/var/tmp/portage/sys-devel/gcc-12.2.1_p20230121-r1/work/gcc-12-20230121/libsanitizer/sanitizer_common/sanitizer_internal_defs.h:348:44: note: in definition of macro 'COMPILER_CHECK'
  348 | #define COMPILER_CHECK(pred) static_assert(pred, "")
      |                                            ^~~~
/var/tmp/portage/sys-devel/gcc-12.2.1_p20230121-r1/work/gcc-12-20230121/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cpp:1050:1: note: in expansion of macro 'CHECK_SIZE_AND_OFFSET'
 1050 | CHECK_SIZE_AND_OFFSET(dirent, d_off);
      | ^~~~~~~~~~~~~~~~~~~~~
/var/tmp/portage/sys-devel/gcc-12.2.1_p20230121-r1/work/gcc-12-20230121/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h:1442:64: note: the comparison reduces to '(4 == 8)'
 1442 |   COMPILER_CHECK(sizeof(((__sanitizer_##CLASS *)NULL)->MEMBER) == \
      |                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
 1443 |                  sizeof(((CLASS *)NULL)->MEMBER));                \
      |                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/var/tmp/portage/sys-devel/gcc-12.2.1_p20230121-r1/work/gcc-12-20230121/libsanitizer/sanitizer_common/sanitizer_internal_defs.h:348:44: note: in definition of macro 'COMPILER_CHECK'
  348 | #define COMPILER_CHECK(pred) static_assert(pred, "")
      |                                            ^~~~
/var/tmp/portage/sys-devel/gcc-12.2.1_p20230121-r1/work/gcc-12-20230121/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cpp:1050:1: note: in expansion of macro 'CHECK_SIZE_AND_OFFSET'
 1050 | CHECK_SIZE_AND_OFFSET(dirent, d_off);
      | ^~~~~~~~~~~~~~~~~~~~~
Comment 11 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-02-04 11:16:30 UTC
(In reply to David Flogeras from comment #10)
> I think arm will need a second pass as well.  Failed with a whole bunch of
> these
> 
> /var/tmp/portage/sys-devel/gcc-12.2.1_p20230121-r1/work/gcc-12-20230121/
> libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h:1442:64:
> error: static assertion failed
>  1442 |   COMPILER_CHECK(sizeof(((__sanitizer_##CLASS *)NULL)->MEMBER) == \
>       |                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
>  1443 |                  sizeof(((CLASS *)NULL)->MEMBER));                \
>       |                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


This looks different. There's a very specific problem wrt powerpc because of mcontext being wrong.

Could you file a new bug for this please with the full build.log & emerge --info? I may need the full GCC log tarball it creates too.
Comment 12 Larry the Git Cow gentoo-dev 2023-02-08 21:41:03 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5a3ff0fc1159b74ad7be0f6be28d9ab53bbc76aa

commit 5a3ff0fc1159b74ad7be0f6be28d9ab53bbc76aa
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2023-02-08 21:40:20 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2023-02-08 21:40:20 +0000

    profiles/default/linux/arm/17.0/musl: mask sys-devel/gcc[sanitize]
    
    Bug: https://bugs.gentoo.org/892079
    Signed-off-by: Sam James <sam@gentoo.org>

 profiles/default/linux/arm/17.0/musl/package.use.mask | 9 +++++++++
 1 file changed, 9 insertions(+)
Comment 13 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-02-08 23:07:20 UTC
(the arm issue is now reported as bug 893654.)