glibc: updated to version 2.39

This commit is contained in:
Juergen Daubert 2024-02-11 13:13:10 +01:00
parent d985f99de8
commit 6e87bd80b6
6 changed files with 60 additions and 2536 deletions

View File

@ -240,6 +240,7 @@ drwxr-xr-x root/root usr/include/bits/
-rw-r--r-- root/root usr/include/bits/netdb.h
-rw-r--r-- root/root usr/include/bits/param.h
drwxr-xr-x root/root usr/include/bits/platform/
-rw-r--r-- root/root usr/include/bits/platform/features.h
-rw-r--r-- root/root usr/include/bits/platform/x86.h
-rw-r--r-- root/root usr/include/bits/poll.h
-rw-r--r-- root/root usr/include/bits/poll2.h
@ -286,6 +287,7 @@ drwxr-xr-x root/root usr/include/bits/platform/
-rw-r--r-- root/root usr/include/bits/socket.h
-rw-r--r-- root/root usr/include/bits/socket2.h
-rw-r--r-- root/root usr/include/bits/socket_type.h
-rw-r--r-- root/root usr/include/bits/spawn_ext.h
-rw-r--r-- root/root usr/include/bits/ss_flags.h
-rw-r--r-- root/root usr/include/bits/stab.def
-rw-r--r-- root/root usr/include/bits/stat.h
@ -294,6 +296,7 @@ drwxr-xr-x root/root usr/include/bits/platform/
-rw-r--r-- root/root usr/include/bits/statx-generic.h
-rw-r--r-- root/root usr/include/bits/statx.h
-rw-r--r-- root/root usr/include/bits/stdint-intn.h
-rw-r--r-- root/root usr/include/bits/stdint-least.h
-rw-r--r-- root/root usr/include/bits/stdint-uintn.h
-rw-r--r-- root/root usr/include/bits/stdio-ldbl.h
-rw-r--r-- root/root usr/include/bits/stdio.h
@ -416,24 +419,21 @@ drwxr-xr-x root/root usr/include/drm/
-rw-r--r-- root/root usr/include/drm/drm_sarea.h
-rw-r--r-- root/root usr/include/drm/etnaviv_drm.h
-rw-r--r-- root/root usr/include/drm/exynos_drm.h
-rw-r--r-- root/root usr/include/drm/i810_drm.h
-rw-r--r-- root/root usr/include/drm/habanalabs_accel.h
-rw-r--r-- root/root usr/include/drm/i915_drm.h
-rw-r--r-- root/root usr/include/drm/ivpu_accel.h
-rw-r--r-- root/root usr/include/drm/lima_drm.h
-rw-r--r-- root/root usr/include/drm/mga_drm.h
-rw-r--r-- root/root usr/include/drm/msm_drm.h
-rw-r--r-- root/root usr/include/drm/nouveau_drm.h
-rw-r--r-- root/root usr/include/drm/omap_drm.h
-rw-r--r-- root/root usr/include/drm/panfrost_drm.h
-rw-r--r-- root/root usr/include/drm/qaic_accel.h
-rw-r--r-- root/root usr/include/drm/qxl_drm.h
-rw-r--r-- root/root usr/include/drm/r128_drm.h
-rw-r--r-- root/root usr/include/drm/radeon_drm.h
-rw-r--r-- root/root usr/include/drm/savage_drm.h
-rw-r--r-- root/root usr/include/drm/sis_drm.h
-rw-r--r-- root/root usr/include/drm/tegra_drm.h
-rw-r--r-- root/root usr/include/drm/v3d_drm.h
-rw-r--r-- root/root usr/include/drm/vc4_drm.h
-rw-r--r-- root/root usr/include/drm/vgem_drm.h
-rw-r--r-- root/root usr/include/drm/via_drm.h
-rw-r--r-- root/root usr/include/drm/virtgpu_drm.h
-rw-r--r-- root/root usr/include/drm/vmwgfx_drm.h
-rw-r--r-- root/root usr/include/elf.h
@ -496,6 +496,7 @@ drwxr-xr-x root/root usr/include/linux/android/
-rw-r--r-- root/root usr/include/linux/arm_sdei.h
-rw-r--r-- root/root usr/include/linux/aspeed-lpc-ctrl.h
-rw-r--r-- root/root usr/include/linux/aspeed-p2a-ctrl.h
-rw-r--r-- root/root usr/include/linux/aspeed-video.h
-rw-r--r-- root/root usr/include/linux/atalk.h
-rw-r--r-- root/root usr/include/linux/atm.h
-rw-r--r-- root/root usr/include/linux/atm_eni.h
@ -572,7 +573,6 @@ drwxr-xr-x root/root usr/include/linux/cifs/
-rw-r--r-- root/root usr/include/linux/cifs/cifs_mount.h
-rw-r--r-- root/root usr/include/linux/cifs/cifs_netlink.h
-rw-r--r-- root/root usr/include/linux/close_range.h
-rw-r--r-- root/root usr/include/linux/cm4000_cs.h
-rw-r--r-- root/root usr/include/linux/cn_proc.h
-rw-r--r-- root/root usr/include/linux/coda.h
-rw-r--r-- root/root usr/include/linux/coff.h
@ -592,7 +592,6 @@ drwxr-xr-x root/root usr/include/linux/cifs/
-rw-r--r-- root/root usr/include/linux/devlink.h
-rw-r--r-- root/root usr/include/linux/dlm.h
-rw-r--r-- root/root usr/include/linux/dlm_device.h
-rw-r--r-- root/root usr/include/linux/dlm_netlink.h
-rw-r--r-- root/root usr/include/linux/dlm_plock.h
-rw-r--r-- root/root usr/include/linux/dlmconstants.h
-rw-r--r-- root/root usr/include/linux/dm-ioctl.h
@ -621,7 +620,9 @@ drwxr-xr-x root/root usr/include/linux/dvb/
-rw-r--r-- root/root usr/include/linux/erspan.h
-rw-r--r-- root/root usr/include/linux/ethtool.h
-rw-r--r-- root/root usr/include/linux/ethtool_netlink.h
-rw-r--r-- root/root usr/include/linux/eventfd.h
-rw-r--r-- root/root usr/include/linux/eventpoll.h
-rw-r--r-- root/root usr/include/linux/ext4.h
-rw-r--r-- root/root usr/include/linux/f2fs.h
-rw-r--r-- root/root usr/include/linux/fadvise.h
-rw-r--r-- root/root usr/include/linux/falloc.h
@ -655,6 +656,7 @@ drwxr-xr-x root/root usr/include/linux/genwqe/
-rw-r--r-- root/root usr/include/linux/gpio.h
-rw-r--r-- root/root usr/include/linux/gsmmux.h
-rw-r--r-- root/root usr/include/linux/gtp.h
-rw-r--r-- root/root usr/include/linux/handshake.h
-rw-r--r-- root/root usr/include/linux/hash_info.h
-rw-r--r-- root/root usr/include/linux/hdlc.h
drwxr-xr-x root/root usr/include/linux/hdlc/
@ -729,6 +731,7 @@ drwxr-xr-x root/root usr/include/linux/iio/
-rw-r--r-- root/root usr/include/linux/ioam6_iptunnel.h
-rw-r--r-- root/root usr/include/linux/ioctl.h
-rw-r--r-- root/root usr/include/linux/iommu.h
-rw-r--r-- root/root usr/include/linux/iommufd.h
-rw-r--r-- root/root usr/include/linux/ioprio.h
-rw-r--r-- root/root usr/include/linux/ip.h
-rw-r--r-- root/root usr/include/linux/ip6_tunnel.h
@ -737,6 +740,7 @@ drwxr-xr-x root/root usr/include/linux/iio/
-rw-r--r-- root/root usr/include/linux/ipmi.h
-rw-r--r-- root/root usr/include/linux/ipmi_bmc.h
-rw-r--r-- root/root usr/include/linux/ipmi_msgdefs.h
-rw-r--r-- root/root usr/include/linux/ipmi_ssif_bmc.h
-rw-r--r-- root/root usr/include/linux/ipsec.h
-rw-r--r-- root/root usr/include/linux/ipv6.h
-rw-r--r-- root/root usr/include/linux/ipv6_route.h
@ -785,10 +789,10 @@ drwxr-xr-x root/root usr/include/linux/isdn/
-rw-r--r-- root/root usr/include/linux/media-bus-format.h
-rw-r--r-- root/root usr/include/linux/media.h
-rw-r--r-- root/root usr/include/linux/mei.h
-rw-r--r-- root/root usr/include/linux/mei_uuid.h
-rw-r--r-- root/root usr/include/linux/membarrier.h
-rw-r--r-- root/root usr/include/linux/memfd.h
-rw-r--r-- root/root usr/include/linux/mempolicy.h
-rw-r--r-- root/root usr/include/linux/meye.h
-rw-r--r-- root/root usr/include/linux/mii.h
-rw-r--r-- root/root usr/include/linux/minix_fs.h
drwxr-xr-x root/root usr/include/linux/misc/
@ -819,6 +823,7 @@ drwxr-xr-x root/root usr/include/linux/mmc/
-rw-r--r-- root/root usr/include/linux/net_namespace.h
-rw-r--r-- root/root usr/include/linux/net_tstamp.h
-rw-r--r-- root/root usr/include/linux/netconf.h
-rw-r--r-- root/root usr/include/linux/netdev.h
-rw-r--r-- root/root usr/include/linux/netdevice.h
-rw-r--r-- root/root usr/include/linux/netfilter.h
drwxr-xr-x root/root usr/include/linux/netfilter/
@ -1031,6 +1036,7 @@ drwxr-xr-x root/root usr/include/linux/nfsd/
-rw-r--r-- root/root usr/include/linux/prctl.h
-rw-r--r-- root/root usr/include/linux/psample.h
-rw-r--r-- root/root usr/include/linux/psci.h
-rw-r--r-- root/root usr/include/linux/psp-dbc.h
-rw-r--r-- root/root usr/include/linux/psp-sev.h
-rw-r--r-- root/root usr/include/linux/ptp_clock.h
-rw-r--r-- root/root usr/include/linux/ptrace.h
@ -1150,6 +1156,7 @@ drwxr-xr-x root/root usr/include/linux/tc_ematch/
-rw-r--r-- root/root usr/include/linux/tc_ematch/tc_em_text.h
-rw-r--r-- root/root usr/include/linux/tcp.h
-rw-r--r-- root/root usr/include/linux/tcp_metrics.h
-rw-r--r-- root/root usr/include/linux/tdx-guest.h
-rw-r--r-- root/root usr/include/linux/tee.h
-rw-r--r-- root/root usr/include/linux/termios.h
-rw-r--r-- root/root usr/include/linux/thermal.h
@ -1165,6 +1172,7 @@ drwxr-xr-x root/root usr/include/linux/tc_ematch/
-rw-r--r-- root/root usr/include/linux/tipc_sockets_diag.h
-rw-r--r-- root/root usr/include/linux/tls.h
-rw-r--r-- root/root usr/include/linux/toshiba.h
-rw-r--r-- root/root usr/include/linux/tps6594_pfsm.h
-rw-r--r-- root/root usr/include/linux/tty.h
-rw-r--r-- root/root usr/include/linux/tty_flags.h
-rw-r--r-- root/root usr/include/linux/types.h
@ -1198,6 +1206,7 @@ drwxr-xr-x root/root usr/include/linux/usb/
-rw-r--r-- root/root usr/include/linux/usb/video.h
-rw-r--r-- root/root usr/include/linux/usbdevice_fs.h
-rw-r--r-- root/root usr/include/linux/usbip.h
-rw-r--r-- root/root usr/include/linux/user_events.h
-rw-r--r-- root/root usr/include/linux/userfaultfd.h
-rw-r--r-- root/root usr/include/linux/userio.h
-rw-r--r-- root/root usr/include/linux/utime.h
@ -1277,7 +1286,6 @@ drwxr-xr-x root/root usr/include/linux/usb/
drwxr-xr-x root/root usr/include/misc/
-rw-r--r-- root/root usr/include/misc/cxl.h
-rw-r--r-- root/root usr/include/misc/fastrpc.h
-rw-r--r-- root/root usr/include/misc/habanalabs.h
-rw-r--r-- root/root usr/include/misc/ocxl.h
-rw-r--r-- root/root usr/include/misc/pvpanic.h
drwxr-xr-x root/root usr/include/misc/uacce/
@ -1369,6 +1377,7 @@ drwxr-xr-x root/root usr/include/rdma/hfi/
-rw-r--r-- root/root usr/include/rdma/ib_user_sa.h
-rw-r--r-- root/root usr/include/rdma/ib_user_verbs.h
-rw-r--r-- root/root usr/include/rdma/irdma-abi.h
-rw-r--r-- root/root usr/include/rdma/mana-abi.h
-rw-r--r-- root/root usr/include/rdma/mlx4-abi.h
-rw-r--r-- root/root usr/include/rdma/mlx5-abi.h
-rw-r--r-- root/root usr/include/rdma/mlx5_user_ioctl_cmds.h
@ -1440,6 +1449,7 @@ drwxr-xr-x root/root usr/include/sound/sof/
-rw-r--r-- root/root usr/include/sound/usb_stream.h
-rw-r--r-- root/root usr/include/spawn.h
-rw-r--r-- root/root usr/include/stab.h
-rw-r--r-- root/root usr/include/stdbit.h
-rw-r--r-- root/root usr/include/stdc-predef.h
-rw-r--r-- root/root usr/include/stdint.h
-rw-r--r-- root/root usr/include/stdio.h
@ -1846,7 +1856,7 @@ lrwxrwxrwx root/root usr/lib/libc_malloc_debug.so -> ../../lib/libc_malloc_debug
-rw-r--r-- root/root usr/lib/libc_nonshared.a
-rw-r--r-- root/root usr/lib/libdl.a
-rw-r--r-- root/root usr/lib/libg.a
-rw-r--r-- root/root usr/lib/libm-2.38.a
-rw-r--r-- root/root usr/lib/libm-2.39.a
-rw-r--r-- root/root usr/lib/libm.a
-rw-r--r-- root/root usr/lib/libm.so
-rw-r--r-- root/root usr/lib/libmcheck.a
@ -2122,7 +2132,6 @@ drwxr-xr-x root/root usr/share/i18n/locales/
-rw-r--r-- root/root usr/share/i18n/locales/POSIX
-rw-r--r-- root/root usr/share/i18n/locales/aa_DJ
-rw-r--r-- root/root usr/share/i18n/locales/aa_ER
-rw-r--r-- root/root usr/share/i18n/locales/aa_ER@saaho
-rw-r--r-- root/root usr/share/i18n/locales/aa_ET
-rw-r--r-- root/root usr/share/i18n/locales/ab_GE
-rw-r--r-- root/root usr/share/i18n/locales/af_ZA
@ -2185,6 +2194,7 @@ drwxr-xr-x root/root usr/share/i18n/locales/
-rw-r--r-- root/root usr/share/i18n/locales/ckb_IQ
-rw-r--r-- root/root usr/share/i18n/locales/cmn_TW
-rw-r--r-- root/root usr/share/i18n/locales/cns11643_stroke
-rw-r--r-- root/root usr/share/i18n/locales/crh_RU
-rw-r--r-- root/root usr/share/i18n/locales/crh_UA
-rw-r--r-- root/root usr/share/i18n/locales/cs_CZ
-rw-r--r-- root/root usr/share/i18n/locales/csb_PL
@ -2274,6 +2284,7 @@ drwxr-xr-x root/root usr/share/i18n/locales/
-rw-r--r-- root/root usr/share/i18n/locales/fy_NL
-rw-r--r-- root/root usr/share/i18n/locales/ga_IE
-rw-r--r-- root/root usr/share/i18n/locales/ga_IE@euro
-rw-r--r-- root/root usr/share/i18n/locales/gbm_IN
-rw-r--r-- root/root usr/share/i18n/locales/gd_GB
-rw-r--r-- root/root usr/share/i18n/locales/gez_ER
-rw-r--r-- root/root usr/share/i18n/locales/gez_ER@abegede
@ -2320,6 +2331,7 @@ drwxr-xr-x root/root usr/share/i18n/locales/
-rw-r--r-- root/root usr/share/i18n/locales/ks_IN
-rw-r--r-- root/root usr/share/i18n/locales/ks_IN@devanagari
-rw-r--r-- root/root usr/share/i18n/locales/ku_TR
-rw-r--r-- root/root usr/share/i18n/locales/kv_RU
-rw-r--r-- root/root usr/share/i18n/locales/kw_GB
-rw-r--r-- root/root usr/share/i18n/locales/ky_KG
-rw-r--r-- root/root usr/share/i18n/locales/lb_LU
@ -2413,7 +2425,9 @@ drwxr-xr-x root/root usr/share/i18n/locales/
-rw-r--r-- root/root usr/share/i18n/locales/sr_RS
-rw-r--r-- root/root usr/share/i18n/locales/sr_RS@latin
-rw-r--r-- root/root usr/share/i18n/locales/ss_ZA
-rw-r--r-- root/root usr/share/i18n/locales/ssy_ER
-rw-r--r-- root/root usr/share/i18n/locales/st_ZA
-rw-r--r-- root/root usr/share/i18n/locales/su_ID
-rw-r--r-- root/root usr/share/i18n/locales/sv_FI
-rw-r--r-- root/root usr/share/i18n/locales/sv_FI@euro
-rw-r--r-- root/root usr/share/i18n/locales/sv_SE
@ -2435,6 +2449,7 @@ drwxr-xr-x root/root usr/share/i18n/locales/
-rw-r--r-- root/root usr/share/i18n/locales/tl_PH
-rw-r--r-- root/root usr/share/i18n/locales/tn_ZA
-rw-r--r-- root/root usr/share/i18n/locales/to_TO
-rw-r--r-- root/root usr/share/i18n/locales/tok
-rw-r--r-- root/root usr/share/i18n/locales/tpi_PG
-rw-r--r-- root/root usr/share/i18n/locales/tr_CY
-rw-r--r-- root/root usr/share/i18n/locales/tr_TR
@ -2443,6 +2458,7 @@ drwxr-xr-x root/root usr/share/i18n/locales/
-rw-r--r-- root/root usr/share/i18n/locales/translit_cjk_variants
-rw-r--r-- root/root usr/share/i18n/locales/translit_combining
-rw-r--r-- root/root usr/share/i18n/locales/translit_compat
-rw-r--r-- root/root usr/share/i18n/locales/translit_emojis
-rw-r--r-- root/root usr/share/i18n/locales/translit_font
-rw-r--r-- root/root usr/share/i18n/locales/translit_fraction
-rw-r--r-- root/root usr/share/i18n/locales/translit_hangul
@ -2472,6 +2488,7 @@ drwxr-xr-x root/root usr/share/i18n/locales/
-rw-r--r-- root/root usr/share/i18n/locales/yo_NG
-rw-r--r-- root/root usr/share/i18n/locales/yue_HK
-rw-r--r-- root/root usr/share/i18n/locales/yuw_PG
-rw-r--r-- root/root usr/share/i18n/locales/zgh_MA
-rw-r--r-- root/root usr/share/i18n/locales/zh_CN
-rw-r--r-- root/root usr/share/i18n/locales/zh_HK
-rw-r--r-- root/root usr/share/i18n/locales/zh_SG

View File

@ -1,11 +1,10 @@
untrusted comment: verify with /etc/ports/core.pub
RWRJc1FUaeVeqmr+T7gyU7xjK/x66w91Q3sWOM0YBdvWyBU+b5KQ7gY1AP963ugeT9bRN7yP3IuWzk+HBBpJedWUWG0XZFeoDg4=
SHA256 (Pkgfile) = f4672b4be5b2588cc532d557732e5fc2e27975c514d4c12211d29c53710861c7
SHA256 (.footprint) = 8ca795cbdb4d5aa0cd5d4ecff33f605b6fdd41455252a0825dadc36daa1e9597
SHA256 (glibc-2.38.tar.xz) = fb82998998b2b29965467bc1b69d152e9c307d2cf301c9eafb4555b770ef3fd2
SHA256 (linux-6.1.46.tar.xz) = f5f67bcfccd47f8d9db2d5ba24e33af7778f40a777577d1fba424f4a1712a296
SHA256 (glibc-2.38-1.patch) = 65627cd20480dada7311f68d11dcfb4167fbea9b4c1829f2c694a4d794f14c9a
SHA256 (glibc-2.38-fhs-1.patch) = 643552db030e2f2d7ffde4f558e0f5f83d3fabf34a2e0e56ebdb49750ac27b0d
RWRJc1FUaeVeqmXIr2yabyPq13IbmM7woeIPZCtZNcjejGfFJ2LZUjDmQw285vNHlTM6YgfIcs9vsAUs/K6xpWivXc/PYstGUQg=
SHA256 (Pkgfile) = dfc371a23dab3f83b5afa2a4b1e94b97cbf7ea95231ea442d8f393f1c66dbda1
SHA256 (.footprint) = 0a37ea4c1e48f2d36e61e7ce20c9611e95c173c2b79c5d82cd86c463cc300e01
SHA256 (glibc-2.39.tar.xz) = f77bd47cf8170c57365ae7bf86696c118adb3b120d3259c64c502d3dc1e2d926
SHA256 (linux-6.6.16.tar.xz) = b21d5795a3bead4f112916423222faa8a0f519e4201df343e3eb88dc9e4aaa30
SHA256 (glibc-2.39-fhs-1.patch) = cbcece806ae8469fa3693fd181290b57045722b304cd2dd2a1cf3e160554f203
SHA256 (hosts) = 5c02b256c105f1d4a12fb738d71c1bab9eb126533074d7a0c8a14b92670c9431
SHA256 (resolv.conf) = 72ccb58768a72a771ec37142bc361a18478a07ec9de6e925a20760794389bf51
SHA256 (nsswitch.conf) = 859b8984e5e90aff3cce8f9779996ae4033b280d2122840e9411e2f44a1c2e61

View File

@ -3,14 +3,14 @@
# Maintainer: CRUX System Team, core-ports at crux dot nu
name=glibc
version=2.38
release=2
_kernel_version=6.1.46
version=2.39
release=1
_kernel_version=6.6.16
source=(https://ftp.gnu.org/gnu/glibc/glibc-$version.tar.xz
https://www.kernel.org/pub/linux/kernel/v6.x/linux-$_kernel_version.tar.xz
glibc-$version-1.patch
glibc-2.38-fhs-1.patch
#glibc-$version-1.patch
glibc-2.39-fhs-1.patch
hosts resolv.conf nsswitch.conf host.conf ld.so.conf
locale-gen locale.gen.in)
@ -20,8 +20,8 @@ build() {
make -C $SRC/linux-$_kernel_version INSTALL_HDR_PATH=$PKG/usr headers_install
chown root:root $PKG/usr
patch -p1 -d $SRC/$name-${version:0:4} -i $SRC/$name-$version-1.patch
patch -p1 -d $SRC/$name-${version:0:4} -i $SRC/glibc-2.38-fhs-1.patch
#patch -p1 -d $SRC/$name-${version:0:4} -i $SRC/$name-$version-1.patch
patch -p1 -d $SRC/$name-${version:0:4} -i $SRC/glibc-2.39-fhs-1.patch
mkdir $SRC/build
cd $SRC/build

File diff suppressed because it is too large Load Diff

View File

@ -1,585 +0,0 @@
Submitted By: Xi Ruoyao <xry111 at xry111.site>
Date: 2023-08-13
Initial Package Version: 2.38
Upstream Status: Under review
Origin: Upstream & Self
- 1/3: https://sourceware.org/git/?p=glibc.git;a=patch;h=542b11058525
- 2/3: https://sourceware.org/pipermail/libc-alpha/2023-August/150857.html
- 3/3: Trivial unused code removal
Description: Fixes a regression causing posix_memalign()
very slow in certain conditions to avoid
breaking ffmpeg-based applications.
From fc01478d06658ace8d57e5328c1e717275acfe84 Mon Sep 17 00:00:00 2001
From: Florian Weimer <fweimer@redhat.com>
Date: Fri, 11 Aug 2023 11:18:17 +0200
Subject: [PATCH 1/3] malloc: Enable merging of remainders in memalign (bug
30723)
Previously, calling _int_free from _int_memalign could put remainders
into the tcache or into fastbins, where they are invisible to the
low-level allocator. This results in missed merge opportunities
because once these freed chunks become available to the low-level
allocator, further memalign allocations (even of the same size are)
likely obstructing merges.
Furthermore, during forwards merging in _int_memalign, do not
completely give up when the remainder is too small to serve as a
chunk on its own. We can still give it back if it can be merged
with the following unused chunk. This makes it more likely that
memalign calls in a loop achieve a compact memory layout,
independently of initial heap layout.
Drop some useless (unsigned long) casts along the way, and tweak
the style to more closely match GNU on changed lines.
Reviewed-by: DJ Delorie <dj@redhat.com>
(cherry picked from commit 542b1105852568c3ebc712225ae78b8c8ba31a78)
---
malloc/malloc.c | 197 +++++++++++++++++++++++++++++-------------------
1 file changed, 121 insertions(+), 76 deletions(-)
diff --git a/malloc/malloc.c b/malloc/malloc.c
index e2f1a615a4..948f9759af 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -1086,6 +1086,11 @@ typedef struct malloc_chunk* mchunkptr;
static void* _int_malloc(mstate, size_t);
static void _int_free(mstate, mchunkptr, int);
+static void _int_free_merge_chunk (mstate, mchunkptr, INTERNAL_SIZE_T);
+static INTERNAL_SIZE_T _int_free_create_chunk (mstate,
+ mchunkptr, INTERNAL_SIZE_T,
+ mchunkptr, INTERNAL_SIZE_T);
+static void _int_free_maybe_consolidate (mstate, INTERNAL_SIZE_T);
static void* _int_realloc(mstate, mchunkptr, INTERNAL_SIZE_T,
INTERNAL_SIZE_T);
static void* _int_memalign(mstate, size_t, size_t);
@@ -4637,31 +4642,52 @@ _int_free (mstate av, mchunkptr p, int have_lock)
if (!have_lock)
__libc_lock_lock (av->mutex);
- nextchunk = chunk_at_offset(p, size);
-
- /* Lightweight tests: check whether the block is already the
- top block. */
- if (__glibc_unlikely (p == av->top))
- malloc_printerr ("double free or corruption (top)");
- /* Or whether the next chunk is beyond the boundaries of the arena. */
- if (__builtin_expect (contiguous (av)
- && (char *) nextchunk
- >= ((char *) av->top + chunksize(av->top)), 0))
- malloc_printerr ("double free or corruption (out)");
- /* Or whether the block is actually not marked used. */
- if (__glibc_unlikely (!prev_inuse(nextchunk)))
- malloc_printerr ("double free or corruption (!prev)");
-
- nextsize = chunksize(nextchunk);
- if (__builtin_expect (chunksize_nomask (nextchunk) <= CHUNK_HDR_SZ, 0)
- || __builtin_expect (nextsize >= av->system_mem, 0))
- malloc_printerr ("free(): invalid next size (normal)");
+ _int_free_merge_chunk (av, p, size);
- free_perturb (chunk2mem(p), size - CHUNK_HDR_SZ);
+ if (!have_lock)
+ __libc_lock_unlock (av->mutex);
+ }
+ /*
+ If the chunk was allocated via mmap, release via munmap().
+ */
+
+ else {
+ munmap_chunk (p);
+ }
+}
+
+/* Try to merge chunk P of SIZE bytes with its neighbors. Put the
+ resulting chunk on the appropriate bin list. P must not be on a
+ bin list yet, and it can be in use. */
+static void
+_int_free_merge_chunk (mstate av, mchunkptr p, INTERNAL_SIZE_T size)
+{
+ mchunkptr nextchunk = chunk_at_offset(p, size);
+
+ /* Lightweight tests: check whether the block is already the
+ top block. */
+ if (__glibc_unlikely (p == av->top))
+ malloc_printerr ("double free or corruption (top)");
+ /* Or whether the next chunk is beyond the boundaries of the arena. */
+ if (__builtin_expect (contiguous (av)
+ && (char *) nextchunk
+ >= ((char *) av->top + chunksize(av->top)), 0))
+ malloc_printerr ("double free or corruption (out)");
+ /* Or whether the block is actually not marked used. */
+ if (__glibc_unlikely (!prev_inuse(nextchunk)))
+ malloc_printerr ("double free or corruption (!prev)");
+
+ INTERNAL_SIZE_T nextsize = chunksize(nextchunk);
+ if (__builtin_expect (chunksize_nomask (nextchunk) <= CHUNK_HDR_SZ, 0)
+ || __builtin_expect (nextsize >= av->system_mem, 0))
+ malloc_printerr ("free(): invalid next size (normal)");
+
+ free_perturb (chunk2mem(p), size - CHUNK_HDR_SZ);
- /* consolidate backward */
- if (!prev_inuse(p)) {
- prevsize = prev_size (p);
+ /* Consolidate backward. */
+ if (!prev_inuse(p))
+ {
+ INTERNAL_SIZE_T prevsize = prev_size (p);
size += prevsize;
p = chunk_at_offset(p, -((long) prevsize));
if (__glibc_unlikely (chunksize(p) != prevsize))
@@ -4669,9 +4695,25 @@ _int_free (mstate av, mchunkptr p, int have_lock)
unlink_chunk (av, p);
}
- if (nextchunk != av->top) {
+ /* Write the chunk header, maybe after merging with the following chunk. */
+ size = _int_free_create_chunk (av, p, size, nextchunk, nextsize);
+ _int_free_maybe_consolidate (av, size);
+}
+
+/* Create a chunk at P of SIZE bytes, with SIZE potentially increased
+ to cover the immediately following chunk NEXTCHUNK of NEXTSIZE
+ bytes (if NEXTCHUNK is unused). The chunk at P is not actually
+ read and does not have to be initialized. After creation, it is
+ placed on the appropriate bin list. The function returns the size
+ of the new chunk. */
+static INTERNAL_SIZE_T
+_int_free_create_chunk (mstate av, mchunkptr p, INTERNAL_SIZE_T size,
+ mchunkptr nextchunk, INTERNAL_SIZE_T nextsize)
+{
+ if (nextchunk != av->top)
+ {
/* get and clear inuse bit */
- nextinuse = inuse_bit_at_offset(nextchunk, nextsize);
+ bool nextinuse = inuse_bit_at_offset (nextchunk, nextsize);
/* consolidate forward */
if (!nextinuse) {
@@ -4686,8 +4728,8 @@ _int_free (mstate av, mchunkptr p, int have_lock)
been given one chance to be used in malloc.
*/
- bck = unsorted_chunks(av);
- fwd = bck->fd;
+ mchunkptr bck = unsorted_chunks (av);
+ mchunkptr fwd = bck->fd;
if (__glibc_unlikely (fwd->bk != bck))
malloc_printerr ("free(): corrupted unsorted chunks");
p->fd = fwd;
@@ -4706,61 +4748,52 @@ _int_free (mstate av, mchunkptr p, int have_lock)
check_free_chunk(av, p);
}
- /*
- If the chunk borders the current high end of memory,
- consolidate into top
- */
-
- else {
+ else
+ {
+ /* If the chunk borders the current high end of memory,
+ consolidate into top. */
size += nextsize;
set_head(p, size | PREV_INUSE);
av->top = p;
check_chunk(av, p);
}
- /*
- If freeing a large space, consolidate possibly-surrounding
- chunks. Then, if the total unused topmost memory exceeds trim
- threshold, ask malloc_trim to reduce top.
-
- Unless max_fast is 0, we don't know if there are fastbins
- bordering top, so we cannot tell for sure whether threshold
- has been reached unless fastbins are consolidated. But we
- don't want to consolidate on each free. As a compromise,
- consolidation is performed if FASTBIN_CONSOLIDATION_THRESHOLD
- is reached.
- */
+ return size;
+}
- if ((unsigned long)(size) >= FASTBIN_CONSOLIDATION_THRESHOLD) {
+/* If freeing a large space, consolidate possibly-surrounding
+ chunks. Then, if the total unused topmost memory exceeds trim
+ threshold, ask malloc_trim to reduce top. */
+static void
+_int_free_maybe_consolidate (mstate av, INTERNAL_SIZE_T size)
+{
+ /* Unless max_fast is 0, we don't know if there are fastbins
+ bordering top, so we cannot tell for sure whether threshold has
+ been reached unless fastbins are consolidated. But we don't want
+ to consolidate on each free. As a compromise, consolidation is
+ performed if FASTBIN_CONSOLIDATION_THRESHOLD is reached. */
+ if (size >= FASTBIN_CONSOLIDATION_THRESHOLD)
+ {
if (atomic_load_relaxed (&av->have_fastchunks))
malloc_consolidate(av);
- if (av == &main_arena) {
+ if (av == &main_arena)
+ {
#ifndef MORECORE_CANNOT_TRIM
- if ((unsigned long)(chunksize(av->top)) >=
- (unsigned long)(mp_.trim_threshold))
- systrim(mp_.top_pad, av);
+ if (chunksize (av->top) >= mp_.trim_threshold)
+ systrim (mp_.top_pad, av);
#endif
- } else {
- /* Always try heap_trim(), even if the top chunk is not
- large, because the corresponding heap might go away. */
- heap_info *heap = heap_for_ptr(top(av));
+ }
+ else
+ {
+ /* Always try heap_trim, even if the top chunk is not large,
+ because the corresponding heap might go away. */
+ heap_info *heap = heap_for_ptr (top (av));
- assert(heap->ar_ptr == av);
- heap_trim(heap, mp_.top_pad);
- }
+ assert (heap->ar_ptr == av);
+ heap_trim (heap, mp_.top_pad);
+ }
}
-
- if (!have_lock)
- __libc_lock_unlock (av->mutex);
- }
- /*
- If the chunk was allocated via mmap, release via munmap().
- */
-
- else {
- munmap_chunk (p);
- }
}
/*
@@ -5221,7 +5254,7 @@ _int_memalign (mstate av, size_t alignment, size_t bytes)
(av != &main_arena ? NON_MAIN_ARENA : 0));
set_inuse_bit_at_offset (newp, newsize);
set_head_size (p, leadsize | (av != &main_arena ? NON_MAIN_ARENA : 0));
- _int_free (av, p, 1);
+ _int_free_merge_chunk (av, p, leadsize);
p = newp;
assert (newsize >= nb &&
@@ -5232,15 +5265,27 @@ _int_memalign (mstate av, size_t alignment, size_t bytes)
if (!chunk_is_mmapped (p))
{
size = chunksize (p);
- if ((unsigned long) (size) > (unsigned long) (nb + MINSIZE))
+ mchunkptr nextchunk = chunk_at_offset(p, size);
+ INTERNAL_SIZE_T nextsize = chunksize(nextchunk);
+ if (size > nb)
{
remainder_size = size - nb;
- remainder = chunk_at_offset (p, nb);
- set_head (remainder, remainder_size | PREV_INUSE |
- (av != &main_arena ? NON_MAIN_ARENA : 0));
- set_head_size (p, nb);
- _int_free (av, remainder, 1);
- }
+ if (remainder_size >= MINSIZE
+ || nextchunk == av->top
+ || !inuse_bit_at_offset (nextchunk, nextsize))
+ {
+ /* We can only give back the tail if it is larger than
+ MINSIZE, or if the following chunk is unused (top
+ chunk or unused in-heap chunk). Otherwise we would
+ create a chunk that is smaller than MINSIZE. */
+ remainder = chunk_at_offset (p, nb);
+ set_head_size (p, nb);
+ remainder_size = _int_free_create_chunk (av, remainder,
+ remainder_size,
+ nextchunk, nextsize);
+ _int_free_maybe_consolidate (av, remainder_size);
+ }
+ }
}
check_inuse_chunk (av, p);
--
2.41.0
From b37e836b7cc2dba672e1de1cc7e076ba1c712614 Mon Sep 17 00:00:00 2001
From: Florian Weimer <fweimer@redhat.com>
Date: Fri, 11 Aug 2023 17:48:13 +0200
Subject: [PATCH 2/3] malloc: Remove bin scanning from memalign (bug 30723)
On the test workload (mpv --cache=yes with VP9 video decoding), the
bin scanning has a very poor success rate (less than 2%). The tcache
scanning has about 50% success rate, so keep that.
Update comments in malloc/tst-memalign-2 to indicate the purpose
of the tests. Even with the scanning removed, the additional
merging opportunities since commit 542b1105852568c3ebc712225ae78b
("malloc: Enable merging of remainders in memalign (bug 30723)")
are sufficient to pass the existing large bins test.
Link: https://sourceware.org/pipermail/libc-alpha/2023-August/150857.html
---
malloc/malloc.c | 127 ++--------------------------------------
malloc/tst-memalign-2.c | 7 ++-
2 files changed, 10 insertions(+), 124 deletions(-)
diff --git a/malloc/malloc.c b/malloc/malloc.c
index 948f9759af..9c2cab7a59 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -5082,7 +5082,6 @@ _int_memalign (mstate av, size_t alignment, size_t bytes)
mchunkptr remainder; /* spare room at end to split off */
unsigned long remainder_size; /* its size */
INTERNAL_SIZE_T size;
- mchunkptr victim;
nb = checked_request2size (bytes);
if (nb == 0)
@@ -5101,129 +5100,13 @@ _int_memalign (mstate av, size_t alignment, size_t bytes)
we don't find anything in those bins, the common malloc code will
scan starting at 2x. */
- /* This will be set if we found a candidate chunk. */
- victim = NULL;
+ /* Call malloc with worst case padding to hit alignment. */
+ m = (char *) (_int_malloc (av, nb + alignment + MINSIZE));
- /* Fast bins are singly-linked, hard to remove a chunk from the middle
- and unlikely to meet our alignment requirements. We have not done
- any experimentation with searching for aligned fastbins. */
+ if (m == 0)
+ return 0; /* propagate failure */
- if (av != NULL)
- {
- int first_bin_index;
- int first_largebin_index;
- int last_bin_index;
-
- if (in_smallbin_range (nb))
- first_bin_index = smallbin_index (nb);
- else
- first_bin_index = largebin_index (nb);
-
- if (in_smallbin_range (nb * 2))
- last_bin_index = smallbin_index (nb * 2);
- else
- last_bin_index = largebin_index (nb * 2);
-
- first_largebin_index = largebin_index (MIN_LARGE_SIZE);
-
- int victim_index; /* its bin index */
-
- for (victim_index = first_bin_index;
- victim_index < last_bin_index;
- victim_index ++)
- {
- victim = NULL;
-
- if (victim_index < first_largebin_index)
- {
- /* Check small bins. Small bin chunks are doubly-linked despite
- being the same size. */
-
- mchunkptr fwd; /* misc temp for linking */
- mchunkptr bck; /* misc temp for linking */
-
- bck = bin_at (av, victim_index);
- fwd = bck->fd;
- while (fwd != bck)
- {
- if (chunk_ok_for_memalign (fwd, alignment, nb) > 0)
- {
- victim = fwd;
-
- /* Unlink it */
- victim->fd->bk = victim->bk;
- victim->bk->fd = victim->fd;
- break;
- }
-
- fwd = fwd->fd;
- }
- }
- else
- {
- /* Check large bins. */
- mchunkptr fwd; /* misc temp for linking */
- mchunkptr bck; /* misc temp for linking */
- mchunkptr best = NULL;
- size_t best_size = 0;
-
- bck = bin_at (av, victim_index);
- fwd = bck->fd;
-
- while (fwd != bck)
- {
- int extra;
-
- if (chunksize (fwd) < nb)
- break;
- extra = chunk_ok_for_memalign (fwd, alignment, nb);
- if (extra > 0
- && (extra <= best_size || best == NULL))
- {
- best = fwd;
- best_size = extra;
- }
-
- fwd = fwd->fd;
- }
- victim = best;
-
- if (victim != NULL)
- {
- unlink_chunk (av, victim);
- break;
- }
- }
-
- if (victim != NULL)
- break;
- }
- }
-
- /* Strategy: find a spot within that chunk that meets the alignment
- request, and then possibly free the leading and trailing space.
- This strategy is incredibly costly and can lead to external
- fragmentation if header and footer chunks are unused. */
-
- if (victim != NULL)
- {
- p = victim;
- m = chunk2mem (p);
- set_inuse (p);
- if (av != &main_arena)
- set_non_main_arena (p);
- }
- else
- {
- /* Call malloc with worst case padding to hit alignment. */
-
- m = (char *) (_int_malloc (av, nb + alignment + MINSIZE));
-
- if (m == 0)
- return 0; /* propagate failure */
-
- p = mem2chunk (m);
- }
+ p = mem2chunk (m);
if ((((unsigned long) (m)) % alignment) != 0) /* misaligned */
{
diff --git a/malloc/tst-memalign-2.c b/malloc/tst-memalign-2.c
index f229283dbf..ecd6fa249e 100644
--- a/malloc/tst-memalign-2.c
+++ b/malloc/tst-memalign-2.c
@@ -86,7 +86,8 @@ do_test (void)
TEST_VERIFY (tcache_allocs[i].ptr1 == tcache_allocs[i].ptr2);
}
- /* Test for non-head tcache hits. */
+ /* Test for non-head tcache hits. This exercises the memalign
+ scanning code to find matching allocations. */
for (i = 0; i < array_length (ptr); ++ i)
{
if (i == 4)
@@ -113,7 +114,9 @@ do_test (void)
free (p);
TEST_VERIFY (count > 0);
- /* Large bins test. */
+ /* Large bins test. This verifies that the over-allocated parts
+ that memalign releases for future allocations can be reused by
+ memalign itself at least in some cases. */
for (i = 0; i < LN; ++ i)
{
--
2.41.0
From 26973f7b09c33e67f6bcbc79371796c8dd334528 Mon Sep 17 00:00:00 2001
From: Xi Ruoyao <xry111@xry111.site>
Date: Mon, 14 Aug 2023 11:05:18 +0800
Subject: [PATCH 3/3] malloc: Remove unused functions and variables
Remove unused chunk_ok_for_memalign function and unused local variables
in _int_free.
Signed-off-by: Xi Ruoyao <xry111@xry111.site>
---
malloc/malloc.c | 42 ------------------------------------------
1 file changed, 42 deletions(-)
diff --git a/malloc/malloc.c b/malloc/malloc.c
index 9c2cab7a59..d0bbbf3710 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -4488,12 +4488,6 @@ _int_free (mstate av, mchunkptr p, int have_lock)
{
INTERNAL_SIZE_T size; /* its size */
mfastbinptr *fb; /* associated fastbin */
- mchunkptr nextchunk; /* next contiguous chunk */
- INTERNAL_SIZE_T nextsize; /* its size */
- int nextinuse; /* true if nextchunk is used */
- INTERNAL_SIZE_T prevsize; /* size of previous contiguous chunk */
- mchunkptr bck; /* misc temp for linking */
- mchunkptr fwd; /* misc temp for linking */
size = chunksize (p);
@@ -5032,42 +5026,6 @@ _int_realloc (mstate av, mchunkptr oldp, INTERNAL_SIZE_T oldsize,
------------------------------ memalign ------------------------------
*/
-/* Returns 0 if the chunk is not and does not contain the requested
- aligned sub-chunk, else returns the amount of "waste" from
- trimming. NB is the *chunk* byte size, not the user byte
- size. */
-static size_t
-chunk_ok_for_memalign (mchunkptr p, size_t alignment, size_t nb)
-{
- void *m = chunk2mem (p);
- INTERNAL_SIZE_T size = chunksize (p);
- void *aligned_m = m;
-
- if (__glibc_unlikely (misaligned_chunk (p)))
- malloc_printerr ("_int_memalign(): unaligned chunk detected");
-
- aligned_m = PTR_ALIGN_UP (m, alignment);
-
- INTERNAL_SIZE_T front_extra = (intptr_t) aligned_m - (intptr_t) m;
-
- /* We can't trim off the front as it's too small. */
- if (front_extra > 0 && front_extra < MINSIZE)
- return 0;
-
- /* If it's a perfect fit, it's an exception to the return value rule
- (we would return zero waste, which looks like "not usable"), so
- handle it here by returning a small non-zero value instead. */
- if (size == nb && front_extra == 0)
- return 1;
-
- /* If the block we need fits in the chunk, calculate total waste. */
- if (size > nb + front_extra)
- return size - nb;
-
- /* Can't use this chunk. */
- return 0;
-}
-
/* BYTES is user requested bytes, not requested chunksize bytes. */
static void *
_int_memalign (mstate av, size_t alignment, size_t bytes)
--
2.41.0

View File

@ -7,9 +7,10 @@ Description: This patch removes references to /var/db directory whic
of FHS and replaces them with more suitable directories in /var
hierarchy - /var/cache/nscd for nscd and /var/lib/nss_db for nss_db.
--- a/Makeconfig 2012-12-25 04:02:13.000000000 +0100
+++ b/Makeconfig 2013-02-11 01:32:32.500667439 +0100
@@ -250,7 +250,7 @@
diff -Nru glibc-2.39.orig/Makeconfig glibc-2.39/Makeconfig
--- glibc-2.39.orig/Makeconfig 2024-02-11 09:36:11.769783145 +0000
+++ glibc-2.39/Makeconfig 2024-02-11 09:36:55.883504464 +0000
@@ -262,7 +262,7 @@
# Directory for the database files and Makefile for nss_db.
ifndef vardbdir
@ -18,9 +19,10 @@ Description: This patch removes references to /var/db directory whic
endif
inst_vardbdir = $(install_root)$(vardbdir)
--- a/nscd/nscd.h 2012-12-25 04:02:13.000000000 +0100
+++ b/nscd/nscd.h 2013-02-11 01:32:32.500667439 +0100
@@ -112,11 +112,11 @@
diff -Nru glibc-2.39.orig/nscd/nscd.h glibc-2.39/nscd/nscd.h
--- glibc-2.39.orig/nscd/nscd.h 2024-02-11 09:36:11.939784638 +0000
+++ glibc-2.39/nscd/nscd.h 2024-02-11 09:36:55.883504464 +0000
@@ -160,11 +160,11 @@
/* Paths of the file for the persistent storage. */
@ -37,9 +39,10 @@ Description: This patch removes references to /var/db directory whic
/* Path used when not using persistent storage. */
#define _PATH_NSCD_XYZ_DB_TMP "/var/run/nscd/dbXXXXXX"
--- a/nss/db-Makefile 2012-12-25 04:02:13.000000000 +0100
+++ b/nss/db-Makefile 2013-02-11 01:32:32.500667439 +0100
@@ -22,7 +22,7 @@
diff -Nru glibc-2.39.orig/nss/db-Makefile glibc-2.39/nss/db-Makefile
--- glibc-2.39.orig/nss/db-Makefile 2024-02-11 09:36:11.939784638 +0000
+++ glibc-2.39/nss/db-Makefile 2024-02-11 09:36:55.883504464 +0000
@@ -21,7 +21,7 @@
/etc/rpc /etc/services /etc/shadow /etc/gshadow \
/etc/netgroup)
@ -48,8 +51,9 @@ Description: This patch removes references to /var/db directory whic
AWK = awk
MAKEDB = makedb --quiet
--- a/sysdeps/generic/paths.h 2012-12-25 04:02:13.000000000 +0100
+++ b/sysdeps/generic/paths.h 2013-02-11 01:32:32.500667439 +0100
diff -Nru glibc-2.39.orig/sysdeps/generic/paths.h glibc-2.39/sysdeps/generic/paths.h
--- glibc-2.39.orig/sysdeps/generic/paths.h 2024-02-11 09:36:11.993118441 +0000
+++ glibc-2.39/sysdeps/generic/paths.h 2024-02-11 09:36:55.883504464 +0000
@@ -68,7 +68,7 @@
/* Provide trailing slash, since mostly used for building pathnames. */
#define _PATH_DEV "/dev/"
@ -59,8 +63,9 @@ Description: This patch removes references to /var/db directory whic
#define _PATH_VARRUN "/var/run/"
#define _PATH_VARTMP "/var/tmp/"
--- a/sysdeps/unix/sysv/linux/paths.h 2012-12-25 04:02:13.000000000 +0100
+++ b/sysdeps/unix/sysv/linux/paths.h 2013-02-11 01:32:32.504000831 +0100
diff -Nru glibc-2.39.orig/sysdeps/unix/sysv/linux/paths.h glibc-2.39/sysdeps/unix/sysv/linux/paths.h
--- glibc-2.39.orig/sysdeps/unix/sysv/linux/paths.h 2024-02-11 09:36:12.119786221 +0000
+++ glibc-2.39/sysdeps/unix/sysv/linux/paths.h 2024-02-11 09:36:55.886837827 +0000
@@ -68,7 +68,7 @@
/* Provide trailing slash, since mostly used for building pathnames. */
#define _PATH_DEV "/dev/"