Commit Graph

238 Commits

Author SHA1 Message Date
Jason Wessel
96b1062476 glibc / glibc-locale: Fix stash_locale determinism problems
When using sstate, or performing an incremental build any change to
the do_stash_locale() will cause a build failure because
do_stash_locale() was destroying the results obtained from the
do_install() with several mv operations.  A recent change to
do_stash_locale() for a different problem illustrated a number of
build failures for users in the community.

To fix the problem, do_stash_locale() must use copy operations instead
of the mv operations.  Because this is changed to a copy, the sysroot
and package stage need to remove the files that would have been
previously removed.  The correct "fixup" code to deal with the removal
already existed in the previous do_poststash_install_cleanup().  All
that needed change was the path to where to remove the files
from the sysroot and package stages.

In order to force a re-compilation of glibc some unused white space
was removed from do_compile() for glibc.  I could not find any other
way around this and we don't want to have all the community folks to
have another iteration where they have to remove their tmp directories
or purge some portion of the sstate.  It also makes this change
bisectable. If the change to the glibc is not included, it will fail
with the following message:

=====
| DEBUG: Executing shell function do_prep_locale_tree
| tar: i18n: Cannot stat: No such file or directory
| tar: Exiting with failure status due to previous errors
| gzip: /poky/build/tmp/work/core2-64-poky-linux/glibc-locale/2.29-r0/locale-tree//usr/share/i18n/charmaps/*gz.gz: No such file or directory
=====

After this one time change I tested changing only the
do_stash_locale() function and it now works well because it is
deterministically operating off the sstate data or a local build.

(From OE-Core rev: fedc57a41a15bca1d96d14e25e2df0bb1eca904d)

Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-07-10 09:56:22 +01:00
Jason Wessel
ff9739af25 glibc/glibc-locale: Fix do_stash_locale to work with usrmerge and multilibs
The do_stash_locale was not working consistently across the 4 build
configurations and the multilib, usrmerge configuration would fail
entirely with the obscure message:

| DEBUG: Executing shell function do_prep_locale_tree
| tar: i18n: Cannot stat: No such file or directory
| tar: Exiting with failure status due to previous errors
| gzip: /poky/build/tmp/work/core2-64-poky-linux/glibc-locale/2.29-r0/locale-tree//usr/share/i18n/charmaps/*gz.gz: No such file or directory
| WARNING: /poky/build/tmp/work/core2-64-poky-linux/glibc-locale/2.29-r0/temp/run.do_prep_locale_tree.124690:1 exit 1 from 'gunzip $i'

Here is the 4 build configurations without the patch applied:

A) x86-64 no multilibs, no usrmerge
find ./tmp/work/*/glibc/2.29-r0/stashed-locale -type f |grep -v nscd.service |wc -l
909
B) x86-64 no multilibs, usrmerge
find ./tmp/work/*/glibc/2.29-r0/stashed-locale -type f |grep -v nscd.service |wc -l
909
C) x86-64 multilibs, no usrmerge
find ./tmp/work/*/glibc/2.29-r0/stashed-locale -type f |grep -v nscd.service |wc -l
885
D) x86-64 multilibs, usrmerge
find ./tmp/work/*/glibc/2.29-r0/stashed-locale -type f |grep -v nscd.service |wc -l
864

The issue here is that all the moves should be processed first, then a
copy should be made of the lib directories, but only in the case they
are different when using the usrmerge feature.  Even though the build
worked for the multilib configuration without usrmerge, the content
was not the same.

After applying the patch the same number of files are in all the
configurations.  The list of files was also diffed, after normalizing
the directory names to ensure all the correct files were copied.

Ultimately there are probably additional files that should be pruned
from what is copied to the stated_locale, but the purpose of this
patch is make it 100% consistent between the build types and fix the
builds.

(From OE-Core rev: 33c2e7b4944af22ca47b53d1f85d03426f169bb7)

Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-07-03 17:00:57 +01:00
Jason Wessel
92ffcf9985 glibc-locale: Fix build error with PACKAGE_NO_GCONV = "1"
When the PACKAGE_NO_GCONV is set to 1 an empty directory is left behind from the do_install rule:

=====
ERROR: glibc-locale-2.29-r0 do_package: QA Issue: glibc-locale: Files/directories were installed but not shipped in any package:
  /usr/lib
  /usr/lib/locale
Please set FILES such that these items are packaged. Alternatively if they are unneeded, avoid installing them or delete them within do_install.
glibc-locale: 2 installed and not shipped files. [installed-vs-shipped]
ERROR: glibc-locale-2.29-r0 do_package: Fatal QA errors found, failing task.
=====

The simple fix is to prune the empty directory.

(From OE-Core rev: 4b3c5ec80e696fc2c7ce7ceba118095f9b8f6439)

Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-07-03 17:00:57 +01:00
Jason Wessel
d8d7402906 glibc: Fix multilibs + usrmerge builds
The build of glibc fails when you have multilibs enabled + the distro
feature usrmerge.  Here is an example configuration:

===
MACHINE = "qemux86-64"
VIRTUAL-RUNTIME_init_manager = "systemd"
DISTRO_FEATURES_append = " systemd "
DISTRO_FEATURES_append += " usrmerge"

require conf/multilib.conf
MULTILIBS = "multilib:lib32"
DEFAULTTUNE_virtclass-multilib-lib32 = "x86"
===

This will fail with the following error:

NOTE: Executing SetScene Tasks
NOTE: Executing RunQueue Tasks
ERROR: glibc-2.28-r0 do_poststash_install_cleanup: Function failed: do_poststash_install_cleanup (log file is located at /poky/build/tmp/work/core2-64-poky-linux/glibc/2.28-r0/temp/log.do_poststash_install_cleanup.107893)
ERROR: Logfile of failure stored in: /poky/build/tmp/work/core2-64-poky-linux/glibc/2.28-r0/temp/log.do_poststash_install_cleanup.107893

The fix is to not perform the rmdir check when using the multilib + usr/merge, namely:

if [ "${libdir}" != "${exec_prefix}/lib" ] && [ "${root_prefix}/lib" != "${exec_prefix}/lib" ]; then

This will evaluate as follows (collecting the output from bitbake -e glibc)

* no multilibs no usrmerge
        if [ "/usr/lib" != "/usr/lib" ] && [ "/lib" != "/usr/lib" ]; then
* no multilibs yes usrmerge
        if [ "/usr/lib" != "/usr/lib" ] && [ "/usr/lib" != "/usr/lib" ]; then
* yes multilibs no usrmerge
        if [ "/usr/lib64" != "/usr/lib" ] && [ "/lib" != "/usr/lib" ]; then
* yes multilibs yes user merge
        if [ "/usr/lib64" != "/usr/lib" ] && [ "/usr/lib" != "/usr/lib" ]; then

(From OE-Core rev: c5640f8c8663c8f81125bf7c5bc2ef8e9fe55315)

Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-06-30 22:40:52 +01:00
Joshua Watt
908e847b46 glibc-locale: DEPEND on virtual/libc
The restriction against glibc-locale depending on virtual/libc is
removed now that libc-initial no longer exists.

Adding the DEPENDS on virtual/libc fixes a race (and reproducibility
issue) where the packages created by this recipe would have different
runtime dependencies depending on if libc had generated its packages yet
or not.

(From OE-Core rev: 75539cb23073596a9f13446dd6f3921755d7fb53)

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-05-31 22:13:31 +01:00
Martin Jansa
018be19fbf glibc: always use bfd linker
* Work around broken ld-2.29.so when gold is used
  causing qemu-arm to segfault during e.g. gobject-introspection
  or postinst at do_rootfs time, more details in:
  http://lists.openembedded.org/pipermail/openembedded-devel/2019-March/198937.html
  https://sourceware.org/bugzilla/show_bug.cgi?id=24148
  https://sourceware.org/bugzilla/show_bug.cgi?id=10937
  https://sourceware.org/bugzilla/show_bug.cgi?id=18103

(From OE-Core rev: ac64c3b96bdff0b61bb5247fcd2d7ef4be881c09)

Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-04-26 10:09:08 +01:00
Ross Burton
e7f81f1959 glibc: fix CVE-2019-9169
(From OE-Core rev: 966213b3c99d428f2afba3ad3d88189669005eb6)

Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-03-24 17:00:52 +00:00
Changqing Li
bc853f8756 glibc: fix do_populate_sdk fail when multilib used
fix below error:

file /usr/include/bits/procfs-id.h conflicts between attempted installs of lib32-libc6-dev-2.29-r0.armv7vet2hf_vfp and libc6-dev-2.29-r0.aarch64
file /usr/include/bits/procfs.h conflicts between attempted installs of lib32-libc6-dev-2.29-r0.armv7vet2hf_vfp and libc6-dev-2.29-r0.aarch64
file /usr/include/bits/shmlba.h conflicts between attempted installs of lib32-libc6-dev-2.29-r0.armv7vet2hf_vfp and libc6-dev-2.29-r0.aarch64

(From OE-Core rev: 1e9120096da81171e9213b0b78df0aff7002de15)

Signed-off-by: Changqing Li <changqing.li@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-03-18 11:12:26 +00:00
Khem Raj
a02a05c59c glibc: Drop upstream rejected patches
These patches were applied, hoping that they will eventually be accepted
upstream but they have been rejected, I think its best that they are
dropped so we can avoid novel unintended behaviours that no other
distros will be seeing

(From OE-Core rev: 54550aa42378ce4b215bccbfd95e5e650b0d2efa)

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-03-06 10:39:25 +00:00
Khem Raj
3dd005248f glibc: Disable Werror when building with debug options
Since compiler does not optimize away a lot of stuff we end up with
Werrors e.g.

./sysdeps/ieee754/flt-32/s_log1pf.c: In function '__log1pf':
../sysdeps/ieee754/flt-32/s_log1pf.c:114:22: error: 'c' may be used uninitialized in this function [-Werror=maybe-uninitialized]
  114 |        + (k * ln2_lo + c))) - f);
      |          ~~~~~~~~~~~~^~~~

which otherwise wont happen, so lets build with warnings-as-errors
disabled in debug mode

given we disable werror, now we don't have to restrict user to compile
without -O0

(From OE-Core rev: 9772eaafc1cb5957661d43e8f76c6f9b07b854dc)

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-03-02 16:49:07 +00:00
Khem Raj
53b3e8c9d6 glibc: Move common bits to glibc-common.inc
We have been duplicating few variables in glibc recipes which could
actually be defined once, therefore move them to glibc-common.inc which is
included by all glibc family of recipes

(From OE-Core rev: 41093cb6c6d5edccebf41e62ed537779b1ee47bf)

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-02-28 17:47:10 +00:00
Khem Raj
9d973d3b4e default-distrovars: Drop DISTRO_FEATURES_LIBC
After eglibc was merged into glibc, Kconfig support was also dropped so
these libc features therefore are not effective anymore and can be
removed

(From OE-Core rev: c62b1cc06613a4cdddf53290e6203559f43fc62d)

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-02-28 13:21:54 +00:00
Mike Crowe
dda95279a7 glibc: Install AArch64 loader link correctly for usrmerge+multilib
The AArch64 little-endian ABI requires that the dynamic loader is always
available at /lib/ld-linux-aarch64.so.1. Similarly, the big-endian ABI
requires that the dynamic loader is always available at
/lib/ld-linux-aarch64_be.so.1.

glibc-package.inc contains code that tries to ensure this, but
unfortunately it is defeated by the combination of multilib and usrmerge
because it does not take into account that /lib is the same as /usr/lib
with usrmerge when it adds the loader path to libc_baselibs and when it
attempts to show that /usr/lib is empty in do_poststash_install_cleanup.
This results in the symlink not being included in the package and a build
failure due to rmdir failing.

Richard Purdie also suggested[1] that ${nonarch_base_libdir} should not be
used as a synonym for /lib in this case.

This hopefully-fixed version always sets ARCH_DYNAMIC_LOADER and then uses
${root_prefix}/lib/${ARCH_DYNAMIC_LOADER} to refer to the dynamic loader
which works with both multilib and usrmerge. Since ARCH_DYNAMIC_LOADER is
only non-empty if the symlink is required, the code to create it can move
to do_install_append. Then do_poststash_install_cleanup needs to be taught
that ${exec_prefix}/lib may not be empty if the dynamic loader symlink is
there.

It appears not to be possible to specify the name of the loader via a
variable with an override, since the _aarch64 override is applied even for
_aarch64-be, so I've set the loader name using ${TARGET_ARCH} instead.

Build-tested and inspected core-image-minimal rootfs with:

* AArch64 no multilib (real loader in correct place)
  MACHINE = "qemuarm64"

* AArch64 multilib (symlink in correct place)
  MACHINE = "qemuarm64"
  MULTILIBS = "multilib:lib32"
  DEFAULTTUNE_virtclass-multilib-lib32 = "armv7at-neon"
  require conf/multilib.conf

* AArch64 usrmerge (real loader in correct place)
  DISTRO_FEATURES += "usrmerge"
  MACHINE = "qemuarm64"

* AArch64 multilib usrmerge (symlink in correct place)
  DISTRO_FEATURES += "usrmerge"
  MACHINE = "qemuarm64"
  MULTILIBS = "multilib:lib32"
  DEFAULTTUNE_virtclass-multilib-lib32 = "armv7at-neon"
  require conf/multilib.conf

* big-endian versions of all of the above by also setting
  DEFAULTTUNE = "aarch64_be".
  (building glibc only.)

* x86_64 (real loader in /lib as before)[2]
  MACHINE = "qemux86"

* x86_64 multilib (real loader in /lib64 as before)
  MACHINE="qemux86-64"
  MULTILIBS = "multilib:lib32"
  DEFAULTTUNE_virtclass-multilib-lib32 = "x86"
  require conf/multilib.conf

I also tested leaving an unwanted file in ${exec_prefix}/lib for
do_poststash_install_cleanup to detect, and I believe the detection always
worked correctly.

[1] http://lists.openembedded.org/pipermail/openembedded-core/2018-November/276120.html

(From OE-Core rev: a705c0782c863ee960d65b5109168a4587a0a7b7)

Signed-off-by: Mike Crowe <mac@mcrowe.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-02-26 23:04:31 +00:00
Alistair Francis
ce9a6606d7 glibc: Remove ChangeLog diff from patch
To avoid conflicts with other forks of glibc remove the diff from the
ChangeLog.

(From OE-Core rev: 695d79af1edcc76a01055b01922f0d106c8291ca)

Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-02-26 23:04:31 +00:00
Zhixiong Chi
438600e929 glibc: CVE-2019-7309
Backport the CVE patch from the upstream
commit 3f635fb43389b54f682fc9ed2acc0b2aaf4a923d

(From OE-Core rev: 518be39ac82593c539144ac83acc459a45b7a81d)

Signed-off-by: Zhixiong Chi <zhixiong.chi@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-02-20 11:30:35 +00:00
Khem Raj
84b1f0dcf7 glibc-locale: Rewrite do_install using install utility instead of cp
This has been a constant source of trouble for build failures due to host-user-contaminated QA
errors of sort

ERROR: QA Issue: glibc-locale: /glibc-binary-localedata-ca-es+valencia/usr/lib/locale/ca_ES@valencia/LC_MONETARY is owned by uid 3004, which is the same as the user running bitbake. This may be due to host contamination [host-user-contaminated]

So far we have tried to mould cp command into not carrying the build
user permissions into install area but it is never entirely fixed since
the issue keeps popping up in various scenes

This patch replaces use of cp with install utility and specifies install
mode for files explcitly

(From OE-Core rev: 92fdb64ac9689b9cac8a1229b1928b50338969be)

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-02-08 23:15:32 +00:00
Khem Raj
3c6764b098 glibc: Fix pthread_rwlock_try*lock stalls
Brings in a backport as described in
https://sourceware.org/git/?p=glibc.git;a=commit;h=86013ef5cea322b8f4b9c22f230c22cce369e947

(From OE-Core rev: bcd5229c8045c3e0add0fc4f57ce9bfb5fc86328)

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-02-05 13:53:48 +00:00
Khem Raj
ba7731646e glibc: Update to 2.29 release
(From OE-Core rev: 9d9e055192bf1c66f2131482e6239e9c844ad0f4)

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-02-02 11:05:59 +00:00
Jonas Bonn
635fbf88e2 glibc: systemd and sysvinit are not mutually exclusive
(From OE-Core rev: 0990d77d99a9ba81e21961f9633df10ccef4b1a4)

Signed-off-by: Jonas Bonn <jonas@norrbonn.se>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-01-31 23:23:26 +00:00
Khem Raj
d5edd81f89 musl,glibc,newlib: Drop redundant STAGINGCC
We do not have initial phase of bootstrapping toolchains anymore

(From OE-Core rev: 75a2c15bbabf4df14631c822b20ce6d31098a5c8)

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-01-21 23:44:22 +00:00
Khem Raj
ad4bdc680a glibc: Enable --with-default-link
This lets linker to use its internal linker script for shared objects
Fixes with when gold is default linker

(From OE-Core rev: 7bbc453ac2b8d63680855789948a145fc448017f)

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-12-26 11:19:54 +00:00
Richard Purdie
1867965acd recipes: Drop virtual/libc-for-gcc
We no longer have special "libc" for gcc so we can rely on plain
virtual/libc and reduce the complexity in the dependencies.

(From OE-Core rev: 122217b421f749b5fef52bea44ad6e04bc8f8d3a)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-12-26 11:19:54 +00:00
Richard Purdie
0afd3ac3ad gcc: Drop gcc-cross-initial and use gcc-cross instead
We need a libgcc to build glibc. Tranditionally we therefore build
a non-threaded and non-shared compiler (gcc-cross-initial), then use
that to build libgcc-initial which is used to build glibc which we can
then build gcc-cross and libgcc against.

Firstly, we can drop the glibc dependency from gcc-cross, *if* we make
two changes:

a) specify the minimum glibc version to support in a configure option
b) create a dummy limits.h file so that later when glibc creates one,
   the headers structure has support for it. We can do this with a simple
   empty file

Once gcc-cross is libc independent, we can use it to build both
libgcc-initial and then later libgcc.

libgcc-initial is tricky as we need to imitate the non-threaded and
non-shared case. We can do that by hacking the threading mode back to
"single" even if gcc reports "posix" and disable libc presence for the
libgcc-intial build. We have to create the dummy limits.h to avoid
compiler errors from a missing header.

glibc will fail to link with libgcc-initial due to a missing "exception
handler" capable libgcc (libgcc_eh.a). Since we know glibc doesn't need
any exception handler, we can safely symlink to libgcc.a.

With those changes, gcc-cross can be used in all places and we only need
one build of gcc for each architecture.

For some reason ifunc was being disabled on mips prior to these changes
but afterwards became enabled but caused assertion failures. This is
therefore disabled until we can debug that.

(From OE-Core rev: 62b7308b8c4d2b439a15a4f7cbc6f823077bb0be)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-12-26 11:19:54 +00:00
Richard Purdie
ded63d6833 glibc: Remove site_config and glibc-initial
The only reason we appear to need glibc-initial at this time is to support
the site_config code. The site_config code compiles and therefore needs
at least some level of working C library to link against.

This isn't a good reason to keep the complexity of glibc-initial around
so remove it, and the site_config support which then breaks.

Performance benchmarks suggest the time spent just rerunning configure
for site_config just about equals any performance benefit for OE-Core
image builds excluding the time spent adding glibc-initial to the
dependency chain.

I'm not opposed to readding some other form of site_config support
but it needs to be rethought.

(From OE-Core rev: c5df105e7583e43da9b682f739bebaf873dcd2f4)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-12-26 11:19:54 +00:00
Hongxu Jia
ede2e5b4b3 glibc: improve reproducibility with multilib
Multilib builds specify several loaders which will end up embedded in
some binaries or script files. To support reproducible builds, we must
ensure the loaders are always in deterministic order.

[YOCTO #2655]
[YOCTO #12478]
[YOCTO #12480]

(From OE-Core rev: 3f839c0cdfe253677ebee47838fe476a0939e0aa)

Signed-off-by: Juro Bystricky <juro.bystricky@intel.com>

Improve the fix and rebase it to 2.28

Here is the log of lib32-glibc
[log.do_compile]
|Adjust ldd script
|ldd "/lib64/ld-linux-x86-64.so.2 /lib/ld-linux.so.2 /lib/ld-linux.so.2
/lib64/ld-linux-x86-64.so.2" -> "/lib/ld-linux.so.2 /lib64/ld-linux-x86-64.so.2"
[log.do_compile]

Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-12-08 17:17:01 +00:00
Kai Kang
7291426ed5 glibc-locale: fix installed-vs-shipped qa issue
Variable PACKAGE_NO_GCONV is set in libc-package.bbclass when none of
libc-charsets, libc-locales and libc-locale-code set in DISTRO_FEATURES.
Then it causes installed-vs-shipped qa issue of glibc-locale:

| ERROR: glibc-locale-2.28-r0 do_package: QA Issue: glibc-locale:
| Files/directories were installed but not shipped in any package:
|   /usr/share/i18n
|   /usr/share/i18n/charmaps
|   /usr/share/i18n/locales
|   /usr/share/i18n/charmaps/CP737.gz
|   ...
|   /usr/share/i18n/locales/ru_RU
|   ...
|   /usr/lib64/gconv/gconv-modules
| Please set FILES such that these items are packaged. Alternatively if they
| are unneeded, avoid installing them or delete them within do_install.
| glibc-locale: 843 installed and not shipped files. [installed-vs-shipped]

So check PACKAGE_NO_GCONV during do_install and not copy those files if
PACKAGE_NO_GCONV has been set.

Simplify call of bb.utils.contains() in libc-package.bbclass as well.

(From OE-Core rev: 39840ed10af559bbcc306b378baa4723921668f5)

Signed-off-by: Kai Kang <kai.kang@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-12-05 22:30:19 +00:00
Alexey Brodkin
ef63723965 locale: Allow usage of cross-localedef for ARC
With this it's possible to build locale data for ARC
and not do it instead on the first boot.

(From OE-Core rev: f13c303491dc8850126ea14baedc7b63b7b5ecf4)

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-11-14 11:14:40 +00:00
Martin Hundebøll
7373dc71b6 glibc: make ld-2.28.so reproducible on arm
Play the whack-a-mole game and add the .file directive to another
assembly file that otherwise shows itself in ld-2.28.so debug file,
which in turns alters the build-id of ld-2.28.so on target.

(From OE-Core rev: 4cbf901b3a127ed039371e614946002d26d56997)

Signed-off-by: Martin Hundebøll <martin@geanix.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-11-09 15:27:34 +00:00
Khem Raj
7dd981cb89 glibc: Do not use thumb1 ISA on armv6
This does not work and is unsupported so lets compile glibc in ARM mode
always on armv6 SOCs

Fixes [YOCTO #12929]

(From OE-Core rev: de01490695c70ae29b4f2f82aecbffaf5667449e)

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-10-14 23:45:28 +01:00
Richard Purdie
cd158dd197 glibc: Fix glibc reproducibility issues
Currently for non-IA platforms, glibc is not reproducible as host system
paths are being injected into target binaries. These spread through
all target binaries on the system which link to the libc.

Add a patch which injects .file directives into the assembly pieces
and works around this issue until a better solution can be found.

(From OE-Core rev: 4d6fd8178da75f9a1870db290bbe24de5af752c9)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-10-04 14:21:41 +01:00
Martin Jansa
50cc48b180 glibc: bump SRCREV to latest 2.28
* drop one patch already applied in upstream

* this is still only partial fix for issues with -O0 and the bigger
  issue might be detected in runtime as described in:
  https://sourceware.org/glibc/wiki/FAQ#Why_do_I_get:.60.23error_.22glibc_cannot_be_compiled_without_optimization.22.27.2C_when_trying_to_compile_GNU_libc_with_GNU_CC.3F
  https://sourceware.org/bugzilla/show_bug.cgi?id=19444
  and tested in glibc build:
  https://sourceware.org/git/?p=glibc.git;a=blob;f=include/libc-symbols.h;h=8b9273c13a19f2658105c7997267d9086adae716;hb=HEAD#l74

* restore the anonymous python to trigger fatal error when -O0 is
  used (but don't restore the notes for -O, -O1, -Os

* git log --oneline 3c03baca37fdcb52c3881e653ca392bba7a99c2b..044c96f0d5595aeb0bb4e79355081c5a7f4faca5 | tee
044c96f0d5 Fix misreported errno on preadv2/pwritev2 (BZ#23579)
3a67c72c15 Fix stack overflow in tst-setcontext9 (bug 23717)
2339d6a55e i386: Use ENTRY and END in start.S [BZ #23606]
0ef2f4400c Fix strstr bug with huge needles (bug 23637)
a55e109709 Fix tst-setcontext9 for optimized small stacks.
307d04334d misc: New test misc/tst-gethostid
e7d22db29c Linux gethostid: Check for NULL value from gethostbyname_r [BZ #23679]
1fe2b9ca8a Fix segfault in maybe_script_execute.
0b79004569 regex: Add test tst-regcomp-truncated [BZ #23578]
58559f1443 regex: fix uninitialized memory access
aa8a3e4cde pthread_cond_broadcast: Fix waiters-after-spinning case [BZ #23538]
c87b5bab24 Improve ChangeLog message.
66fdfd57fe Regen RISC-V rvd ULPs
b0aa03dfff RISC-V: Fix rounding save/restore bug.
2f498f3d14 nss_files: Fix file stream leak in aliases lookup [BZ #23521]
bfcfa22589 nscd: Deallocate existing user names in file parser
d05b05d157 error, error_at_line: Add missing va_end calls
4b25485f03 Linux: Rewrite __old_getdents64 [BZ #23497]
726e1554ce hurd: Avoid PLTs for __pthread_get/setspecific
7f11842e74 hurd: Add missing symbols for proper libc_get/setspecific

* update 0031-sysdeps-ieee754-prevent-maybe-uninitialized-errors-w.patch
  based on review comments in upstream and extend it to cover PPC based
  on:
  http://lists.openembedded.org/pipermail/openembedded-core/2018-September/156258.html

* update 0032-sysdeps-ieee754-soft-fp-ignore-maybe-uninitialized-w.patch
  based on review comments in upstream

* add 0033-locale-prevent-maybe-uninitialized-errors-with-Os-BZ.patch
  with a fix for aarch64 build with -Os

* build tested with qemuarm, qemuarm64, qemux86, qemux86-64, qemuppc,
  qemumips, qemumips64 with -O, -O1, -Os.

(From OE-Core rev: f1f38df91975f9b53933c2d2fbdca291d1872d5f)

Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-10-04 14:21:41 +01:00
Awais Belal
3bbbe25ae7 glibc-package.inc: correct intention for deleting /usr/lib as needed
In case the baselib is lib64 we would want to delete /usr/lib
after removing the /usr/lib/locale dir and the implementation
wanted to do that earlier as well but the fault was checking
an already removed dir (/usr/lib/locale) before trying to
remove /usr/lib as that check would always fail.
Now we simply try to delete /usr/lib after deleting
/usr/lib/locale to make sure it deletes cleanly and is empty
at the time of deletion.

(From OE-Core rev: 4dad1568f8f84ec9de4bf7235822f77a8ee6a413)

Signed-off-by: Awais Belal <awais_belal@mentor.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-09-27 23:41:41 +01:00
Mingli Yu
c32b26ce8d glibc: fix Segmentation fault in gethostid.c
Linux gethostid: Check for NULL value from gethostbyname_r [BZ #23679]

A NULL value can happen with certain gethostbyname_r failures.

Before this patch, there is a Segmentation fault
as below:
 # /mybuild/hostid
 Segmentation fault
 # gdb /mybuild/hostid
 GNU gdb (GDB) 8.2
 Copyright (C) 2018 Free Software Foundation, Inc.
 License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
 This is free software: you are free to change and redistribute it.
 There is NO WARRANTY, to the extent permitted by law.
 Type "show copying" and "show warranty" for details.
 This GDB was configured as "x86_64-wrs-linux".
 Type "show configuration" for configuration details.
 For bug reporting instructions, please see:
 <http://www.gnu.org/software/gdb/bugs/>.
 Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

 For help, type "help".
 Type "apropos word" to search for commands related to "word"...
 Reading symbols from /mybuild/hostid...done.
 (gdb) r
 Starting program: /mybuild/hostid

 Program received signal SIGSEGV, Segmentation fault.
 0x00007ffff7f0330e in gethostid () at ../sysdeps/unix/sysv/linux/gethostid.c:125
 125	  memcpy (&in, hp->h_addr,
 (gdb) bt
 #0  0x00007ffff7f0330e in gethostid () at ../sysdeps/unix/sysv/linux/gethostid.c:125
 #1  0x0000555555555159 in main ()

 # cat /mybuild/hostid.c
 #include <stdio.h>
 #include <unistd.h>

 int
 main(int argc, char *argv[])
 {
    long hostid;
    hostid = gethostid();
    printf("the hostid is %ld\n", hostid);

 }

(From OE-Core rev: 92c266fd9b1c4034a13bd5b102d1817df388a7b5)

Signed-off-by: Mingli Yu <Mingli.Yu@windriver.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-09-21 18:45:47 -07:00
Martin Jansa
19c64533eb glibc: fix build with -O
* tested for qemuarm, qemux86 with -O, -O0, -Os, with gcc
* to build with -O0 I had to remove restriction from systemtap first

(From OE-Core rev: be3d12c6b1003348f1dabec9d2253f22b42f0387)

Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-09-20 05:41:31 -07:00
Khem Raj
9c30eb1989 glibc-locale: Enable riscv64 and riscv32 in BINARY_LOCALE_ARCHES supported architectures
This support is there using cross-localedef but was not enabled, this
caused the post-install for locales to be emitted which delays the boot
significantly.

emitted postints for locales contain exit 1 which is flagged now and was
causing image generation to fail.

(From OE-Core rev: c67298f3af9cbb8c7596e4fb20b652a8f2582add)

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-09-04 11:03:55 +01:00
Richard Purdie
2988d730a3 glibc-ld: Simplify/cleanup multilib handling to use library functions
We have library functions to handle multilib variables/datastores, lets
use them so we have good common functions.

(From OE-Core rev: 774219567987956fb7bbb50e64eb6cebef1efe5b)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-08-23 17:58:59 +01:00
Richard Purdie
14dfb7ea59 glibc: Improve ldd loader specification
Currently if a tune isn't specified in the table, the loader defaults for the
architecture are used which may or may not match our path specification. This
leads to general confusion.

Change the code to use the linuxloader class which works of architecture, not
tune.

This still isn't perfect as n32/x32 aren't covered but its an improvement
to listing all tunes here.

(From OE-Core rev: 46a6da24b51426bedd9af8a2d63b2992b9d3fa5a)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-08-23 17:58:59 +01:00
Chen Qi
72844f5431 glibc: re-package for libnss-db
On other distros like ubuntu/centos, libnss-db usually provides:
- The libraries
- The Makefile to create database
  (in /var/db for centos, /var/lib/misc/ for ubuntu)
- The makedb command (it's in glibc-common for centos7)

What we had is:
- The libraries are in glibc-extra-nss
- The Makefile is removed
- The makedb command is in glibc-utils (lack of dependency)

So when glibc-extra-nss is installed but glibc-utils is not,
we see error like:
nscd[165]: 165 checking for monitored file `/var/db/group.db': No such file or directory
nscd[165]: 165 checking for monitored file `/var/db/passwd.db': No such file or directory

And there is not an easy way to create these databases.

To fix the issue:
- Re-package the libraries into libnss-db
- Don't remove the Makefile and add it in libnss-db
- Add RDEPENDS for libnss-db on glibc-utils
- Provide a shell script, makedbs.sh, to generate the db files.
  This is to avoid dependency on 'make'.

Notes:
1. For external toolchain, an extra package 'libnss-db' need to be provided
   If replacing glibc from core.
2. I've check the git history of nss/db-Makefile, the last two functionality
   fix is as below.
   - fix non-portable `echo -n` usage   --  Date:   Thu Aug 6 04:14:20 2015 -0400
   - Fix db makefile rule for group.db  --  Date:   Fri Nov 11 14:43:36 2011 +0100
   So I think this file is stable enough. And using makedbs.sh which is crafted according
   to that file is not likely to cause maintanence problem.

(From OE-Core rev: 13cf502fce8956f95fdc8ac0c7a37d741223bcc9)

Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-08-19 16:35:22 +01:00
Richard Purdie
066c2221f0 glibc-initial: Add missing bison-native dependency
(From OE-Core rev: 11e7dc96e7bc9d1cbf1f3bd10caeb65190c41a2f)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-08-16 22:40:27 +01:00
Richard Purdie
71d87cce85 glibc: Fix locale archive path patch
The locale code uses the archive location in two places, ensure both are
corrected to use the environment variable which avoids nasty build
failures when archiving locales in images.

(From OE-Core rev: 3ab1249a2ac92a0fcb008e92cc9ee272441408f4)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-08-15 09:44:33 +01:00
Richard Purdie
06bc404124 glibc: Add make-native depends
glibc needs make >= 4 yet some of our build workers have older versions of
make. Add a make-native dependency to work around this until all our supported
distros have a recent version of make.

(From OE-Core rev: 0cd89e4af625941f8ab8c033f72f900a2979b304)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-08-15 09:44:33 +01:00
Khem Raj
fddb23c310 glibc: Disable crypt support in glibc
Drop packaging libcrypt from 2.28+ onwards
We have independent crypt implementation coming from libxcrypt

(From OE-Core rev: 6146b8c4216daf56a69f4e3531861302df6a63a2)

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-08-15 09:44:33 +01:00
Khem Raj
0762ba7189 cross-localedef-native: Update to build with glibc 2.28
(From OE-Core rev: d1e02516dcce977a06320fcca968613466e43f29)

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-08-15 09:44:33 +01:00
Khem Raj
fb535ac046 glibc: Upgrade to 2.28
License-Update: libidn is dropped from glibc and a testcase that was a particular contributor copyrighted

see

https://sourceware.org/git/?p=glibc.git;a=blobdiff;f=LICENSES;h=0e3a9fe39b26e97038d92f904508a4c3aa1bb43b;hp=b29efe01084af28cc40953d7317f22927c0ee3b7;hb=5a357506659f9a00fcf5bc9c5d8fc676175c89a7;hpb=7279af007c420a9d5f88a6909d11e7cb712c16a4
https://sourceware.org/git/?p=glibc.git;a=blobdiff;f=LICENSES;h=b29efe01084af28cc40953d7317f22927c0ee3b7;hp=80f7f1487947f57815b9fe076fadc8c7f94eeb8e;hb=7f9f1ecb710eac4d65bb02785ddf288cac098323;hpb=5f7b841d3aebdccc2baed27cb4b22ddb08cd7c0c

Drop upstreamed and backported patches

(From OE-Core rev: da8bf414922ce7af865fadc4a86fd96ab6262506)

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-08-15 09:44:33 +01:00
Daniel Díaz
bb2db47876 glibc: Make bits/wordsize.h multilibbed again
As reported by ChenQi, leaving bits/wordsize.h out of being
multilibbed introduced a problem in building the SDK for
arm64:
  Error: Transaction check error:
    file /usr/include/bits/wordsize.h conflicts between attempted installs of lib32-libc6-dev-2.27-r0.armv7vet2hf_vfp and libc6-dev-2.27-r0.aarch64

This effectively reverts commit a74c77d6.

(From OE-Core rev: 90ad502bf8faa233e25cf297c1eeefcb0367aea3)

Signed-off-by: Daniel Díaz <daniel.diaz@linaro.org>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-08-14 11:36:31 +01:00
Khem Raj
418b9261b3 glibc-locale: Fix host-user-contaminated QA errors
Fixes

ERROR: glibc-locale-2.27-r0 do_package_qa: QA Issue: glibc-locale: /glibc-binary-localedata-hy-am/usr/lib/locale/hy_AM/LC_MEASUREMENT.tmp is owned by uid 3004, which is the same as the user running bitbake. This may be due to host contamination [host-user-contaminated]

(From OE-Core rev: 06d831d12fe2a2366480c79f4c018942937b753a)

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-07-30 12:44:35 +01:00
Daniel Díaz
18225a16a4 glibc: Avoid multilibbing on wordsize.h
Once another header #includes <bits/wordsize.h>, there is a
potential recursion going on because the
multilib_header_wrapper.h #includes <bits/wordsize.h> again!

This should not happen because an __arm__ (32-bits) or an
__aarch64__ (64-bits) environment guarantees that we will
be getting the correct definition, but when building against
a different target (like BPF), recursion is what happens.

This can be seen, for instance, when building eBPF programs
from the kernel with `clang -target bpf', such as the ones
located in linux/tools/testing/selftests/bpf/.

(From OE-Core rev: a74c77d6168101e88c3a3bce7130f4f52cfab95d)

Signed-off-by: Daniel Díaz <daniel.diaz@linaro.org>
Signed-off-by: Aníbal Limón <anibal.limon@linaro.org>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-07-26 13:16:41 +01:00
Zheng Ruoqin
1d2e5eed40 glibc: fix CVE-2018-11237
glibc: fix CVE-2018-11237

(From OE-Core rev: b9b254da08c1db94ac9ded5f67d7e2e82e3b9be7)

Signed-off-by: Zheng Ruoqin <zhengrq.fnst@cn.fujitsu.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-06-28 09:22:35 +01:00
Zhixiong Chi
d2efd1f20e glibc: fix CVE-2017-18269 and CVE-2018-11236
Backport two CVE patches from the upstream
https://sourceware.org/git/gitweb.cgi?p=glibc.git;a=summary
commit 5460617d1567657621107d895ee2dd83bc1f88f2
commit cd66c0e584c6d692bc8347b5e72723d02b8a8ada

(From OE-Core rev: 398ac946745bbfad55deb382aeafec0be3298819)

Signed-off-by: Zhixiong Chi <zhixiong.chi@windriver.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-06-15 17:56:24 +01:00
Tom Rini
d7fc3484ef glibc: Check /etc/ld.so.conf.d/*.conf by default
The expected modern behavior for dealing with adding ld.so.conf entries
is to add a file to /etc/ld.so.conf.d/.  In order to do this, ld.so.conf
needs to explicitly include that /etc/ld.so.conf.d/*.conf.  Make it so.

Cc: Khem Raj <raj.khem@gmail.com>
(From OE-Core rev: 1f03019356e3712435dbe4ed9f359992b0ad4578)

Signed-off-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-05-11 07:49:38 +01:00