From c32b26ce8d43f39aecf4b53175690ee66e03c376 Mon Sep 17 00:00:00 2001 From: Mingli Yu Date: Fri, 21 Sep 2018 11:43:10 +0800 Subject: 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 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: . Find the GDB manual and other documentation resources online at: . 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 #include 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 Signed-off-by: Ross Burton Signed-off-by: Richard Purdie --- meta/recipes-core/glibc/glibc_2.28.bb | 1 + 1 file changed, 1 insertion(+) (limited to 'meta/recipes-core/glibc/glibc_2.28.bb') diff --git a/meta/recipes-core/glibc/glibc_2.28.bb b/meta/recipes-core/glibc/glibc_2.28.bb index df60ba8445..804b7891ec 100644 --- a/meta/recipes-core/glibc/glibc_2.28.bb +++ b/meta/recipes-core/glibc/glibc_2.28.bb @@ -47,6 +47,7 @@ SRC_URI = "${GLIBC_GIT_URI};branch=${SRCBRANCH};name=glibc \ file://0030-intl-Emit-no-lines-in-bison-generated-files.patch \ file://0031-sysdeps-ieee754-prevent-maybe-uninitialized-errors.patch \ file://0032-soft-fp-ignore-maybe-uninitialized.patch \ + file://0001-Linux-gethostid-Check-for-NULL-value-from-gethostbyn.patch \ " NATIVESDKFIXES ?= "" -- cgit v1.2.3-54-g00ecf