From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by sourceware.org (Postfix) with ESMTPS id 4F479385781D for ; Mon, 10 Jan 2022 19:21:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 4F479385781D Received: from pps.filterd (m0098393.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 20AGuV6i027212 for ; Mon, 10 Jan 2022 19:21:45 GMT Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 3dfmpn260e-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 10 Jan 2022 19:21:45 +0000 Received: from m0098393.ppops.net (m0098393.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 20AJEvQl020678 for ; Mon, 10 Jan 2022 19:21:44 GMT Received: from ppma01dal.us.ibm.com (83.d6.3fa9.ip4.static.sl-reverse.com [169.63.214.131]) by mx0a-001b2d01.pphosted.com with ESMTP id 3dfmpn2608-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 10 Jan 2022 19:21:44 +0000 Received: from pps.filterd (ppma01dal.us.ibm.com [127.0.0.1]) by ppma01dal.us.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 20AJHvcs030262; Mon, 10 Jan 2022 19:21:43 GMT Received: from b01cxnp22033.gho.pok.ibm.com (b01cxnp22033.gho.pok.ibm.com [9.57.198.23]) by ppma01dal.us.ibm.com with ESMTP id 3df289vqjk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 10 Jan 2022 19:21:43 +0000 Received: from b01ledav006.gho.pok.ibm.com (b01ledav006.gho.pok.ibm.com [9.57.199.111]) by b01cxnp22033.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 20AJLgI429425938 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 10 Jan 2022 19:21:42 GMT Received: from b01ledav006.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 28A40AC064; Mon, 10 Jan 2022 19:21:42 +0000 (GMT) Received: from b01ledav006.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 85284AC05B; Mon, 10 Jan 2022 19:21:41 +0000 (GMT) Received: from localhost (unknown [9.65.254.45]) by b01ledav006.gho.pok.ibm.com (Postfix) with ESMTP; Mon, 10 Jan 2022 19:21:41 +0000 (GMT) Content-Type: text/plain; charset="utf-8" In-Reply-To: <20211222153151.162136-1-lamm@linux.ibm.com> References: <87r1c9rmlz.fsf@oldenburg.str.redhat.com> <20211222153151.162136-1-lamm@linux.ibm.com> Subject: Re: [RFC] Remove special flags of libc.5.so and libc.4.so From: "Lucas A. M. Magalhaes" Cc: fweimer@redhat.com, tuliom@linux.ibm.com To: "Lucas A. M. Magalhaes via Libc-alpha" Date: Mon, 10 Jan 2022 16:21:40 -0300 Message-ID: <164184250019.1740299.12984394689519254253@localhost.localdomain> User-Agent: alot/0.9.1 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: QoYHPcQKyUOUWemoflJjnK0BT00wNapD X-Proofpoint-ORIG-GUID: RXVvBQu5zaCAfi2jEHmXKcmaaWkjhu2W Content-Transfer-Encoding: quoted-printable X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.790,Hydra:6.0.425,FMLib:17.11.62.513 definitions=2022-01-10_07,2022-01-10_02,2021-12-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=999 lowpriorityscore=0 adultscore=0 priorityscore=1501 phishscore=0 malwarescore=0 bulkscore=0 clxscore=1015 impostorscore=0 mlxscore=0 spamscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2110150000 definitions=main-2201100130 X-Spam-Status: No, score=-12.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_MSPIKE_H5, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Jan 2022 19:21:48 -0000 Ping. Quoting Lucas A. M. Magalhaes via Libc-alpha (2021-12-22 12:31:51) > I've tested it in a AT build and was able to build and link programs as > expected. For other archs I try with build-many-glibcs.py, all > succeeded. >=20 > Any other suggestions on how to test this? >=20 > Florian am I missing something? Should we add a restriction to cache > just new libc6.so compatible libraries? >=20 > -- 8< -- >=20 > The older libcs version are obsolete for over twenty years now. This > commit removes special flags of libc.5.so and libc.4.so.. It assume that > all libraries cached are libc.6.so compatible and wrote FLAG_ELF_LIBC6. >=20 > Tested on x86_64, powerpc, powerpc64 and powerpc64le. > Tested with build-many-glibcs.py for the other affected architectures. > --- > elf/cache.c | 6 +-- > elf/ldconfig.c | 33 +--------------- > elf/readelflib.c | 46 +++------------------- > elf/readlib.c | 25 +----------- > sysdeps/unix/sysv/linux/arc/ldconfig.h | 8 ---- > sysdeps/unix/sysv/linux/arm/ldconfig.h | 7 ---- > sysdeps/unix/sysv/linux/csky/ldconfig.h | 6 --- > sysdeps/unix/sysv/linux/ia64/ldconfig.h | 6 --- > sysdeps/unix/sysv/linux/powerpc/ldconfig.h | 8 ---- > sysdeps/unix/sysv/linux/riscv/ldconfig.h | 17 -------- > sysdeps/unix/sysv/linux/s390/ldconfig.h | 7 ---- > sysdeps/unix/sysv/linux/x86_64/ldconfig.h | 8 ---- > 12 files changed, 11 insertions(+), 166 deletions(-) >=20 > diff --git a/elf/cache.c b/elf/cache.c > index 1c0dc5ee87..387dd11a05 100644 > --- a/elf/cache.c > +++ b/elf/cache.c > @@ -158,6 +158,7 @@ struct cache_entry > /* List of all cache entries. */ > static struct cache_entry *entries; >=20=20 > +/* libc4, ELF and libc5 are unsupported */ > static const char *flag_descr[] =3D > { "libc4", "ELF", "libc5", "libc6"}; >=20=20 > @@ -169,14 +170,11 @@ print_entry (const char *lib, int flag, unsigned in= t osversion, > printf ("\t%s (", lib); > switch (flag & FLAG_TYPE_MASK) > { > - case FLAG_LIBC4: > - case FLAG_ELF: > - case FLAG_ELF_LIBC5: > case FLAG_ELF_LIBC6: > fputs (flag_descr[flag & FLAG_TYPE_MASK], stdout); > break; > default: > - fputs (_("unknown"), stdout); > + fputs (_("Unknown or unsupported flag"), stdout); > break; > } > switch (flag & FLAG_REQUIRED_MASK) > diff --git a/elf/ldconfig.c b/elf/ldconfig.c > index 101d56ac8e..d64b134781 100644 > --- a/elf/ldconfig.c > +++ b/elf/ldconfig.c > @@ -65,19 +65,6 @@ >=20=20 > #define PACKAGE _libc_intl_domainname >=20=20 > -static const struct > -{ > - const char *name; > - int flag; > -} lib_types[] =3D > -{ > - {"libc4", FLAG_LIBC4}, > - {"libc5", FLAG_ELF_LIBC5}, > - {"libc6", FLAG_ELF_LIBC6}, > - {"glibc2", FLAG_ELF_LIBC6} > -}; > - > - > /* List of directories to handle. */ > struct dir_entry > { > @@ -471,25 +458,7 @@ add_dir_1 (const char *line, const char *from_file, = int from_line) >=20=20 > /* Search for an '=3D' sign. */ > entry->path =3D xstrdup (line); > - char *equal_sign =3D strchr (entry->path, '=3D'); > - if (equal_sign) > - { > - *equal_sign =3D '\0'; > - ++equal_sign; > - entry->flag =3D FLAG_ANY; > - for (i =3D 0; i < sizeof (lib_types) / sizeof (lib_types[0]); ++i) > - if (strcmp (equal_sign, lib_types[i].name) =3D=3D 0) > - { > - entry->flag =3D lib_types[i].flag; > - break; > - } > - if (entry->flag =3D=3D FLAG_ANY) > - error (0, 0, _("%s is not a known library type"), equal_sign); > - } > - else > - { > - entry->flag =3D FLAG_ANY; > - } > + entry->flag =3D FLAG_ELF_LIBC6; >=20=20 > /* Canonify path: for now only remove leading and trailing > whitespace and the trailing slashes. */ > diff --git a/elf/readelflib.c b/elf/readelflib.c > index 10b10b6080..801c5587ab 100644 > --- a/elf/readelflib.c > +++ b/elf/readelflib.c > @@ -44,7 +44,6 @@ process_elf_file (const char *file_name, const char *li= b, int *flag, > char **soname, void *file_contents, size_t file_length) > { > int i; > - unsigned int j; > unsigned int dynamic_addr; > size_t dynamic_size; > char *program_interpreter; > @@ -82,9 +81,8 @@ process_elf_file (const char *file_name, const char *li= b, int *flag, > elf_pheader =3D (ElfW(Phdr) *) (elf_header->e_phoff + file_contents); > check_ptr (elf_pheader); >=20=20 > - /* The library is an elf library, now search for soname and > - libc5/libc6. */ > - *flag =3D FLAG_ELF; > + /* The library is an elf library */ > + *flag =3D FLAG_ELF_LIBC6; >=20=20 > /* The default ISA level is 0. */ > *isa_level =3D 0; > @@ -111,16 +109,6 @@ process_elf_file (const char *file_name, const char = *lib, int *flag, > program_interpreter =3D (char *) (file_contents + segment->p_of= fset); > check_ptr (program_interpreter); >=20=20 > - /* Check if this is enough to classify the binary. */ > - for (j =3D 0; j < sizeof (interpreters) / sizeof (interpreters = [0]); > - ++j) > - if (strcmp (program_interpreter, interpreters[j].soname) =3D= =3D 0) > - { > - *flag =3D interpreters[j].flag; > - break; > - } > - break; > - > case PT_NOTE: > if (!*osversion && segment->p_filesz >=3D 32 && segment->p_alig= n >=3D 4) > { > @@ -291,38 +279,16 @@ done: > if (dynamic_strings =3D=3D NULL) > return 1; >=20=20 > - /* Now read the DT_NEEDED and DT_SONAME entries. */ > + /* Now read the DT_SONAME entries. */ > for (dyn_entry =3D dynamic_segment; dyn_entry->d_tag !=3D DT_NULL; > ++dyn_entry) > { > - if (dyn_entry->d_tag =3D=3D DT_NEEDED || dyn_entry->d_tag =3D=3D D= T_SONAME) > + if (dyn_entry->d_tag =3D=3D DT_SONAME) > { > char *name =3D dynamic_strings + dyn_entry->d_un.d_val; > check_ptr (name); > - > - if (dyn_entry->d_tag =3D=3D DT_NEEDED) > - { > - > - if (*flag =3D=3D FLAG_ELF) > - { > - /* Check if this is enough to classify the binary. */ > - for (j =3D 0; > - j < sizeof (known_libs) / sizeof (known_libs [0]); > - ++j) > - if (strcmp (name, known_libs [j].soname) =3D=3D 0) > - { > - *flag =3D known_libs [j].flag; > - break; > - } > - } > - } > - > - else if (dyn_entry->d_tag =3D=3D DT_SONAME) > - *soname =3D xstrdup (name); > - > - /* Do we have everything we need? */ > - if (*soname && *flag !=3D FLAG_ELF) > - return 0; > + *soname =3D xstrdup (name); > + return 0; > } > } >=20=20 > diff --git a/elf/readlib.c b/elf/readlib.c > index 64b20d7804..9164c1cda7 100644 > --- a/elf/readlib.c > +++ b/elf/readlib.c > @@ -43,24 +43,6 @@ struct known_names > int flag; > }; >=20=20 > -static struct known_names interpreters[] =3D > -{ > - { "/lib/" LD_SO, FLAG_ELF_LIBC6 }, > -#ifdef SYSDEP_KNOWN_INTERPRETER_NAMES > - SYSDEP_KNOWN_INTERPRETER_NAMES > -#endif > -}; > - > -static struct known_names known_libs[] =3D > -{ > - { LIBC_SO, FLAG_ELF_LIBC6 }, > - { LIBM_SO, FLAG_ELF_LIBC6 }, > -#ifdef SYSDEP_KNOWN_LIBRARY_NAMES > - SYSDEP_KNOWN_LIBRARY_NAMES > -#endif > -}; > - > - > /* Check if string corresponds to a GDB Python file. */ > static bool > is_gdb_python_file (const char *name) > @@ -84,7 +66,8 @@ process_file (const char *real_file_name, const char *f= ile_name, > struct exec *aout_header; >=20=20 > ret =3D 0; > - *flag =3D FLAG_ANY; > + /* Just set FLAG_ELF_LIBC6 as old formats are not supported anymore. = */ > + *flag =3D FLAG_ELF_LIBC6; > *soname =3D NULL; >=20=20 > file =3D fopen (real_file_name, "rb"); > @@ -151,7 +134,6 @@ process_file (const char *real_file_name, const char = *file_name, > *dot =3D '\0'; > } > *soname =3D copy; > - *flag =3D FLAG_LIBC4; > goto done; > } >=20=20 > @@ -192,9 +174,6 @@ implicit_soname (const char *lib, int flag) > { > char *soname =3D xstrdup (lib); >=20=20 > - if ((flag & FLAG_TYPE_MASK) !=3D FLAG_LIBC4) > - return soname; > - > /* Aout files don't have a soname, just return the name > including the major number. */ > char *major =3D strstr (soname, ".so."); > diff --git a/sysdeps/unix/sysv/linux/arc/ldconfig.h b/sysdeps/unix/sysv/l= inux/arc/ldconfig.h > index 8c776fca9e..02ed826283 100644 > --- a/sysdeps/unix/sysv/linux/arc/ldconfig.h > +++ b/sysdeps/unix/sysv/linux/arc/ldconfig.h > @@ -17,11 +17,3 @@ > . */ >=20=20 > #include > - > -#define SYSDEP_KNOWN_INTERPRETER_NAMES \ > - { "/lib/ld-linux-arc.so.2", FLAG_ELF_LIBC6 }, \ > - { "/lib/ld-linux-arceb.so.2", FLAG_ELF_LIBC6 }, > - > -#define SYSDEP_KNOWN_LIBRARY_NAMES \ > - { "libc.so.6", FLAG_ELF_LIBC6 }, \ > - { "libm.so.6", FLAG_ELF_LIBC6 }, > diff --git a/sysdeps/unix/sysv/linux/arm/ldconfig.h b/sysdeps/unix/sysv/l= inux/arm/ldconfig.h > index d839470cfe..b3fa8ceebe 100644 > --- a/sysdeps/unix/sysv/linux/arm/ldconfig.h > +++ b/sysdeps/unix/sysv/linux/arm/ldconfig.h > @@ -16,10 +16,3 @@ > . */ >=20=20 > #include > - > -#define SYSDEP_KNOWN_INTERPRETER_NAMES \ > - { "/lib/ld-linux.so.3", FLAG_ELF_LIBC6 }, \ > - { "/lib/ld-linux-armhf.so.3", FLAG_ELF_LIBC6 }, > -#define SYSDEP_KNOWN_LIBRARY_NAMES \ > - { "libc.so.6", FLAG_ELF_LIBC6 }, \ > - { "libm.so.6", FLAG_ELF_LIBC6 }, > diff --git a/sysdeps/unix/sysv/linux/csky/ldconfig.h b/sysdeps/unix/sysv/= linux/csky/ldconfig.h > index eeda37e4a8..6861f71327 100644 > --- a/sysdeps/unix/sysv/linux/csky/ldconfig.h > +++ b/sysdeps/unix/sysv/linux/csky/ldconfig.h > @@ -26,9 +26,3 @@ > #else > # define LD_SO_ABI "cskyv2" > #endif > - > -#define SYSDEP_KNOWN_INTERPRETER_NAMES \ > - { LD_SO_PREFIX LD_SO_ABI LD_SO_SUFFIX, FLAG_ELF_LIBC6 }, > -#define SYSDEP_KNOWN_LIBRARY_NAMES \ > - { "libc.so.6", FLAG_ELF_LIBC6 }, \ > - { "libm.so.6", FLAG_ELF_LIBC6 }, > diff --git a/sysdeps/unix/sysv/linux/ia64/ldconfig.h b/sysdeps/unix/sysv/= linux/ia64/ldconfig.h > index 53685659ed..b3fa8ceebe 100644 > --- a/sysdeps/unix/sysv/linux/ia64/ldconfig.h > +++ b/sysdeps/unix/sysv/linux/ia64/ldconfig.h > @@ -16,9 +16,3 @@ > . */ >=20=20 > #include > - > -#define SYSDEP_KNOWN_INTERPRETER_NAMES \ > - { "/lib/ld-linux.so.2", FLAG_ELF_LIBC6 }, > -#define SYSDEP_KNOWN_LIBRARY_NAMES \ > - { "libc.so.6", FLAG_ELF_LIBC6 }, \ > - { "libm.so.6", FLAG_ELF_LIBC6 }, > diff --git a/sysdeps/unix/sysv/linux/powerpc/ldconfig.h b/sysdeps/unix/sy= sv/linux/powerpc/ldconfig.h > index 09d75b3dec..d0935d541b 100644 > --- a/sysdeps/unix/sysv/linux/powerpc/ldconfig.h > +++ b/sysdeps/unix/sysv/linux/powerpc/ldconfig.h > @@ -17,11 +17,3 @@ > . */ >=20=20 > #include > - > -#define SYSDEP_KNOWN_INTERPRETER_NAMES \ > - { "/lib/ld.so.1", FLAG_ELF_LIBC6 }, \ > - { "/lib64/ld64.so.1", FLAG_ELF_LIBC6 }, \ > - { "/lib64/ld64.so.2", FLAG_ELF_LIBC6 }, > -#define SYSDEP_KNOWN_LIBRARY_NAMES \ > - { "libc.so.6", FLAG_ELF_LIBC6 }, \ > - { "libm.so.6", FLAG_ELF_LIBC6 }, > diff --git a/sysdeps/unix/sysv/linux/riscv/ldconfig.h b/sysdeps/unix/sysv= /linux/riscv/ldconfig.h > index e6e7d271ad..24aae5155a 100644 > --- a/sysdeps/unix/sysv/linux/riscv/ldconfig.h > +++ b/sysdeps/unix/sysv/linux/riscv/ldconfig.h > @@ -17,20 +17,3 @@ > . */ >=20=20 > #include > - > -#define LD_SO_PREFIX "/lib/ld-linux-" > -#define LD_SO_SUFFIX ".so.1" > - > -#if __riscv_xlen =3D=3D 64 > -# define LD_SO_ABI "riscv64-lp64" > -#else > -# define LD_SO_ABI "riscv32-ilp32" > -#endif > - > -#define SYSDEP_KNOWN_INTERPRETER_NAMES \ > - { LD_SO_PREFIX LD_SO_ABI "d" LD_SO_SUFFIX, FLAG_ELF_LIBC6 }, \ > - { LD_SO_PREFIX LD_SO_ABI LD_SO_SUFFIX, FLAG_ELF_LIBC6 }, > - > -#define SYSDEP_KNOWN_LIBRARY_NAMES \ > - { "libc.so.6", FLAG_ELF_LIBC6 }, \ > - { "libm.so.6", FLAG_ELF_LIBC6 }, > diff --git a/sysdeps/unix/sysv/linux/s390/ldconfig.h b/sysdeps/unix/sysv/= linux/s390/ldconfig.h > index 83086ce843..b3fa8ceebe 100644 > --- a/sysdeps/unix/sysv/linux/s390/ldconfig.h > +++ b/sysdeps/unix/sysv/linux/s390/ldconfig.h > @@ -16,10 +16,3 @@ > . */ >=20=20 > #include > - > -#define SYSDEP_KNOWN_INTERPRETER_NAMES \ > - { "/lib/ld.so.1", FLAG_ELF_LIBC6 }, \ > - { "/lib/ld64.so.1", FLAG_ELF_LIBC6 }, > -#define SYSDEP_KNOWN_LIBRARY_NAMES \ > - { "libc.so.6", FLAG_ELF_LIBC6 }, \ > - { "libm.so.6", FLAG_ELF_LIBC6 }, > diff --git a/sysdeps/unix/sysv/linux/x86_64/ldconfig.h b/sysdeps/unix/sys= v/linux/x86_64/ldconfig.h > index 1089668f09..b3fa8ceebe 100644 > --- a/sysdeps/unix/sysv/linux/x86_64/ldconfig.h > +++ b/sysdeps/unix/sysv/linux/x86_64/ldconfig.h > @@ -16,11 +16,3 @@ > . */ >=20=20 > #include > - > -#define SYSDEP_KNOWN_INTERPRETER_NAMES \ > - { "/lib/ld-linux.so.2", FLAG_ELF_LIBC6 }, \ > - { "/libx32/ld-linux-x32.so.2", FLAG_ELF_LIBC6 }, \ > - { "/lib64/ld-linux-x86-64.so.2", FLAG_ELF_LIBC6 }, > -#define SYSDEP_KNOWN_LIBRARY_NAMES \ > - { "libc.so.6", FLAG_ELF_LIBC6 }, \ > - { "libm.so.6", FLAG_ELF_LIBC6 }, > --=20 > 2.31.1 >