blob: 762a2793ad3db66aea2babdfe867e0f8e0b9d38a [file] [log] [blame]
Patrick Williams92b42cb2022-09-03 06:53:57 -05001require glibc.inc
2require glibc-version.inc
3
Patrick Williams92b42cb2022-09-03 06:53:57 -05004# glibc https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2019-1010022
5# glibc https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2019-1010023
6# glibc https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2019-1010024
7# Upstream glibc maintainers dispute there is any issue and have no plans to address it further.
8# "this is being treated as a non-security bug and no real threat."
9CVE_CHECK_IGNORE += "CVE-2019-1010022 CVE-2019-1010023 CVE-2019-1010024"
10
11# glibc https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2019-1010025
12# Allows for ASLR bypass so can bypass some hardening, not an exploit in itself, may allow
13# easier access for another. "ASLR bypass itself is not a vulnerability."
14# Potential patch at https://sourceware.org/bugzilla/show_bug.cgi?id=22853
15CVE_CHECK_IGNORE += "CVE-2019-1010025"
16
Andrew Geissler6aa7eec2023-03-03 12:41:14 -060017# This is integrated into the 2.37 branch as of 07b9521fc6
18CVE_CHECK_IGNORE += "CVE-2023-25139"
Andrew Geissler87f5cff2022-09-30 13:13:31 -050019
Patrick Williams92b42cb2022-09-03 06:53:57 -050020DEPENDS += "gperf-native bison-native"
21
22NATIVESDKFIXES ?= ""
23NATIVESDKFIXES:class-nativesdk = "\
24 file://0003-nativesdk-glibc-Look-for-host-system-ld.so.cache-as-.patch \
25 file://0004-nativesdk-glibc-Fix-buffer-overrun-with-a-relocated-.patch \
26 file://0005-nativesdk-glibc-Raise-the-size-of-arrays-containing-.patch \
27 file://0006-nativesdk-glibc-Allow-64-bit-atomics-for-x86.patch \
28 file://0007-nativesdk-glibc-Make-relocatable-install-for-locales.patch \
29 file://0008-nativesdk-glibc-Fall-back-to-faccessat-on-faccess2-r.patch \
30"
31
32SRC_URI = "${GLIBC_GIT_URI};branch=${SRCBRANCH};name=glibc \
33 file://etc/ld.so.conf \
34 file://generate-supported.mk \
35 file://makedbs.sh \
36 \
37 ${NATIVESDKFIXES} \
38 file://0009-yes-within-the-path-sets-wrong-config-variables.patch \
39 file://0010-eglibc-Cross-building-and-testing-instructions.patch \
40 file://0011-eglibc-Help-bootstrap-cross-toolchain.patch \
41 file://0012-eglibc-Resolve-__fpscr_values-on-SH4.patch \
42 file://0013-eglibc-Forward-port-cross-locale-generation-support.patch \
43 file://0014-localedef-add-to-archive-uses-a-hard-coded-locale-pa.patch \
Patrick Williams864cc432023-02-09 14:54:44 -060044 file://0015-powerpc-Do-not-ask-compiler-for-finding-arch.patch \
45 file://0016-wordsize.h-Unify-the-header-between-arm-and-aarch64.patch \
46 file://0017-Replace-echo-with-printf-builtin-in-nscd-init-script.patch \
47 file://0018-sysdeps-gnu-configure.ac-Set-libc_cv_rootsbindir-onl.patch \
48 file://0019-timezone-Make-shell-interpreter-overridable-in-tzsel.patch \
49 file://0020-tzselect.ksh-Use-bin-sh-default-shell-interpreter.patch \
50 file://0021-fix-create-thread-failed-in-unprivileged-process-BZ-.patch \
51 file://0022-Avoid-hardcoded-build-time-paths-in-the-output-binar.patch \
Patrick Williams92b42cb2022-09-03 06:53:57 -050052"
53S = "${WORKDIR}/git"
54B = "${WORKDIR}/build-${TARGET_SYS}"
55
56PACKAGES_DYNAMIC = ""
57
58# the -isystem in bitbake.conf screws up glibc do_stage
59BUILD_CPPFLAGS = "-I${STAGING_INCDIR_NATIVE}"
60TARGET_CPPFLAGS = "-I${STAGING_DIR_TARGET}${includedir}"
61
62GLIBC_BROKEN_LOCALES = ""
63
64GLIBCPIE ??= ""
65
66EXTRA_OECONF = "--enable-kernel=${OLDEST_KERNEL} \
67 --disable-profile \
68 --disable-debug --without-gd \
69 --enable-clocale=gnu \
70 --with-headers=${STAGING_INCDIR} \
71 --without-selinux \
72 --enable-tunables \
73 --enable-bind-now \
74 --enable-stack-protector=strong \
75 --disable-crypt \
76 --with-default-link \
77 ${@bb.utils.contains_any('SELECTED_OPTIMIZATION', '-O0 -Og', '--disable-werror', '', d)} \
78 ${GLIBCPIE} \
79 ${GLIBC_EXTRA_OECONF}"
80
81EXTRA_OECONF += "${@get_libc_fpu_setting(bb, d)}"
82
83EXTRA_OECONF:append:x86 = " ${@bb.utils.contains_any('TUNE_FEATURES', 'i586 c3', '--disable-cet', '--enable-cet', d)}"
84EXTRA_OECONF:append:x86-64 = " --enable-cet"
85
86PACKAGECONFIG ??= "nscd memory-tagging"
87PACKAGECONFIG[nscd] = "--enable-nscd,--disable-nscd"
88PACKAGECONFIG[memory-tagging] = "--enable-memory-tagging,--disable-memory-tagging"
89
90do_patch:append() {
91 bb.build.exec_func('do_fix_readlib_c', d)
92}
93
94do_fix_readlib_c () {
95 sed -i -e 's#OECORE_KNOWN_INTERPRETER_NAMES#${EGLIBC_KNOWN_INTERPRETER_NAMES}#' ${S}/elf/readlib.c
96}
97
98do_configure () {
99# override this function to avoid the autoconf/automake/aclocal/autoheader
100# calls for now
101# don't pass CPPFLAGS into configure, since it upsets the kernel-headers
102# version check and doesn't really help with anything
103 (cd ${S} && gnu-configize) || die "failure in running gnu-configize"
104 find ${S} -name "configure" | xargs touch
105 CPPFLAGS="" oe_runconf
106}
107
108LDFLAGS += "-fuse-ld=bfd"
109do_compile () {
110 base_do_compile
111 echo "Adjust ldd script"
112 if [ -n "${RTLDLIST}" ]
113 then
114 prevrtld=`cat ${B}/elf/ldd | grep "^RTLDLIST=" | sed 's#^RTLDLIST="\?\([^"]*\)"\?$#\1#'`
115 # remove duplicate entries
116 newrtld=`echo $(printf '%s\n' ${prevrtld} ${RTLDLIST} | LC_ALL=C sort -u)`
117 echo "ldd \"${prevrtld} ${RTLDLIST}\" -> \"${newrtld}\""
118 sed -i ${B}/elf/ldd -e "s#^RTLDLIST=.*\$#RTLDLIST=\"${newrtld}\"#"
119 fi
120}
121
122require glibc-package.inc
123
124BBCLASSEXTEND = "nativesdk"