glibc/glibc-rh2292195-2.patch
Arjun Shankar 2118accf25 Sync with glibc-2.39-22.fc40 (RHEL-45522)
Resolves: RHEL-45522

Fedora 40 commit: 9404e14f4d
Upstream commit: 4bdcc1963bc2b5ba5f8e319e402d9eb2cb6096c1

Fedora 40 changes:

- Backport /etc/resolv.conf enhancements to thelp with RHEL-18039 testing

Related: RHEL-50663

- Support --without testsuite builds without perl installed (#2292195)
- Use release instead of baserelease for glibc32 conflict
- Add Conflicts:/Obsoletes: for glibc32 to glibc.i686

- ppc64le: Build early startup code with -mcpu=power8

Resolves: RHEL-43456

- Move ANSI_X3.110-1983 support from main package to glibc-gconv-extra.

Resolves: RHEL-41206

Upstream changes:

- manual: make setrlimit() description less ambiguous
- manual/stdio: Clarify putc and putwc
- malloc: add multi-threaded tests for aligned_alloc/calloc/malloc
- malloc: avoid global locks in tst-aligned_alloc-lib.c

- resolv: Track single-request fallback via _res._flags (bug 31476)
- resolv: Do not wait for non-existing second DNS response after error (bug 30081)
- resolv: Allow short error responses to match any query (bug 31890)

Resolves: RHEL-50663

- elf: Fix localplt.awk for DT_RELR-enabled builds (BZ 31978)
- Fix usage of _STACK_GROWS_DOWN and _STACK_GROWS_UP defines [BZ 31989]
- Linux: Make __rseq_size useful for feature detection (bug 31965)
- elf: Make dl-rseq-symbols Linux only
- nptl: fix potential merge of __rseq_* relro symbols

- s390x: Fix segfault in wcsncmp [BZ #31934]

Resolves: RHEL-49488

- stdlib: fix arc4random fallback to /dev/urandom (BZ 31612)
- math: Provide missing math symbols on libc.a (BZ 31781)
- math: Fix isnanf128 static build (BZ 31774)
- math: Fix i386 and m68k exp10 on static build (BZ 31775)
- math: Fix i386 and m68k fmod/fmodf on static build (BZ 31488)
- posix: Fix pidfd_spawn/pidfd_spawnp leak if execve fails (BZ 31695)
2024-08-14 17:57:11 +02:00

85 lines
2.7 KiB
Diff

commit dd144dce21c864781fade4561581d50fb4549956
Author: Florian Weimer <fweimer@redhat.com>
Date: Thu Jun 20 20:55:10 2024 +0200
malloc: Replace shell/Perl gate in mtrace
The previous version expanded $0 and $@ twice.
The new version defines a q no-op shell command. The Perl syntax
error is masked by the eval Perl function. The q { … } construct
is executed by the shell without errors because the q shell function
was defined, but treated as a non-expanding quoted string by Perl,
effectively hiding its context from the Perl interpreter. As before
the script is read by require instead of executed directly, to avoid
infinite recursion because the #! line contains /bin/sh.
Introduce the “fatal” function to produce diagnostics that are not
suppressed by “do”. Use “do” instead of “require” because it has
fewer requirements on the executed script than “require”.
Prefix relative paths with './' because “do” (and “require“ before)
searches for the script in @INC if the path is relative and does not
start with './'. Use $_ to make the trampoline shorter.
Add an Emacs mode marker to indentify the script as a Perl script.
diff --git a/malloc/mtrace.pl b/malloc/mtrace.pl
index dc6085820e62092c..0a631a07bc4cfbb6 100644
--- a/malloc/mtrace.pl
+++ b/malloc/mtrace.pl
@@ -1,6 +1,12 @@
#! /bin/sh
-eval exec "perl -e 'shift; \$progname=shift; shift; require \$progname'" . "$0" . "$@"
- if 0;
+# -*- perl -*-
+eval "q () {
+ :
+}";
+q {
+ exec perl -e '$_ = shift; $_ = "./$_" unless m,^/,; do $_' "$0" "$@"
+}
+;
# Copyright (C) 1997-2024 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
# Based on the mtrace.awk script.
@@ -22,6 +28,7 @@ eval exec "perl -e 'shift; \$progname=shift; shift; require \$progname'" . "$0"
$VERSION = "@VERSION@";
$PKGVERSION = "@PKGVERSION@";
$REPORT_BUGS_TO = '@REPORT_BUGS_TO@';
+$progname = $_;
sub usage {
print "Usage: mtrace [OPTION]... [Binary] MtraceData\n";
@@ -33,6 +40,11 @@ sub usage {
exit 0;
}
+sub fatal {
+ print STDERR "$_[0]\n";
+ exit 1;
+}
+
# We expect two arguments:
# #1: the complete path to the binary
# #2: the mtrace data filename
@@ -86,7 +98,7 @@ if ($#ARGV == 0) {
close (LOCS);
}
} else {
- die "Wrong number of arguments, run $progname --help for help.";
+ fatal "Wrong number of arguments, run $progname --help for help.";
}
sub addr2line {
@@ -148,7 +160,8 @@ sub location {
}
$nr=0;
-open(DATA, "<$data") || die "Cannot open mtrace data file";
+open(DATA, "<$data")
+ or fatal "$progname: Cannot open mtrace data file $data: $!";
while (<DATA>) {
my @cols = split (' ');
my $n, $where;