From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oa1-x2d.google.com (mail-oa1-x2d.google.com [IPv6:2001:4860:4864:20::2d]) by sourceware.org (Postfix) with ESMTPS id 47440385B513 for ; Mon, 6 Mar 2023 19:16:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 47440385B513 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-oa1-x2d.google.com with SMTP id 586e51a60fabf-17638494edbso12526181fac.10 for ; Mon, 06 Mar 2023 11:16:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678130207; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=Pxn0AKxdxPLaioa0aHu7JYazun2JUJHV7J9I331OQYg=; b=CzR67yS6RtgCfNe6Ob78Btn/8cuqyXf4+/zseklN2bUqMcCU0yHYHkmJ98D/BIHx9Q g4EXUzfmK2T/BdyoaoDjcARjyZT2Ow998JRTxl87S8v9OjhUQQez7ou3Y7Y+ZPwzOqhJ Fw0cI8RD3SwWrWaJyHckuFe6jMuv5CnJdl6RJPgr/MkqwHbX97qsGezSZMUXTc376vcx 8IxFyPb/HsyIAEowg5ZL3m1ooWxUCzjxsz9Umd9kygulUpM/vtsvpwFERGRAkE6jXzUa Iw4PemhjsrZYAEDkQuj6DQDQqZn+IpU5ty2cwaB3NP8l3K82gdeJ0SRvQfi6Xx33nUmS nAEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678130207; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Pxn0AKxdxPLaioa0aHu7JYazun2JUJHV7J9I331OQYg=; b=UeuhxH25a4Zmxhq+8OHq1todZ9zVuenmNrpgITYvc803nNthFE8uXlc4F1TMdmA+2u wnLu74avIMHrAn2TH0wjLuTAZGEtmOjH449S0g8vyoBpAUIV4QmBUL6BVdWlgItgq3Uh /ghqOA8RgkIONznXDTEL9XehvRwYD2ArqtE1OWi1H9t1483HcjWFNAuECp4EAkO0ZGsh +HmohzFIMIxuDK1c4KeVFjZdIm8ZXqVGoQ5GDxLKFL1UWCrPJAAVjR11EPajUkStzumx //iOzD3LmSfbpa2f6IROkuzmLPvsGjop29X4GVYEi2HyIaDaqNH6qPkTLo31x28Xwlc7 hjcA== X-Gm-Message-State: AO0yUKVaoBt3PeEv1t8SNx7BAG+zclx1ovSnJYhfApAIt4TCw+HgIJdR 6VfmZURIVGjAKHChyLnor18gfQUw05lRr/xxW8KzUA== X-Google-Smtp-Source: AK7set+jYqPq8Z4YYmxwHKR7qFsy+XKu+3xnjmDrotsSGIlQ5anXgTq9i1YiH3hoByQrvv9draecYg== X-Received: by 2002:a05:6870:e2d6:b0:172:899a:e9a9 with SMTP id w22-20020a056870e2d600b00172899ae9a9mr7529061oad.4.1678130207114; Mon, 06 Mar 2023 11:16:47 -0800 (PST) Received: from mandiga.. ([2804:1b3:a7c3:d849:8c2f:e58d:3e6:9de5]) by smtp.gmail.com with ESMTPSA id zf29-20020a0568716a9d00b00176598b79d3sm4280668oab.24.2023.03.06.11.16.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Mar 2023 11:16:46 -0800 (PST) From: Adhemerval Zanella To: libc-alpha@sourceware.org, Florian Weimer , Carlos O'Donell Subject: [PATCH v5 0/5] Remove --with-default-link option Date: Mon, 6 Mar 2023 16:16:37 -0300 Message-Id: <20230306191642.347001-1-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-6.3 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: The vtables hardening is not enabled with --with-default-link=no (tst-relro-libc fails [1]) and with --with-default-link=yes it also requires ld.bfd to be available [2]. Furthermore, only lld 15 supports custom RELRO sections in linker script, even though older versions do support building glibc for some architectures. The patchset removes the --with-default-link by replacing libc_freeres_ptrs and libc_subfreeres with weak function calls, and by refactoring the vtables hardening with an array placed directly in the RELRO segment. [1] https://sourceware.org/bugzilla/show_bug.cgi?id=25812 [2] https://sourceware.org/git/?p=glibc.git;a=commit;h=2ae7990542e1955097aa21943e416dec70f867fa Changes from v4: - Do not autogenerate stdio_lim.h to avoid circula make dependency. Changes from v3: - Remove pragma weak diretive for IO_default* and IO_wdefault* symbols. Changes from v2: - Add pragma weak for weakly called function at malloc/set-freeres.c. - Remove IO_str*, IO_new_file*, and IO_old from pragma weak directive. Adhemerval Zanella Netto (5): Move libc_freeres_ptrs and libc_subfreeres to hidden/weak functions libio: Do not autogenerate stdio_lim.h libio: Remove the usage of __libc_IO_vtables Remove --with-default-link configure option Remove set-hooks.h from generic includes INSTALL | 6 - Makerules | 92 +--- Rules | 3 - config.make.in | 1 - configure | 13 - configure.ac | 7 - crypt/md5-crypt.c | 7 +- crypt/sha256-crypt.c | 7 +- crypt/sha512-crypt.c | 7 +- dlfcn/dlerror.h | 1 - elf/Makefile | 18 +- elf/dl-libc.c | 5 +- grp/fgetgrent.c | 5 +- gshadow/fgetsgent.c | 5 +- {include => hurd}/set-hooks.h | 0 iconv/gconv_cache.c | 3 +- iconv/gconv_conf.c | 3 +- iconv/gconv_db.c | 6 +- iconv/gconv_dl.c | 5 +- iconvdata/extra-module.mk | 2 +- include/libc-symbols.h | 91 +--- include/set-freeres.h | 142 ++++++ inet/getnameinfo.c | 5 +- inet/getnetgrent.c | 5 +- inet/rcmd.c | 5 +- inet/rexec.c | 5 +- intl/dcigettext.c | 3 +- intl/finddomain.c | 2 +- intl/loadmsgcat.c | 1 - intl/localealias.c | 15 +- libio/Makefile | 2 + libio/fcloseall.c | 1 + libio/fileops.c | 81 +-- libio/genops.c | 8 +- libio/iofopncook.c | 60 +-- libio/iopopen.c | 25 - libio/libio-macros.sym | 7 + libio/libioP.h | 137 ++++- libio/memstream.c | 32 +- libio/oldfileops.c | 23 - libio/oldiopopen.c | 23 - libio/stdio.c | 3 + libio/stdio.h | 19 +- libio/strfile.h | 2 - libio/strops.c | 24 - libio/tst-vtables-interposed.c | 5 + libio/vtables.c | 478 ++++++++++++++++++ libio/wfileops.c | 79 +-- libio/wmemstream.c | 32 +- libio/wstrops.c | 24 - locale/loadarchive.c | 2 +- locale/localeinfo.h | 4 +- locale/setlocale.c | 4 +- login/getutent.c | 5 +- login/getutid.c | 6 +- login/getutline.c | 5 +- malloc/set-freeres.c | 156 +++++- malloc/thread-freeres.c | 9 +- manual/install.texi | 6 - misc/efgcvt-template.c | 5 +- misc/efgcvt.c | 1 + misc/fstab.c | 3 +- misc/hsearch.c | 4 - misc/mntent.c | 5 +- misc/qefgcvt.c | 1 + misc/unwind-link.c | 2 +- nptl/nptlfreeres.c | 1 - nscd/nscd_getgr_r.c | 3 +- nscd/nscd_gethst_r.c | 3 +- nscd/nscd_getpw_r.c | 3 +- nscd/nscd_getserv_r.c | 3 +- nscd/nscd_netgroup.c | 3 +- nss/getXXbyYY.c | 7 +- nss/getXXent.c | 7 +- nss/nss_action.c | 2 +- nss/nss_action.h | 3 - nss/nss_database.c | 2 +- nss/nss_database.h | 3 - nss/nss_module.c | 2 +- nss/nss_module.h | 3 - posix/regcomp.c | 3 +- posix/register-atfork.c | 3 +- pwd/fgetpwent.c | 5 +- resolv/gai_misc.c | 6 +- resolv/res-close.c | 2 - resolv/res_hconf.c | 16 +- resolv/resolv-internal.h | 14 + resolv/resolv_conf.c | 3 +- resolv/tst-leaks2.c | 2 + rt/aio_misc.c | 6 +- shadow/fgetspent.c | 5 +- stdio-common/printf_buffer_as_file.c | 28 +- stdio-common/reg-modifier.c | 3 +- stdio-common/reg-printf.c | 6 +- stdio-common/reg-type.c | 6 +- stdio-common/wprintf_buffer_as_file.c | 28 +- stdlib/exit.c | 2 +- stdlib/fmtmsg.c | 3 +- stdlib/setenv.c | 3 +- sunrpc/clnt_perr.c | 4 +- sunrpc/rpc_thread.c | 1 - sunrpc/tst-svc_register.c | 6 +- sysdeps/generic/set-freeres-fp.h | 19 + sysdeps/generic/set-freeres-os.h | 19 + sysdeps/generic/set-freeres-system.h | 27 + .../ldbl-128ibm-compat/ieee128-qefgcvt.c | 1 + .../ldbl-128ibm-compat/set-freeres-fp.h | 22 + sysdeps/mach/hurd/bits/errno.h | 1 - .../mach/hurd/bits/stdio_lim.h | 17 +- sysdeps/posix/Makefile | 5 - sysdeps/posix/getaddrinfo.c | 5 +- sysdeps/posix/ttyname.c | 4 +- sysdeps/unix/sysv/linux/bits/stdio_lim.h | 28 + sysdeps/unix/sysv/linux/check_pf.c | 3 +- .../unix/sysv/linux/s390/s390-32/getutent.c | 1 + .../unix/sysv/linux/s390/s390-32/getutid.c | 1 + .../unix/sysv/linux/s390/s390-32/getutline.c | 1 + sysdeps/unix/sysv/linux/set-freeres-os.h | 24 + sysdeps/unix/sysv/linux/ttyname.c | 8 +- time/tzfile.c | 5 +- time/tzset.c | 3 +- 121 files changed, 1271 insertions(+), 876 deletions(-) rename {include => hurd}/set-hooks.h (100%) create mode 100644 include/set-freeres.h create mode 100644 libio/libio-macros.sym create mode 100644 sysdeps/generic/set-freeres-fp.h create mode 100644 sysdeps/generic/set-freeres-os.h create mode 100644 sysdeps/generic/set-freeres-system.h create mode 100644 sysdeps/ieee754/ldbl-128ibm-compat/set-freeres-fp.h rename stdio-common/stdio_lim.h.in => sysdeps/mach/hurd/bits/stdio_lim.h (72%) delete mode 100644 sysdeps/posix/Makefile create mode 100644 sysdeps/unix/sysv/linux/bits/stdio_lim.h create mode 100644 sysdeps/unix/sysv/linux/set-freeres-os.h -- 2.34.1