Summary: | sys-libs/musl: Install sys-libs/fortify-headers for use with sys-devel/gcc | ||
---|---|---|---|
Product: | Gentoo Linux | Reporter: | Anthony Basile <blueness> |
Component: | Current packages | Assignee: | Anthony Basile <blueness> |
Status: | CONFIRMED --- | ||
Severity: | enhancement | CC: | immoloism, julien.voisin+gentoo, lu_zero, musl, sam, toolchain |
Priority: | Normal | Keywords: | PullRequest |
Version: | unspecified | ||
Hardware: | All | ||
OS: | Linux | ||
URL: | https://github.com/jvoisin/fortify-headers | ||
See Also: | https://github.com/gentoo/gentoo/pull/32473 | ||
Whiteboard: | |||
Package list: | Runtime testing required: | --- | |
Bug Depends on: | 924722, 921675 | ||
Bug Blocks: | 430702 | ||
Attachments: | Example gcc ebuild fix for fortify-headers |
Description
Anthony Basile
![]() Since it is standalone, why not package it seperately? (In reply to Felix Janda from comment #1) > Since it is standalone, why not package it seperately? I was thinking of it as a separate package on which the musl ebuild depends conditionally with USE=fortify. However, to make use of it, you need to add the correct -I line and I was thinking of maybe patching the spec files to include that in musl. I see, sounds sensible. Just for reference: http://git.alpinelinux.org/cgit/aports/tree/main/gcc/gcc-4.9-musl-fortify.patch?id=067a4f28825478911bb62be3b8da758d9722753e is used in alpine to make gcc first search for the fortify headers. However it depends on other gcc patches they use. (In reply to Felix Janda from comment #3) > I see, sounds sensible. > > Just for reference: > > http://git.alpinelinux.org/cgit/aports/tree/main/gcc/gcc-4.9-musl-fortify. > patch?id=067a4f28825478911bb62be3b8da758d9722753e > > is used in alpine to make gcc first search for the fortify headers. > However it depends on other gcc patches they use. Hmm .. don't like it. I'd rather go with spec files where we can just add another spec which can be selected using gcc-config. The alpine patch was just for reference. So we could have a fortify.specs à la %rename cc1 old_cc1 *cc1: -isystem /usr/include/fortify %(old_cc1) which would need to be added to GCC_SPECS, say to all variants except vanilla. sys-libs/fortify-headers is not on the gentoo tree. (In reply to Anthony Basile from comment #6) > sys-libs/fortify-headers is not on the gentoo tree. It is now :) (In reply to Felix Janda from comment #3) > I see, sounds sensible. > > Just for reference: > > http://git.alpinelinux.org/cgit/aports/tree/main/gcc/gcc-4.9-musl-fortify. > patch?id=067a4f28825478911bb62be3b8da758d9722753e > > is used in alpine to make gcc first search for the fortify headers. > However it depends on other gcc patches they use. Latest patch: https://git.alpinelinux.org/aports/tree/main/gcc/0020-add-fortify-headers-paths.patch. But yeah, I'd prefer spec if we can too I suppose. (In reply to Sam James from comment #7) > (In reply to Anthony Basile from comment #6) > > sys-libs/fortify-headers is not on the gentoo tree. > > It is now :) > I meant to say "sys-libs/fortify-headers is NOW on the gentoo tree." Sam I didn't look carefully, but do we need the sys-libs/fortify-headers package now? (In reply to Anthony Basile from comment #8) > (In reply to Sam James from comment #7) > > (In reply to Anthony Basile from comment #6) > > > sys-libs/fortify-headers is not on the gentoo tree. > > > > It is now :) > > > > I meant to say "sys-libs/fortify-headers is NOW on the gentoo tree." > Ah ok! > Sam I didn't look carefully, but do we need the sys-libs/fortify-headers > package now? I think we still need it now, musl doesn't want to implement these (https://wiki.musl-libc.org/future-ideas.html), so we just need to figure out how we want to force it in for now. Specs or a patch. I think a patch is easier for now while we test it out, then move to specs once we're happy? In #musl, dalias and some others mentioned issues with the current impl which need fixing. Created attachment 865334 [details] Example gcc ebuild fix for fortify-headers Here is a collection of my notes for testing using the Alpine fortify-headers patch. I've only tested this on ~arm64 system using the profile default/linux/arm64/17.0/musl/hardened. Once the workaround is applied then @system will rebuild without issue (minus the musl lfs64 shim issue with help2man) so I believe testing could be opened up once the current issue is solved. Current issues in Gentoo: When using the Alphine for some reason the header fix included in gcc-13-fix-cross-fixincludes.patch gets used during the compile rather than the system /usr/include/sys headers so this needs to be removed. I've included the workaround ebuild I used for the test system however a better solution is needed going forward. This does also happen with GCC-12. Test machine info: # emerge --info Portage 3.0.46 (python 3.11.4-final-0, default/linux/arm64/17.0/musl/hardened, gcc-13, musl-1.2.4, 6.1.11-gentoo-dist aarch64) ================================================================= System uname: Linux-6.1.11-gentoo-dist-aarch64-with-libc KiB Mem: 65771324 total, 62673048 free KiB Swap: 25169912 total, 25169912 free Timestamp of repository gentoo: Sun, 09 Jul 2023 18:30:01 +0000 Head commit of repository gentoo: 8381f882d280f7c7f8bc0e59b3345b37cec14ef9 sh bash 5.1_p16-r6 ld GNU ld (Gentoo 2.39 p6) 2.39.0 app-misc/pax-utils: 1.3.7::gentoo app-shells/bash: 5.1_p16-r6::gentoo dev-lang/perl: 5.38.0::gentoo dev-lang/python: 3.11.4::gentoo dev-util/meson: 1.1.1::gentoo sys-apps/baselayout: 2.14::gentoo sys-apps/openrc: 0.46::gentoo sys-apps/sandbox: 2.35::gentoo sys-devel/autoconf: 2.71-r6::gentoo sys-devel/automake: 1.16.5-r1::gentoo sys-devel/binutils: 2.39-r5::gentoo, 2.40-r5::gentoo sys-devel/binutils-config: 5.5::gentoo sys-devel/gcc: 12.2.1_p20230428-r1::gentoo, 13.1.1_p20230527::gentoo sys-devel/gcc-config: 2.11::gentoo sys-devel/libtool: 2.4.7-r1::gentoo sys-devel/make: 4.4.1-r1::gentoo sys-kernel/linux-headers: 6.4::gentoo (virtual/os-headers) sys-libs/musl: 1.2.4::gentoo Repositories: gentoo location: /var/db/repos/gentoo sync-type: rsync sync-uri: rsync://rsync.gentoo.org/gentoo-portage priority: -1000 volatile: False sync-rsync-verify-max-age: 24 sync-rsync-verify-jobs: 1 sync-rsync-verify-metamanifest: yes sync-rsync-extra-opts: ACCEPT_KEYWORDS="arm64 ~arm64" ACCEPT_LICENSE="@FREE" CBUILD="aarch64-gentoo-linux-musl" CFLAGS="-march=armv8-a+crc -mtune=cortex-a53 -O2 -pipe -flto" CHOST="aarch64-gentoo-linux-musl" CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt" CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/gconf /etc/gentoo-release /etc/sandbox.d /etc/terminfo" CXXFLAGS="-march=armv8-a+crc -mtune=cortex-a53 -O2 -pipe -flto" DISTDIR="/var/cache/distfiles" ENV_UNSET="CARGO_HOME DBUS_SESSION_BUS_ADDRESS DISPLAY GDK_PIXBUF_MODULE_FILE GOBIN GOPATH PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR XDG_STATE_HOME" FCFLAGS="-march=armv8-a+crc -mtune=cortex-a53 -O2 -pipe -flto" FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs binpkg-multi-instance buildpkg-live config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync network-sandbox news parallel-fetch pid-sandbox preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr" FFLAGS="-march=armv8-a+crc -mtune=cortex-a53 -O2 -pipe -flto" GENTOO_MIRRORS="http://distfiles.gentoo.org" INSTALL_MASK="charset.alias /usr/share/locale/locale.alias" LANG="C.UTF8" LDFLAGS="-Wl,-O1 -Wl,--as-needed" LEX="flex" PKGDIR="/var/cache/binpkgs" PORTAGE_CONFIGROOT="/" PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git" PORTAGE_TMPDIR="/var/tmp" SHELL="/bin/bash" USE="acl arm64 bzip2 cli crypt dri fortran hardened iconv ipv6 libtirpc lto ncurses nls nptl openmp pam pcre pgo pic pie readline seccomp split-usr ssl ssp test-rust unicode xattr xtpax zlib" ADA_TARGET="gnat_2021" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="karbon sheets words" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_ARM="edsp v8 vfp vfp-d32 vfpv3 vfpv4" ELIBC="musl" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock greis isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="libinput" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LUA_SINGLE_TARGET="lua5-1" LUA_TARGETS="lua5-1" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php8-1" POSTGRES_TARGETS="postgres12 postgres13" PYTHON_SINGLE_TARGET="python3_11" PYTHON_TARGETS="python3_11" RUBY_TARGETS="ruby31" VIDEO_CARDS="fbdev dummy v4l" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq proto steal rawnat logmark ipmark dhcpmac delude chaos account" Unset: ADDR2LINE, AR, ARFLAGS, AS, ASFLAGS, CC, CCLD, CONFIG_SHELL, CPP, CPPFLAGS, CTARGET, CXX, CXXFILT, ELFEDIT, EMERGE_DEFAULT_OPTS, EXTRA_ECONF, F77FLAGS, FC, GCOV, GPROF, LC_ALL, LD, LFLAGS, LIBTOOL, LINGUAS, MAKE, MAKEFLAGS, MAKEOPTS, NM, OBJCOPY, OBJDUMP, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, RANLIB, READELF, RUSTFLAGS, SIZE, STRINGS, STRIP, YACC, YFLAGS I'm revisiting this (as immolo's comment implies) w/ jvoisin's impl: https://github.com/jvoisin/fortify-headers. The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d44dbedc214710db24fdcc119f2d4f8339430c2d commit d44dbedc214710db24fdcc119f2d4f8339430c2d Author: Ian Jordan <immoloism@gmail.com> AuthorDate: 2023-10-23 22:18:42 +0000 Commit: Sam James <sam@gentoo.org> CommitDate: 2023-10-23 22:49:12 +0000 sys-libs/fortify-headers: update HOMEPAGE Bug: https://bugs.gentoo.org/546692 Signed-off-by: Ian Jordan <immoloism@gmail.com> Closes: https://github.com/gentoo/gentoo/pull/32473 Signed-off-by: Sam James <sam@gentoo.org> sys-libs/fortify-headers/fortify-headers-9999.ebuild | 14 ++++---------- sys-libs/fortify-headers/metadata.xml | 3 +++ 2 files changed, 7 insertions(+), 10 deletions(-) |