blob: 235fc372435ec436c89a7b68bcc3cb4874ad4688 [file] [log] [blame]
Andrew Geissler82c905d2020-04-13 13:39:40 -05001require glibc.inc
2require glibc-version.inc
3
William A. Kennington IIIac69b482021-06-02 12:28:27 -07004CVE_CHECK_WHITELIST += "CVE-2020-10029 CVE-2021-27645"
5
6# glibc https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2019-1010022
7# glibc https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2019-1010023
8# glibc https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2019-1010024
9# Upstream glibc maintainers dispute there is any issue and have no plans to address it further.
10# "this is being treated as a non-security bug and no real threat."
11CVE_CHECK_WHITELIST += "CVE-2019-1010022 CVE-2019-1010023 CVE-2019-1010024"
12
13# glibc https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2019-1010025
14# Allows for ASLR bypass so can bypass some hardening, not an exploit in itself, may allow
15# easier access for another. "ASLR bypass itself is not a vulnerability."
16# Potential patch at https://sourceware.org/bugzilla/show_bug.cgi?id=22853
17CVE_CHECK_WHITELIST += "CVE-2019-1010025"
Andrew Geisslerb7d28612020-07-24 16:15:54 -050018
Andrew Geissler82c905d2020-04-13 13:39:40 -050019DEPENDS += "gperf-native bison-native make-native"
20
21NATIVESDKFIXES ?= ""
Patrick Williams213cb262021-08-07 19:21:33 -050022NATIVESDKFIXES:class-nativesdk = "\
Andrew Geissler82c905d2020-04-13 13:39:40 -050023 file://0003-nativesdk-glibc-Look-for-host-system-ld.so.cache-as-.patch \
24 file://0004-nativesdk-glibc-Fix-buffer-overrun-with-a-relocated-.patch \
25 file://0005-nativesdk-glibc-Raise-the-size-of-arrays-containing-.patch \
26 file://0006-nativesdk-glibc-Allow-64-bit-atomics-for-x86.patch \
27 file://0007-nativesdk-glibc-Make-relocatable-install-for-locales.patch \
Patrick Williams0ca19cc2021-08-16 14:03:13 -050028 file://0008-nativesdk-glibc-Fall-back-to-faccessat-on-faccess2-r.patch \
Andrew Geissler82c905d2020-04-13 13:39:40 -050029"
30
31SRC_URI = "${GLIBC_GIT_URI};branch=${SRCBRANCH};name=glibc \
32 file://etc/ld.so.conf \
33 file://generate-supported.mk \
34 file://makedbs.sh \
35 \
36 ${NATIVESDKFIXES} \
Patrick Williams0ca19cc2021-08-16 14:03:13 -050037 file://0015-sysdeps-gnu-configure.ac-handle-correctly-libc_cv_ro.patch \
38 file://0016-yes-within-the-path-sets-wrong-config-variables.patch \
Patrick Williams0ca19cc2021-08-16 14:03:13 -050039 file://0018-Remove-bash-dependency-for-nscd-init-script.patch \
40 file://0019-eglibc-Cross-building-and-testing-instructions.patch \
41 file://0020-eglibc-Help-bootstrap-cross-toolchain.patch \
42 file://0021-eglibc-Resolve-__fpscr_values-on-SH4.patch \
43 file://0022-eglibc-Forward-port-cross-locale-generation-support.patch \
44 file://0024-localedef-add-to-archive-uses-a-hard-coded-locale-pa.patch \
45 file://0025-elf-dl-deps.c-Make-_dl_build_local_scope-breadth-fir.patch \
46 file://0026-intl-Emit-no-lines-in-bison-generated-files.patch \
Andrew Geissler635e0e42020-08-21 15:58:33 -050047 file://0027-locale-prevent-maybe-uninitialized-errors-with-Os-BZ.patch \
48 file://0028-readlib-Add-OECORE_KNOWN_INTERPRETER_NAMES-to-known-.patch \
49 file://0029-wordsize.h-Unify-the-header-between-arm-and-aarch64.patch \
50 file://0030-powerpc-Do-not-ask-compiler-for-finding-arch.patch \
Andrew Geisslerd159c7f2021-09-02 21:05:58 -050051 file://0001-CVE-2021-38604.patch \
52 file://0002-CVE-2021-38604.patch \
53 file://0001-fix-create-thread-failed-in-unprivileged-process-BZ-.patch \
Andrew Geissler595f6302022-01-24 19:11:47 +000054 file://CVE-2021-43396.patch \
55 file://0001-Make-shell-interpreter-overridable-in-tzselect.ksh.patch \
56 file://0001-CVE-2022-23218.patch \
57 file://0002-CVE-2022-23218.patch \
58 file://0001-CVE-2022-23219.patch \
59 file://0002-CVE-2022-23219.patch \
Andrew Geissler82c905d2020-04-13 13:39:40 -050060 "
61S = "${WORKDIR}/git"
62B = "${WORKDIR}/build-${TARGET_SYS}"
63
64PACKAGES_DYNAMIC = ""
65
66# the -isystem in bitbake.conf screws up glibc do_stage
67BUILD_CPPFLAGS = "-I${STAGING_INCDIR_NATIVE}"
68TARGET_CPPFLAGS = "-I${STAGING_DIR_TARGET}${includedir}"
69
70GLIBC_BROKEN_LOCALES = ""
71
72GLIBCPIE ??= ""
73
74EXTRA_OECONF = "--enable-kernel=${OLDEST_KERNEL} \
75 --disable-profile \
76 --disable-debug --without-gd \
77 --enable-clocale=gnu \
78 --with-headers=${STAGING_INCDIR} \
79 --without-selinux \
80 --enable-tunables \
81 --enable-bind-now \
82 --enable-stack-protector=strong \
Andrew Geissler82c905d2020-04-13 13:39:40 -050083 --disable-crypt \
84 --with-default-link \
Andrew Geissler82c905d2020-04-13 13:39:40 -050085 ${@bb.utils.contains_any('SELECTED_OPTIMIZATION', '-O0 -Og', '--disable-werror', '', d)} \
86 ${GLIBCPIE} \
87 ${GLIBC_EXTRA_OECONF}"
88
89EXTRA_OECONF += "${@get_libc_fpu_setting(bb, d)}"
90
Andrew Geissler595f6302022-01-24 19:11:47 +000091EXTRA_OECONF:append:x86 = " ${@bb.utils.contains_any('TUNE_FEATURES', 'i586 c3', '--disable-cet', '--enable-cet', d)}"
Patrick Williams213cb262021-08-07 19:21:33 -050092EXTRA_OECONF:append:x86-64 = " --enable-cet"
Andrew Geisslerd1e89492021-02-12 15:35:20 -060093
Andrew Geissler5f350902021-07-23 13:09:54 -040094PACKAGECONFIG ??= "nscd memory-tagging"
Andrew Geisslerc3d88e42020-10-02 09:45:00 -050095PACKAGECONFIG[nscd] = "--enable-nscd,--disable-nscd"
Andrew Geissler09036742021-06-25 14:25:14 -050096PACKAGECONFIG[memory-tagging] = "--enable-memory-tagging,--disable-memory-tagging"
Andrew Geisslerc3d88e42020-10-02 09:45:00 -050097
Patrick Williams213cb262021-08-07 19:21:33 -050098do_patch:append() {
Andrew Geissler82c905d2020-04-13 13:39:40 -050099 bb.build.exec_func('do_fix_readlib_c', d)
100}
101
102do_fix_readlib_c () {
103 sed -i -e 's#OECORE_KNOWN_INTERPRETER_NAMES#${EGLIBC_KNOWN_INTERPRETER_NAMES}#' ${S}/elf/readlib.c
104}
105
106do_configure () {
107# override this function to avoid the autoconf/automake/aclocal/autoheader
108# calls for now
109# don't pass CPPFLAGS into configure, since it upsets the kernel-headers
110# version check and doesn't really help with anything
111 (cd ${S} && gnu-configize) || die "failure in running gnu-configize"
112 find ${S} -name "configure" | xargs touch
113 CPPFLAGS="" oe_runconf
114}
115
116LDFLAGS += "-fuse-ld=bfd"
117do_compile () {
118 base_do_compile
119 echo "Adjust ldd script"
120 if [ -n "${RTLDLIST}" ]
121 then
122 prevrtld=`cat ${B}/elf/ldd | grep "^RTLDLIST=" | sed 's#^RTLDLIST="\?\([^"]*\)"\?$#\1#'`
123 # remove duplicate entries
124 newrtld=`echo $(printf '%s\n' ${prevrtld} ${RTLDLIST} | LC_ALL=C sort -u)`
125 echo "ldd \"${prevrtld} ${RTLDLIST}\" -> \"${newrtld}\""
126 sed -i ${B}/elf/ldd -e "s#^RTLDLIST=.*\$#RTLDLIST=\"${newrtld}\"#"
127 fi
128}
129
130require glibc-package.inc
131
132BBCLASSEXTEND = "nativesdk"