!644 glibc : Upgrade to glibc-2.38

From: @chenhaixaing 
Reviewed-by: @liqingqing_1229 
Signed-off-by: @liqingqing_1229
This commit is contained in:
openeuler-ci-bot 2023-07-25 11:31:34 +00:00 committed by Gitee
commit bca992a1f6
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
15 changed files with 7 additions and 2373 deletions

View File

@ -1,70 +0,0 @@
From 52c037f3574eb9062b111d78a4cbeb79681d07d3 Mon Sep 17 00:00:00 2001
From: Florian Weimer <fweimer@redhat.com>
Date: Tue, 20 Sep 2022 12:12:43 +0200
Subject: [PATCH] gconv: Use 64-bit interfaces in gconv_parseconfdir (bug
29583)
It's possible that inode numbers are outside the 32-bit range.
The existing code only handles the in-libc case correctly, and
still uses the legacy interfaces when building iconv.
Suggested-by: Helge Deller <deller@gmx.de>
(cherry picked from commit f97905f24631097af325d6a231093071c3077a5f)
Signed-off-by: buque <wuxu.wu@huawei.com>
---
iconv/gconv_parseconfdir.h | 16 ++++++++--------
1 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/iconv/gconv_parseconfdir.h b/iconv/gconv_parseconfdir.h
index debb96b322..b72933b526 100644
--- a/iconv/gconv_parseconfdir.h
+++ b/iconv/gconv_parseconfdir.h
@@ -29,14 +29,14 @@
# define isspace(__c) __isspace_l ((__c), _nl_C_locobj_ptr)
# define asprintf __asprintf
# define opendir __opendir
-# define readdir __readdir
+# define readdir64 __readdir64
# define closedir __closedir
# define mempcpy __mempcpy
-# define struct_stat struct __stat64_t64
-# define lstat __lstat64_time64
+# define struct_stat64 struct __stat64_t64
+# define lstat64 __lstat64_time64
# define feof_unlocked __feof_unlocked
#else
-# define struct_stat struct stat
+# define struct_stat64 struct stat64
#endif
/* Name of the file containing the module information in the directories
@@ -148,8 +148,8 @@ gconv_parseconfdir (const char *prefix, const char *dir, size_t dir_len)
DIR *confdir = opendir (buf);
if (confdir != NULL)
{
- struct dirent *ent;
- while ((ent = readdir (confdir)) != NULL)
+ struct dirent64 *ent;
+ while ((ent = readdir64 (confdir)) != NULL)
{
if (ent->d_type != DT_REG && ent->d_type != DT_UNKNOWN)
continue;
@@ -161,12 +161,12 @@ gconv_parseconfdir (const char *prefix, const char *dir, size_t dir_len)
&& strcmp (ent->d_name + len - strlen (suffix), suffix) == 0)
{
char *conf;
- struct_stat st;
+ struct_stat64 st;
if (asprintf (&conf, "%s/%s", buf, ent->d_name) < 0)
continue;
if (ent->d_type != DT_UNKNOWN
- || (lstat (conf, &st) != -1 && S_ISREG (st.st_mode)))
+ || (lstat64 (conf, &st) != -1 && S_ISREG (st.st_mode)))
found |= read_conf_file (conf, dir, dir_len);
free (conf);
--
2.37.3.windows.1

View File

@ -1,60 +0,0 @@
From 645d94808aaa90fb1b20a25ff70bb50d9eb1d55b Mon Sep 17 00:00:00 2001
From: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date: Mon, 5 Sep 2022 09:34:39 -0300
Subject: [PATCH] syslog: Remove extra whitespace between timestamp and message
(BZ#29544)
The rfc3164 clear states that a single space character must follow
the timestamp field.
Checked on x86_64-linux-gnu.
Signed-off-by: buque <wuxu.wu@huawei.com>
---
misc/syslog.c | 2 +-
misc/tst-syslog.c | 9 ++++++---
2 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/misc/syslog.c b/misc/syslog.c
index b88f66c835..f67d4b58a4 100644
--- a/misc/syslog.c
+++ b/misc/syslog.c
@@ -167,7 +167,7 @@ __vsyslog_internal (int pri, const char *fmt, va_list ap,
_nl_C_locobj_ptr);
#define SYSLOG_HEADER(__pri, __timestamp, __msgoff, pid) \
- "<%d>%s %n%s%s%.0d%s: ", \
+ "<%d>%s%n%s%s%.0d%s: ", \
__pri, __timestamp, __msgoff, \
LogTag == NULL ? __progname : LogTag, \
"[" + (pid == 0), pid, "]" + (pid == 0)
diff --git a/misc/tst-syslog.c b/misc/tst-syslog.c
index 1d332ece53..3560b518a2 100644
--- a/misc/tst-syslog.c
+++ b/misc/tst-syslog.c
@@ -275,16 +275,19 @@ parse_syslog_msg (const char *msg)
{
struct msg_t r = { .pid = -1 };
int number;
+ int wsb, wsa;
#define STRINPUT(size) XSTRINPUT(size)
#define XSTRINPUT(size) "%" # size "s"
/* The message in the form:
- <179>Apr 8 14:51:19 tst-syslog: message 176 3 */
- int n = sscanf (msg, "<%3d>%*s %*d %*d:%*d:%*d " STRINPUT(IDENT_LENGTH)
+ <179>Apr 8 14:51:19 tst-syslog: message 176 3 */
+ int n = sscanf (msg, "<%3d>%*s %*d %*d:%*d:%*d%n %n" STRINPUT(IDENT_LENGTH)
" " STRINPUT(MSG_LENGTH) " %*d %*d",
- &number, r.ident, r.msg);
+ &number, &wsb, &wsa, r.ident, r.msg);
TEST_COMPARE (n, 3);
+ /* It should only one space between timestamp and message. */
+ TEST_COMPARE (wsa - wsb, 1);
r.facility = number & LOG_FACMASK;
r.priority = number & LOG_PRIMASK;
--
2.37.3.windows.1

View File

@ -1,658 +0,0 @@
From 8ee878592c4a642937152c8308b8faef86bcfc40 Mon Sep 17 00:00:00 2001
From: "Lucas A. M. Magalhaes" <lamm@linux.ibm.com>
Date: Thu, 14 Jul 2022 14:37:22 -0300
Subject: [PATCH] Assume only FLAG_ELF_LIBC6 suport
The older libc versions are obsolete for over twenty years now.
This patch removes the special flags for libc5 and libc4 and assumes
that all libraries cached are libc6 compatible and use FLAG_ELF_LIBC6.
Checked with a build for all affected architectures.
Co-authored-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
---
elf/cache.c | 6 +-
elf/ldconfig.c | 63 ++-----------------
elf/readelflib.c | 46 ++------------
elf/readlib.c | 25 +-------
sysdeps/unix/sysv/linux/aarch64/ldconfig.h | 30 ---------
sysdeps/unix/sysv/linux/arc/ldconfig.h | 27 --------
sysdeps/unix/sysv/linux/arm/ldconfig.h | 25 --------
sysdeps/unix/sysv/linux/csky/ldconfig.h | 34 ----------
sysdeps/unix/sysv/linux/i386/ldconfig.h | 6 --
sysdeps/unix/sysv/linux/ia64/ldconfig.h | 24 -------
sysdeps/unix/sysv/linux/m68k/ldconfig.h | 1 -
.../unix/sysv/linux/mips/mips64/ldconfig.h | 25 --------
sysdeps/unix/sysv/linux/powerpc/ldconfig.h | 27 --------
sysdeps/unix/sysv/linux/riscv/ldconfig.h | 36 -----------
sysdeps/unix/sysv/linux/s390/ldconfig.h | 7 ---
sysdeps/unix/sysv/linux/x86_64/ldconfig.h | 26 --------
16 files changed, 14 insertions(+), 394 deletions(-)
delete mode 100644 sysdeps/unix/sysv/linux/aarch64/ldconfig.h
delete mode 100644 sysdeps/unix/sysv/linux/arc/ldconfig.h
delete mode 100644 sysdeps/unix/sysv/linux/arm/ldconfig.h
delete mode 100644 sysdeps/unix/sysv/linux/csky/ldconfig.h
delete mode 100644 sysdeps/unix/sysv/linux/ia64/ldconfig.h
delete mode 100644 sysdeps/unix/sysv/linux/m68k/ldconfig.h
delete mode 100644 sysdeps/unix/sysv/linux/mips/mips64/ldconfig.h
delete mode 100644 sysdeps/unix/sysv/linux/powerpc/ldconfig.h
delete mode 100644 sysdeps/unix/sysv/linux/riscv/ldconfig.h
delete mode 100644 sysdeps/unix/sysv/linux/x86_64/ldconfig.h
diff --git a/elf/cache.c b/elf/cache.c
index 3d7d3a67bf..f5f3ef8c4d 100644
--- a/elf/cache.c
+++ b/elf/cache.c
@@ -157,6 +157,7 @@ struct cache_entry
/* List of all cache entries. */
static struct cache_entry *entries;
+/* libc4, ELF and libc5 are unsupported. */
static const char *flag_descr[] =
{ "libc4", "ELF", "libc5", "libc6"};
@@ -168,14 +169,11 @@ print_entry (const char *lib, int flag, uint64_t hwcap,
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 9394ac6438..6f37f38f35 100644
--- a/elf/ldconfig.c
+++ b/elf/ldconfig.c
@@ -65,19 +65,6 @@
#define PACKAGE _libc_intl_domainname
-static const struct
-{
- const char *name;
- int flag;
-} lib_types[] =
-{
- {"libc4", FLAG_LIBC4},
- {"libc5", FLAG_ELF_LIBC5},
- {"libc6", FLAG_ELF_LIBC6},
- {"glibc2", FLAG_ELF_LIBC6}
-};
-
-
/* List of directories to handle. */
struct dir_entry
{
@@ -469,27 +456,8 @@ add_dir_1 (const char *line, const char *from_file, int from_line)
entry->from_file = strdup (from_file);
entry->from_line = from_line;
- /* Search for an '=' sign. */
entry->path = xstrdup (line);
- char *equal_sign = strchr (entry->path, '=');
- if (equal_sign)
- {
- *equal_sign = '\0';
- ++equal_sign;
- entry->flag = FLAG_ANY;
- for (i = 0; i < sizeof (lib_types) / sizeof (lib_types[0]); ++i)
- if (strcmp (equal_sign, lib_types[i].name) == 0)
- {
- entry->flag = lib_types[i].flag;
- break;
- }
- if (entry->flag == FLAG_ANY)
- error (0, 0, _("%s is not a known library type"), equal_sign);
- }
- else
- {
- entry->flag = FLAG_ANY;
- }
+ entry->flag = FLAG_ELF_LIBC6;
/* Canonify path: for now only remove leading and trailing
whitespace and the trailing slashes. */
@@ -1054,23 +1022,11 @@ search_dir (const struct dir_entry *entry)
soname = xstrdup (direntry->d_name);
}
- if (flag == FLAG_ELF
- && (entry->flag == FLAG_ELF_LIBC5
- || entry->flag == FLAG_ELF_LIBC6))
- flag = entry->flag;
-
/* Some sanity checks to print warnings. */
if (opt_verbose)
{
- if (flag == FLAG_ELF_LIBC5 && entry->flag != FLAG_ELF_LIBC5
- && entry->flag != FLAG_ANY)
- error (0, 0, _("libc5 library %s in wrong directory"), file_name);
- if (flag == FLAG_ELF_LIBC6 && entry->flag != FLAG_ELF_LIBC6
- && entry->flag != FLAG_ANY)
+ if (flag == FLAG_ELF_LIBC6 && entry->flag != FLAG_ELF_LIBC6)
error (0, 0, _("libc6 library %s in wrong directory"), file_name);
- if (flag == FLAG_LIBC4 && entry->flag != FLAG_LIBC4
- && entry->flag != FLAG_ANY)
- error (0, 0, _("libc4 library %s in wrong directory"), file_name);
}
/* Add library to list. */
@@ -1089,19 +1045,8 @@ search_dir (const struct dir_entry *entry)
/* It's newer - add it. */
/* Flag should be the same - sanity check. */
if (dlib_ptr->flag != flag)
- {
- if (dlib_ptr->flag == FLAG_ELF
- && (flag == FLAG_ELF_LIBC5 || flag == FLAG_ELF_LIBC6))
- dlib_ptr->flag = flag;
- else if ((dlib_ptr->flag == FLAG_ELF_LIBC5
- || dlib_ptr->flag == FLAG_ELF_LIBC6)
- && flag == FLAG_ELF)
- dlib_ptr->flag = flag;
- else
- error (0, 0, _("libraries %s and %s in directory %s have same soname but different type."),
- dlib_ptr->name, direntry->d_name,
- entry->path);
- }
+ error (0, 0, _("libraries %s and %s in directory %s have same soname but different type."),
+ dlib_ptr->name, direntry->d_name, entry->path);
free (dlib_ptr->name);
dlib_ptr->name = xstrdup (direntry->d_name);
dlib_ptr->is_link = is_link;
diff --git a/elf/readelflib.c b/elf/readelflib.c
index 771182b5d0..5f43e0230d 100644
--- a/elf/readelflib.c
+++ b/elf/readelflib.c
@@ -44,7 +44,6 @@ process_elf_file (const char *file_name, const char *lib, int *flag,
size_t file_length)
{
int i;
- unsigned int j;
unsigned int dynamic_addr;
size_t dynamic_size;
char *program_interpreter;
@@ -81,9 +80,8 @@ process_elf_file (const char *file_name, const char *lib, int *flag,
elf_pheader = (ElfW(Phdr) *) (elf_header->e_phoff + file_contents);
check_ptr (elf_pheader);
- /* The library is an elf library, now search for soname and
- libc5/libc6. */
- *flag = FLAG_ELF;
+ /* The library is an elf library. */
+ *flag = FLAG_ELF_LIBC6;
/* The default ISA level is 0. */
*isa_level = 0;
@@ -110,16 +108,6 @@ process_elf_file (const char *file_name, const char *lib, int *flag,
program_interpreter = (char *) (file_contents + segment->p_offset);
check_ptr (program_interpreter);
- /* Check if this is enough to classify the binary. */
- for (j = 0; j < sizeof (interpreters) / sizeof (interpreters [0]);
- ++j)
- if (strcmp (program_interpreter, interpreters[j].soname) == 0)
- {
- *flag = interpreters[j].flag;
- break;
- }
- break;
-
case PT_GNU_PROPERTY:
/* The NT_GNU_PROPERTY_TYPE_0 note must be aligned to 4 bytes
in 32-bit objects and to 8 bytes in 64-bit objects. Skip
@@ -244,38 +232,16 @@ done:
if (dynamic_strings == NULL)
return 1;
- /* Now read the DT_NEEDED and DT_SONAME entries. */
+ /* Now read the DT_SONAME entries. */
for (dyn_entry = dynamic_segment; dyn_entry->d_tag != DT_NULL;
++dyn_entry)
{
- if (dyn_entry->d_tag == DT_NEEDED || dyn_entry->d_tag == DT_SONAME)
+ if (dyn_entry->d_tag == DT_SONAME)
{
char *name = dynamic_strings + dyn_entry->d_un.d_val;
check_ptr (name);
-
- if (dyn_entry->d_tag == DT_NEEDED)
- {
-
- if (*flag == FLAG_ELF)
- {
- /* Check if this is enough to classify the binary. */
- for (j = 0;
- j < sizeof (known_libs) / sizeof (known_libs [0]);
- ++j)
- if (strcmp (name, known_libs [j].soname) == 0)
- {
- *flag = known_libs [j].flag;
- break;
- }
- }
- }
-
- else if (dyn_entry->d_tag == DT_SONAME)
- *soname = xstrdup (name);
-
- /* Do we have everything we need? */
- if (*soname && *flag != FLAG_ELF)
- return 0;
+ *soname = xstrdup (name);
+ return 0;
}
}
diff --git a/elf/readlib.c b/elf/readlib.c
index ed42fbd48e..be65e3d0e9 100644
--- a/elf/readlib.c
+++ b/elf/readlib.c
@@ -43,24 +43,6 @@ struct known_names
int flag;
};
-static struct known_names interpreters[] =
-{
- { "/lib/" LD_SO, FLAG_ELF_LIBC6 },
-#ifdef SYSDEP_KNOWN_INTERPRETER_NAMES
- SYSDEP_KNOWN_INTERPRETER_NAMES
-#endif
-};
-
-static struct known_names known_libs[] =
-{
- { 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)
@@ -83,7 +65,8 @@ process_file (const char *real_file_name, const char *file_name,
struct exec *aout_header;
ret = 0;
- *flag = FLAG_ANY;
+ /* Just set FLAG_ELF_LIBC6 as old formats are not supported anymore. */
+ *flag = FLAG_ELF_LIBC6;
*soname = NULL;
file = fopen (real_file_name, "rb");
@@ -150,7 +133,6 @@ process_file (const char *real_file_name, const char *file_name,
*dot = '\0';
}
*soname = copy;
- *flag = FLAG_LIBC4;
goto done;
}
@@ -191,9 +173,6 @@ implicit_soname (const char *lib, int flag)
{
char *soname = xstrdup (lib);
- if ((flag & FLAG_TYPE_MASK) != FLAG_LIBC4)
- return soname;
-
/* Aout files don't have a soname, just return the name
including the major number. */
char *major = strstr (soname, ".so.");
diff --git a/sysdeps/unix/sysv/linux/aarch64/ldconfig.h b/sysdeps/unix/sysv/linux/aarch64/ldconfig.h
deleted file mode 100644
index 5cbfb32714..0000000000
--- a/sysdeps/unix/sysv/linux/aarch64/ldconfig.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/* Copyright (C) 2009-2022 Free Software Foundation, Inc.
-
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <https://www.gnu.org/licenses/>. */
-
-#include <sysdeps/generic/ldconfig.h>
-
-#define SYSDEP_KNOWN_INTERPRETER_NAMES \
- { "/lib/ld-linux-aarch64.so.1", FLAG_ELF_LIBC6 }, \
- { "/lib/ld-linux-aarch64_be.so.1", FLAG_ELF_LIBC6 }, \
- { "/lib/ld-linux-aarch64_ilp32.so.1", FLAG_ELF_LIBC6 }, \
- { "/lib/ld-linux-aarch64_be_ilp32.so.1", FLAG_ELF_LIBC6 }, \
- { "/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/arc/ldconfig.h b/sysdeps/unix/sysv/linux/arc/ldconfig.h
deleted file mode 100644
index f673170e59..0000000000
--- a/sysdeps/unix/sysv/linux/arc/ldconfig.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/* ldconfig default paths and libraries. Linux/RISC-V version.
- Copyright (C) 2020-2022 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library. If not, see
- <https://www.gnu.org/licenses/>. */
-
-#include <sysdeps/generic/ldconfig.h>
-
-#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/linux/arm/ldconfig.h
deleted file mode 100644
index d1253993ea..0000000000
--- a/sysdeps/unix/sysv/linux/arm/ldconfig.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/* Copyright (C) 2001-2022 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <https://www.gnu.org/licenses/>. */
-
-#include <sysdeps/generic/ldconfig.h>
-
-#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
deleted file mode 100644
index fbe17e3dc8..0000000000
--- a/sysdeps/unix/sysv/linux/csky/ldconfig.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/* ldconfig default paths and libraries. Linux/C-SKY version.
- Copyright (C) 2018-2022 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <https://www.gnu.org/licenses/>. */
-
-#include <sysdeps/generic/ldconfig.h>
-
-#define LD_SO_PREFIX "/lib/ld-linux-"
-#define LD_SO_SUFFIX ".so.1"
-
-#ifdef __CSKY_HARD_FLOAT__
-# define LD_SO_ABI "cskyv2-hf"
-#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/i386/ldconfig.h b/sysdeps/unix/sysv/linux/i386/ldconfig.h
index bafbec1231..9afda09cca 100644
--- a/sysdeps/unix/sysv/linux/i386/ldconfig.h
+++ b/sysdeps/unix/sysv/linux/i386/ldconfig.h
@@ -16,9 +16,3 @@
<https://www.gnu.org/licenses/>. */
#include <sysdeps/generic/ldconfig.h>
-
-#define SYSDEP_KNOWN_INTERPRETER_NAMES \
- { "/lib/ld-linux.so.1", FLAG_ELF_LIBC5 },
-#define SYSDEP_KNOWN_LIBRARY_NAMES \
- { "libc.so.5", FLAG_ELF_LIBC5 }, \
- { "libm.so.5", FLAG_ELF_LIBC5 },
diff --git a/sysdeps/unix/sysv/linux/ia64/ldconfig.h b/sysdeps/unix/sysv/linux/ia64/ldconfig.h
deleted file mode 100644
index 4731419bf8..0000000000
--- a/sysdeps/unix/sysv/linux/ia64/ldconfig.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/* Copyright (C) 2001-2022 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <https://www.gnu.org/licenses/>. */
-
-#include <sysdeps/generic/ldconfig.h>
-
-#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/m68k/ldconfig.h b/sysdeps/unix/sysv/linux/m68k/ldconfig.h
deleted file mode 100644
index 953f192bcd..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/ldconfig.h
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/ldconfig.h>
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/ldconfig.h b/sysdeps/unix/sysv/linux/mips/mips64/ldconfig.h
deleted file mode 100644
index ac82941aff..0000000000
--- a/sysdeps/unix/sysv/linux/mips/mips64/ldconfig.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/* Copyright (C) 2001-2022 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library. If not, see
- <https://www.gnu.org/licenses/>. */
-
-#include <sysdeps/generic/ldconfig.h>
-
-#define SYSDEP_KNOWN_INTERPRETER_NAMES \
- { "/lib32/ld.so.1", FLAG_ELF_LIBC6 }, \
- { "/lib64/ld.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/powerpc/ldconfig.h b/sysdeps/unix/sysv/linux/powerpc/ldconfig.h
deleted file mode 100644
index 1d70657838..0000000000
--- a/sysdeps/unix/sysv/linux/powerpc/ldconfig.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/* ldconfig default paths and libraries. Linux/PowerPC version.
- Copyright (C) 2002-2022 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <https://www.gnu.org/licenses/>. */
-
-#include <sysdeps/generic/ldconfig.h>
-
-#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
deleted file mode 100644
index e3847f116e..0000000000
--- a/sysdeps/unix/sysv/linux/riscv/ldconfig.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/* ldconfig default paths and libraries. Linux/RISC-V version.
- Copyright (C) 2001-2022 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library. If not, see
- <https://www.gnu.org/licenses/>. */
-
-#include <sysdeps/generic/ldconfig.h>
-
-#define LD_SO_PREFIX "/lib/ld-linux-"
-#define LD_SO_SUFFIX ".so.1"
-
-#if __riscv_xlen == 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 f564a6eaf6..9afda09cca 100644
--- a/sysdeps/unix/sysv/linux/s390/ldconfig.h
+++ b/sysdeps/unix/sysv/linux/s390/ldconfig.h
@@ -16,10 +16,3 @@
<https://www.gnu.org/licenses/>. */
#include <sysdeps/generic/ldconfig.h>
-
-#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/sysv/linux/x86_64/ldconfig.h
deleted file mode 100644
index b67203e017..0000000000
--- a/sysdeps/unix/sysv/linux/x86_64/ldconfig.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/* Copyright (C) 2001-2022 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <https://www.gnu.org/licenses/>. */
-
-#include <sysdeps/generic/ldconfig.h>
-
-#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 },
--
2.39.2

View File

@ -1,243 +0,0 @@
From 766b73768b290b303f5b56268c6c0d588d5a9267 Mon Sep 17 00:00:00 2001
From: Florian Weimer <fweimer@redhat.com>
Date: Mon, 19 Sep 2022 08:10:41 +0200
Subject: [PATCH] Linux: Do not skip d_ino == 0 entries in readdir, readdir64
(bug 12165)
POSIX does not say this value is special. For example, old XFS file
systems may still use inode number zero.
Also update the comment regarding ENOENT. Linux may return ENOENT
for some file systems.
---
sysdeps/unix/sysv/linux/readdir.c | 57 +++++--------
sysdeps/unix/sysv/linux/readdir64.c | 120 +++++++++++-----------------
2 files changed, 69 insertions(+), 108 deletions(-)
diff --git a/sysdeps/unix/sysv/linux/readdir.c b/sysdeps/unix/sysv/linux/readdir.c
index c31f349639..c9a04dc160 100644
--- a/sysdeps/unix/sysv/linux/readdir.c
+++ b/sysdeps/unix/sysv/linux/readdir.c
@@ -28,48 +28,33 @@ __readdir_unlocked (DIR *dirp)
struct dirent *dp;
int saved_errno = errno;
- do
+ if (dirp->offset >= dirp->size)
{
- size_t reclen;
+ /* We've emptied out our buffer. Refill it. */
- if (dirp->offset >= dirp->size)
+ size_t maxread = dirp->allocation;
+ ssize_t bytes;
+
+ bytes = __getdents (dirp->fd, dirp->data, maxread);
+ if (bytes <= 0)
{
- /* We've emptied out our buffer. Refill it. */
-
- size_t maxread = dirp->allocation;
- ssize_t bytes;
-
- bytes = __getdents (dirp->fd, dirp->data, maxread);
- if (bytes <= 0)
- {
- /* On some systems getdents fails with ENOENT when the
- open directory has been rmdir'd already. POSIX.1
- requires that we treat this condition like normal EOF. */
- if (bytes < 0 && errno == ENOENT)
- bytes = 0;
-
- /* Don't modifiy errno when reaching EOF. */
- if (bytes == 0)
- __set_errno (saved_errno);
- dp = NULL;
- break;
- }
- dirp->size = (size_t) bytes;
-
- /* Reset the offset into the buffer. */
- dirp->offset = 0;
+ /* Linux may fail with ENOENT on some file systems if the
+ directory inode is marked as dead (deleted). POSIX
+ treats this as a regular end-of-directory condition, so
+ do not set errno in that case, to indicate success. */
+ if (bytes == 0 || errno == ENOENT)
+ __set_errno (saved_errno);
+ return NULL;
}
+ dirp->size = (size_t) bytes;
- dp = (struct dirent *) &dirp->data[dirp->offset];
-
- reclen = dp->d_reclen;
-
- dirp->offset += reclen;
-
- dirp->filepos = dp->d_off;
+ /* Reset the offset into the buffer. */
+ dirp->offset = 0;
+ }
- /* Skip deleted files. */
- } while (dp->d_ino == 0);
+ dp = (struct dirent *) &dirp->data[dirp->offset];
+ dirp->offset += dp->d_reclen;
+ dirp->filepos = dp->d_off;
return dp;
}
diff --git a/sysdeps/unix/sysv/linux/readdir64.c b/sysdeps/unix/sysv/linux/readdir64.c
index e876d84b02..7952da5c27 100644
--- a/sysdeps/unix/sysv/linux/readdir64.c
+++ b/sysdeps/unix/sysv/linux/readdir64.c
@@ -37,48 +37,36 @@ __readdir64 (DIR *dirp)
__libc_lock_lock (dirp->lock);
#endif
- do
+ if (dirp->offset >= dirp->size)
{
- size_t reclen;
+ /* We've emptied out our buffer. Refill it. */
- if (dirp->offset >= dirp->size)
+ size_t maxread = dirp->allocation;
+ ssize_t bytes;
+
+ bytes = __getdents64 (dirp->fd, dirp->data, maxread);
+ if (bytes <= 0)
{
- /* We've emptied out our buffer. Refill it. */
-
- size_t maxread = dirp->allocation;
- ssize_t bytes;
-
- bytes = __getdents64 (dirp->fd, dirp->data, maxread);
- if (bytes <= 0)
- {
- /* On some systems getdents fails with ENOENT when the
- open directory has been rmdir'd already. POSIX.1
- requires that we treat this condition like normal EOF. */
- if (bytes < 0 && errno == ENOENT)
- bytes = 0;
-
- /* Don't modifiy errno when reaching EOF. */
- if (bytes == 0)
- __set_errno (saved_errno);
- dp = NULL;
- break;
- }
- dirp->size = (size_t) bytes;
-
- /* Reset the offset into the buffer. */
- dirp->offset = 0;
+ /* Linux may fail with ENOENT on some file systems if the
+ directory inode is marked as dead (deleted). POSIX
+ treats this as a regular end-of-directory condition, so
+ do not set errno in that case, to indicate success. */
+ if (bytes == 0 || errno == ENOENT)
+ __set_errno (saved_errno);
+#if IS_IN (libc)
+ __libc_lock_unlock (dirp->lock);
+#endif
+ return NULL;
}
+ dirp->size = (size_t) bytes;
- dp = (struct dirent64 *) &dirp->data[dirp->offset];
-
- reclen = dp->d_reclen;
-
- dirp->offset += reclen;
-
- dirp->filepos = dp->d_off;
+ /* Reset the offset into the buffer. */
+ dirp->offset = 0;
+ }
- /* Skip deleted files. */
- } while (dp->d_ino == 0);
+ dp = (struct dirent64 *) &dirp->data[dirp->offset];
+ dirp->offset += dp->d_reclen;
+ dirp->filepos = dp->d_off;
#if IS_IN (libc)
__libc_lock_unlock (dirp->lock);
@@ -115,48 +103,36 @@ __old_readdir64 (DIR *dirp)
__libc_lock_lock (dirp->lock);
#endif
- do
+ if (dirp->offset >= dirp->size)
{
- size_t reclen;
+ /* We've emptied out our buffer. Refill it. */
- if (dirp->offset >= dirp->size)
+ size_t maxread = dirp->allocation;
+ ssize_t bytes;
+
+ bytes = __old_getdents64 (dirp->fd, dirp->data, maxread);
+ if (bytes <= 0)
{
- /* We've emptied out our buffer. Refill it. */
-
- size_t maxread = dirp->allocation;
- ssize_t bytes;
-
- bytes = __old_getdents64 (dirp->fd, dirp->data, maxread);
- if (bytes <= 0)
- {
- /* On some systems getdents fails with ENOENT when the
- open directory has been rmdir'd already. POSIX.1
- requires that we treat this condition like normal EOF. */
- if (bytes < 0 && errno == ENOENT)
- bytes = 0;
-
- /* Don't modifiy errno when reaching EOF. */
- if (bytes == 0)
- __set_errno (saved_errno);
- dp = NULL;
- break;
- }
- dirp->size = (size_t) bytes;
-
- /* Reset the offset into the buffer. */
- dirp->offset = 0;
+ /* Linux may fail with ENOENT on some file systems if the
+ directory inode is marked as dead (deleted). POSIX
+ treats this as a regular end-of-directory condition, so
+ do not set errno in that case, to indicate success. */
+ if (bytes == 0 || errno == ENOENT)
+ __set_errno (saved_errno);
+#if IS_IN (libc)
+ __libc_lock_unlock (dirp->lock);
+#endif
+ return NULL;
}
+ dirp->size = (size_t) bytes;
- dp = (struct __old_dirent64 *) &dirp->data[dirp->offset];
-
- reclen = dp->d_reclen;
-
- dirp->offset += reclen;
-
- dirp->filepos = dp->d_off;
+ /* Reset the offset into the buffer. */
+ dirp->offset = 0;
+ }
- /* Skip deleted files. */
- } while (dp->d_ino == 0);
+ dp = (struct __old_dirent64 *) &dirp->data[dirp->offset];
+ dirp->offset += dp->d_reclen;
+ dirp->filepos = dp->d_off;
#if IS_IN (libc)
__libc_lock_unlock (dirp->lock);
--
2.23.0

View File

@ -1,42 +0,0 @@
From 2955ef4b7c9b56fcd7abfeddef7ee83c60abff98 Mon Sep 17 00:00:00 2001
From: Florian Weimer <fweimer@redhat.com>
Date: Tue, 16 Aug 2022 09:25:23 +0200
Subject: [PATCH] Linux: Fix enum fsconfig_command detection in <sys/mount.h>
The #ifdef FSOPEN_CLOEXEC check did not work because the macro
was always defined in this header prior to the check, so that
the <linux/mount.h> contents did not matter.
Fixes commit 774058d72942249f71d74e7f2b639f77184160a6
("linux: Fix sys/mount.h usage with kernel headers").
---
sysdeps/unix/sysv/linux/sys/mount.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/sysdeps/unix/sysv/linux/sys/mount.h b/sysdeps/unix/sysv/linux/sys/mount.h
index 2e3fd6a7fe6..19841d07385 100644
--- a/sysdeps/unix/sysv/linux/sys/mount.h
+++ b/sysdeps/unix/sysv/linux/sys/mount.h
@@ -188,9 +188,6 @@ enum
};
-/* fsopen flags. */
-#define FSOPEN_CLOEXEC 0x00000001
-
/* fsmount flags. */
#define FSMOUNT_CLOEXEC 0x00000001
@@ -261,6 +258,9 @@ enum fsconfig_command
};
#endif
+/* fsopen flags. */
+#define FSOPEN_CLOEXEC 0x00000001
+
/* open_tree flags. */
#define OPEN_TREE_CLONE 1 /* Clone the target tree and attach the clone */
#define OPEN_TREE_CLOEXEC O_CLOEXEC /* Close the file on execve() */
--
2.23.0.windows.1

View File

@ -1,114 +0,0 @@
From 2d7ed98add14f75041499ac189696c9bd3d757fe Mon Sep 17 00:00:00 2001
From: Sergei Trofimovich <slyich@gmail.com>
Date: Tue, 13 Sep 2022 13:39:13 -0400
Subject: [PATCH] Makerules: fix MAKEFLAGS assignment for upcoming make-4.4
[BZ# 29564]
make-4.4 will add long flags to MAKEFLAGS variable:
* WARNING: Backward-incompatibility!
Previously only simple (one-letter) options were added to the MAKEFLAGS
variable that was visible while parsing makefiles. Now, all options
are available in MAKEFLAGS.
This causes locale builds to fail when long options are used:
$ make --shuffle
...
make -C localedata install-locales
make: invalid shuffle mode: '1662724426r'
The change fixes it by passing eash option via whitespace and dashes.
That way option is appended to both single-word form and whitespace
separated form.
While at it fixed --silent mode detection in $(MAKEFLAGS) by filtering
out --long-options. Otherwise options like --shuffle flag enable silent
mode unintentionally. $(silent-make) variable consolidates the checks.
Resolves: BZ# 29564
CC: Paul Smith <psmith@gnu.org>
CC: Siddhesh Poyarekar <siddhesh@gotplt.org>
Signed-off-by: Sergei Trofimovich <slyich@gmail.com>
Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
---
Makeconfig | 18 +++++++++++++++++-
Makerules | 4 ++--
elf/rtld-Rules | 2 +-
3 files changed, 20 insertions(+), 4 deletions(-)
diff --git a/Makeconfig b/Makeconfig
index f8164a0025..842f49eb58 100644
--- a/Makeconfig
+++ b/Makeconfig
@@ -43,6 +43,22 @@ else
$(error objdir must be defined by the build-directory Makefile)
endif
+# Did we request 'make -s' run? "yes" or "no".
+# Starting from make-4.4 MAKEFLAGS now contains long
+# options like '--shuffle'. To detect presence of 's'
+# we pick first word with short options. Long options
+# are guaranteed to come after whitespace. We use '-'
+# prefix to always have a word before long options
+# even if no short options were passed.
+# Typical MAKEFLAGS values to watch for:
+# "rs --shuffle=42" (silent)
+# " --shuffle" (not silent)
+ifeq ($(findstring s, $(firstword -$(MAKEFLAGS))),)
+silent-make := no
+else
+silent-make := yes
+endif
+
# Root of the sysdeps tree.
sysdep_dir := $(..)sysdeps
export sysdep_dir := $(sysdep_dir)
@@ -917,7 +933,7 @@ endif
# umpteen zillion filenames along with it (we use `...' instead)
# but we don't want this echoing done when the user has said
# he doesn't want to see commands echoed by using -s.
-ifneq "$(findstring s,$(MAKEFLAGS))" "" # if -s
+ifeq ($(silent-make),yes) # if -s
+cmdecho := echo >/dev/null
else # not -s
+cmdecho := echo
diff --git a/Makerules b/Makerules
index d1e139d03c..09c0cf8357 100644
--- a/Makerules
+++ b/Makerules
@@ -794,7 +794,7 @@ endif
# Maximize efficiency by minimizing the number of rules.
.SUFFIXES: # Clear the suffix list. We don't use suffix rules.
# Don't define any builtin rules.
-MAKEFLAGS := $(MAKEFLAGS)r
+MAKEFLAGS := $(MAKEFLAGS) -r
# Generic rule for making directories.
%/:
@@ -811,7 +811,7 @@ MAKEFLAGS := $(MAKEFLAGS)r
.PRECIOUS: $(foreach l,$(libtypes),$(patsubst %,$(common-objpfx)$l,c))
# Use the verbose option of ar and tar when not running silently.
-ifeq "$(findstring s,$(MAKEFLAGS))" "" # if not -s
+ifeq ($(silent-make),no) # if not -s
verbose := v
else # -s
verbose :=
diff --git a/elf/rtld-Rules b/elf/rtld-Rules
index ca00dd1fe2..3c5e273f2b 100644
--- a/elf/rtld-Rules
+++ b/elf/rtld-Rules
@@ -52,7 +52,7 @@ $(objpfx)rtld-libc.a: $(foreach dir,$(rtld-subdirs),\
mv -f $@T $@
# Use the verbose option of ar and tar when not running silently.
-ifeq "$(findstring s,$(MAKEFLAGS))" "" # if not -s
+ifeq ($(silent-make),no) # if not -s
verbose := v
else # -s
verbose :=
--
2.33.0

View File

@ -1,214 +0,0 @@
From 1b0ea8c5d886fedabd611a569b5ec58a6f5153e6 Mon Sep 17 00:00:00 2001
From: Joan Bruguera <joanbrugueram@gmail.com>
Date: Sat, 18 Feb 2023 21:52:15 +0000
Subject: [PATCH] elf: Restore ldconfig libc6 implicit soname logic [BZ #30125]
While cleaning up old libc version support, the deprecated libc4 code was
accidentally kept in `implicit_soname`, instead of the libc6 code.
This causes additional symlinks to be created by `ldconfig` for libraries
without a soname, e.g. a library `libsomething.123.456.789` without a soname
will create a `libsomething.123` -> `libsomething.123.456.789` symlink.
As the libc6 version of the `implicit_soname` code is a trivial `xstrdup`,
just inline it and remove `implicit_soname` altogether.
Some further simplification looks possible (e.g. the call to `create_links`
looks like a no-op if `soname == NULL`, other than the verbose printfs), but
logic is kept as-is for now.
Fixes: BZ #30125
Fixes: 8ee878592c4a ("Assume only FLAG_ELF_LIBC6 suport")
Signed-off-by: Joan Bruguera <joanbrugueram@gmail.com>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
---
Rebased-by: laokz <zhangkai@iscas.ac.cn>
---
elf/Makefile | 14 ++++++
elf/ldconfig.c | 4 +-
elf/readlib.c | 19 --------
elf/tst-ldconfig-soname-lib-with-soname.c | 1 +
elf/tst-ldconfig-soname-lib-without-soname.c | 1 +
elf/tst-ldconfig-soname.sh | 49 ++++++++++++++++++++
sysdeps/generic/ldconfig.h | 2 -
7 files changed, 67 insertions(+), 23 deletions(-)
create mode 100644 elf/tst-ldconfig-soname-lib-with-soname.c
create mode 100644 elf/tst-ldconfig-soname-lib-without-soname.c
create mode 100644 elf/tst-ldconfig-soname.sh
diff --git a/elf/Makefile b/elf/Makefile
index 2fc6391183..0d19964d42 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -627,6 +627,7 @@ ifeq ($(run-built-tests),yes)
tests-special += \
$(objpfx)noload-mem.out \
$(objpfx)tst-ldconfig-X.out \
+ $(objpfx)tst-ldconfig-soname.out \
$(objpfx)tst-leaks1-mem.out \
$(objpfx)tst-rtld-help.out \
# tests-special
@@ -859,6 +860,8 @@ modules-names += \
tst-initorderb2 \
tst-latepthreadmod \
tst-ldconfig-ld-mod \
+ tst-ldconfig-soname-lib-with-soname \
+ tst-ldconfig-soname-lib-without-soname \
tst-main1mod \
tst-nodelete2mod \
tst-nodelete-dlclose-dso \
@@ -2402,6 +2405,17 @@ $(objpfx)tst-ldconfig-p.out : tst-ldconfig-p.sh $(objpfx)ldconfig
'$(run-program-env)' > $@; \
$(evaluate-test)
+LDFLAGS-tst-ldconfig-soname-lib-with-soname.so = \
+ -Wl,-soname,libtst-ldconfig-soname-lib-with-soname.so.1
+
+$(objpfx)tst-ldconfig-soname.out : tst-ldconfig-soname.sh \
+ $(objpfx)ldconfig \
+ $(objpfx)tst-ldconfig-soname-lib-with-soname.so \
+ $(objpfx)tst-ldconfig-soname-lib-without-soname.so
+ $(SHELL) $< '$(common-objpfx)' '$(test-wrapper-env)' \
+ '$(run-program-env)' > $@; \
+ $(evaluate-test)
+
# Test static linking of all the libraries we can possibly link
# together. Note that in some configurations this may be less than the
# complete list of libraries we build but we try to maxmimize this list.
diff --git a/elf/ldconfig.c b/elf/ldconfig.c
index 3f1b30c570..2fc45ad825 100644
--- a/elf/ldconfig.c
+++ b/elf/ldconfig.c
@@ -616,7 +616,7 @@ manual_link (char *library)
goto out;
}
if (soname == NULL)
- soname = implicit_soname (libname, flag);
+ soname = xstrdup (libname);
create_links (real_path, path, libname, soname);
free (soname);
out:
@@ -849,7 +849,7 @@ search_dir (const struct dir_entry *entry)
}
if (soname == NULL)
- soname = implicit_soname (direntry->d_name, flag);
+ soname = xstrdup (direntry->d_name);
/* A link may just point to itself. */
if (is_link)
diff --git a/elf/readlib.c b/elf/readlib.c
index c5c3591eef..bc13d9acc6 100644
--- a/elf/readlib.c
+++ b/elf/readlib.c
@@ -166,24 +166,5 @@ process_file (const char *real_file_name, const char *file_name,
return ret;
}
-/* Returns made up soname if lib doesn't have explicit DT_SONAME. */
-
-char *
-implicit_soname (const char *lib, int flag)
-{
- char *soname = xstrdup (lib);
-
- /* Aout files don't have a soname, just return the name
- including the major number. */
- char *major = strstr (soname, ".so.");
- if (major)
- {
- char *dot = strstr (major + 4, ".");
- if (dot)
- *dot = '\0';
- }
- return soname;
-}
-
/* Get architecture specific version of process_elf_file. */
#include <readelflib.c>
diff --git a/elf/tst-ldconfig-soname-lib-with-soname.c b/elf/tst-ldconfig-soname-lib-with-soname.c
new file mode 100644
index 0000000000..d1ab56ad58
--- /dev/null
+++ b/elf/tst-ldconfig-soname-lib-with-soname.c
@@ -0,0 +1 @@
+/* This file intentionally left blank */
diff --git a/elf/tst-ldconfig-soname-lib-without-soname.c b/elf/tst-ldconfig-soname-lib-without-soname.c
new file mode 100644
index 0000000000..d1ab56ad58
--- /dev/null
+++ b/elf/tst-ldconfig-soname-lib-without-soname.c
@@ -0,0 +1 @@
+/* This file intentionally left blank */
diff --git a/elf/tst-ldconfig-soname.sh b/elf/tst-ldconfig-soname.sh
new file mode 100644
index 0000000000..406f526dbf
--- /dev/null
+++ b/elf/tst-ldconfig-soname.sh
@@ -0,0 +1,49 @@
+#!/bin/sh
+# Test that ldconfig creates symlinks according to the library's soname
+# (and in particular, does not create symlinks for libraries without a soname)
+# Copyright (C) 2000-2023 Free Software Foundation, Inc.
+# Copyright The GNU Toolchain Authors.
+# This file is part of the GNU C Library.
+
+# The GNU C Library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+
+# The GNU C Library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+
+# You should have received a copy of the GNU Lesser General Public
+# License along with the GNU C Library; if not, see
+# <https://www.gnu.org/licenses/>.
+
+set -ex
+
+common_objpfx=$1
+test_wrapper_env=$2
+run_program_env=$3
+
+testroot="${common_objpfx}elf/bug30125-test-directory"
+cleanup () {
+ rm -rf "$testroot"
+}
+trap cleanup 0
+
+rm -rf "$testroot"
+mkdir -p $testroot/lib
+cp "${common_objpfx}elf/tst-ldconfig-soname-lib-with-soname.so" \
+ $testroot/lib/libtst-ldconfig-soname-lib-with-soname.so.1.2.3
+cp "${common_objpfx}elf/tst-ldconfig-soname-lib-without-soname.so" \
+ $testroot/lib/libtst-ldconfig-soname-lib-without-soname.so.1.2.3
+
+${test_wrapper_env} \
+${run_program_env} \
+${common_objpfx}elf/ldconfig -vn $testroot/lib
+
+LINKS=$(cd $testroot/lib && find . -type l)
+if [ "$LINKS" != "./libtst-ldconfig-soname-lib-with-soname.so.1" ]; then
+ echo "error: $0 - extra symlinks found"
+ exit 1
+fi
diff --git a/sysdeps/generic/ldconfig.h b/sysdeps/generic/ldconfig.h
index 0e1a9a9515..e9e9e19d0f 100644
--- a/sysdeps/generic/ldconfig.h
+++ b/sysdeps/generic/ldconfig.h
@@ -90,8 +90,6 @@ extern int process_file (const char *real_file_name, const char *file_name,
const char *lib, int *flag, unsigned int *isa_level,
char **soname, int is_link, struct stat *stat_buf);
-extern char *implicit_soname (const char *lib, int flag);
-
/* Declared in readelflib.c. */
extern int process_elf_file (const char *file_name, const char *lib,
int *flag, unsigned int *isa_level, char **soname,
--
2.39.2

View File

@ -64,8 +64,8 @@
# glibc - The GNU C Library (glibc) core package.
##############################################################################
Name: glibc
Version: 2.36
Release: 18
Version: 2.38
Release: 1
Summary: The GNU libc libraries
License: %{all_license}
URL: http://www.gnu.org/software/glibc/
@ -84,18 +84,6 @@ Source8: testsuite_whitelist
%endif
Patch0: glibc-1070416.patch
Patch1: linux-Mimic-kernel-defition-for-BLOCK_SIZE.patch
Patch2: linux-Fix-sys-mount.h-usage-with-kernel-headers.patch
Patch3: Linux-Fix-enum-fsconfig_command-detection-in-sys-mou.patch
Patch4: syslog-Fix-large-messages-BZ-29536.patch
Patch5: Linux-Do-not-skip-d_ino-0-entries-in-readdir-readdir.patch
Patch6: 0001-gconv-Use-64-bit-interfaces-in-gconv_parseconfdir-bu.patch
Patch7: 0001-syslog-Remove-extra-whitespace-between-timestamp-and.patch
Patch8: Makerules-fix-MAKEFLAGS-assignment-for-upcoming-make.patch
Patch9: gmon-Fix-allocated-buffer-overflow-bug-29444.patch
Patch10: stdlib-strfrom-Add-copysign-to-fix-NAN-issue-on-risc.patch
Patch11: Assume-only-FLAG_ELF_LIBC6-suport.patch
Patch12: elf-Restore-ldconfig-libc6-implicit-soname-logic-BZ-.patch
Patch9000: turn-default-value-of-x86_rep_stosb_threshold_form_2K_to_1M.patch
Patch9001: locale-delete-no-hard-link-to-avoid-all_language-pac.patch
@ -1274,6 +1262,9 @@ fi
%endif
%changelog
* Tue Jul 25 2023 chenhaixiang<chenhaixiang3@huawei.com> - 2.38-1
- Update to glibc-2.38
* Tue Jul 11 2023 jiangyingxin<jiangyingxin1@huawei.com> - 2.36-18
- Optimizing __random for single-threaded scenarios

View File

@ -1,79 +0,0 @@
From 801af9fafd4689337ebf27260aa115335a0cb2bc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=D0=9B=D0=B5=D0=BE=D0=BD=D0=B8=D0=B4=20=D0=AE=D1=80=D1=8C?=
=?UTF-8?q?=D0=B5=D0=B2=20=28Leonid=20Yuriev=29?= <leo@yuriev.ru>
Date: Sat, 4 Feb 2023 14:41:38 +0300
Subject: [PATCH] gmon: Fix allocated buffer overflow (bug 29444)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The `__monstartup()` allocates a buffer used to store all the data
accumulated by the monitor.
The size of this buffer depends on the size of the internal structures
used and the address range for which the monitor is activated, as well
as on the maximum density of call instructions and/or callable functions
that could be potentially on a segment of executable code.
In particular a hash table of arcs is placed at the end of this buffer.
The size of this hash table is calculated in bytes as
p->fromssize = p->textsize / HASHFRACTION;
but actually should be
p->fromssize = ROUNDUP(p->textsize / HASHFRACTION, sizeof(*p->froms));
This results in writing beyond the end of the allocated buffer when an
added arc corresponds to a call near from the end of the monitored
address range, since `_mcount()` check the incoming caller address for
monitored range but not the intermediate result hash-like index that
uses to write into the table.
It should be noted that when the results are output to `gmon.out`, the
table is read to the last element calculated from the allocated size in
bytes, so the arcs stored outside the buffer boundary did not fall into
`gprof` for analysis. Thus this "feature" help me to found this bug
during working with https://sourceware.org/bugzilla/show_bug.cgi?id=29438
Just in case, I will explicitly note that the problem breaks the
`make test t=gmon/tst-gmon-dso` added for Bug 29438.
There, the arc of the `f3()` call disappears from the output, since in
the DSO case, the call to `f3` is located close to the end of the
monitored range.
Signed-off-by: Леонид Юрьев (Leonid Yuriev) <leo@yuriev.ru>
Another minor error seems a related typo in the calculation of
`kcountsize`, but since kcounts are smaller than froms, this is
actually to align the p->froms data.
Co-authored-by: DJ Delorie <dj@redhat.com>
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
---
gmon/gmon.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/gmon/gmon.c b/gmon/gmon.c
index dee64803ad..bf76358d5b 100644
--- a/gmon/gmon.c
+++ b/gmon/gmon.c
@@ -132,6 +132,8 @@ __monstartup (u_long lowpc, u_long highpc)
p->lowpc = ROUNDDOWN(lowpc, HISTFRACTION * sizeof(HISTCOUNTER));
p->highpc = ROUNDUP(highpc, HISTFRACTION * sizeof(HISTCOUNTER));
p->textsize = p->highpc - p->lowpc;
+ /* This looks like a typo, but it's here to align the p->froms
+ section. */
p->kcountsize = ROUNDUP(p->textsize / HISTFRACTION, sizeof(*p->froms));
p->hashfraction = HASHFRACTION;
p->log_hashfraction = -1;
@@ -142,7 +144,7 @@ __monstartup (u_long lowpc, u_long highpc)
instead of integer division. Precompute shift amount. */
p->log_hashfraction = ffs(p->hashfraction * sizeof(*p->froms)) - 1;
}
- p->fromssize = p->textsize / HASHFRACTION;
+ p->fromssize = ROUNDUP(p->textsize / HASHFRACTION, sizeof(*p->froms));
p->tolimit = p->textsize * ARCDENSITY / 100;
if (p->tolimit < MINARCS)
p->tolimit = MINARCS;
--
2.33.0

View File

@ -1,336 +0,0 @@
From 774058d72942249f71d74e7f2b639f77184160a6 Mon Sep 17 00:00:00 2001
From: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date: Wed, 10 Aug 2022 14:24:47 -0300
Subject: [PATCH] linux: Fix sys/mount.h usage with kernel headers
Now that kernel exports linux/mount.h and includes it on linux/fs.h,
its definitions might clash with glibc exports sys/mount.h. To avoid
the need to rearrange the Linux header to be always after glibc one,
the glibc sys/mount.h is changed to:
1. Undefine the macros also used as enum constants. This covers prior
inclusion of <linux/mount.h> (for instance MS_RDONLY).
2. Include <linux/mount.h> based on the usual __has_include check
(needs to use __has_include ("linux/mount.h") to paper over GCC
bugs.
3. Define enum fsconfig_command only if FSOPEN_CLOEXEC is not defined.
(FSOPEN_CLOEXEC should be a very close proxy.)
4. Define struct mount_attr if MOUNT_ATTR_SIZE_VER0 is not defined.
(Added in the same commit on the Linux side.)
This patch also adds some tests to check if including linux/fs.h and
linux/mount.h after and before sys/mount.h does work.
Checked on x86_64-linux-gnu.
Reviewed-by: Florian Weimer <fweimer@redhat.com>
---
sysdeps/unix/sysv/linux/Makefile | 8 +++
sysdeps/unix/sysv/linux/sys/mount.h | 71 +++++++++++++++++---
sysdeps/unix/sysv/linux/tst-mount-compile.py | 66 ++++++++++++++++++
3 files changed, 137 insertions(+), 8 deletions(-)
create mode 100755 sysdeps/unix/sysv/linux/tst-mount-compile.py
diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile
index 3f31c19e4a6..60e4cb15211 100644
--- a/sysdeps/unix/sysv/linux/Makefile
+++ b/sysdeps/unix/sysv/linux/Makefile
@@ -265,6 +265,14 @@ $(objpfx)tst-mount-consts.out: ../sysdeps/unix/sysv/linux/tst-mount-consts.py
< /dev/null > $@ 2>&1; $(evaluate-test)
$(objpfx)tst-mount-consts.out: $(sysdeps-linux-python-deps)
+tests-special += $(objpfx)tst-mount-compile.out
+$(objpfx)tst-mount-compile.out: ../sysdeps/unix/sysv/linux/tst-mount-compile.py
+ $(sysdeps-linux-python) \
+ ../sysdeps/unix/sysv/linux/tst-mount-compile.py \
+ $(sysdeps-linux-python-cc) \
+ < /dev/null > $@ 2>&1; $(evaluate-test)
+$(objpfx)tst-mount-compile.out: $(sysdeps-linux-python-deps)
+
tst-rseq-disable-ENV = GLIBC_TUNABLES=glibc.pthread.rseq=0
endif # $(subdir) == misc
diff --git a/sysdeps/unix/sysv/linux/sys/mount.h b/sysdeps/unix/sysv/linux/sys/mount.h
index df6b0dbb425..2e3fd6a7fe6 100644
--- a/sysdeps/unix/sysv/linux/sys/mount.h
+++ b/sysdeps/unix/sysv/linux/sys/mount.h
@@ -27,6 +27,13 @@
#include <stddef.h>
#include <sys/ioctl.h>
+#ifdef __has_include
+# if __has_include ("linux/mount.h")
+# include "linux/mount.h"
+# endif
+#endif
+
+
#define BLOCK_SIZE_BITS 10
#define BLOCK_SIZE (1<<BLOCK_SIZE_BITS)
@@ -35,69 +42,98 @@
supported */
enum
{
+#undef MS_RDONLY
MS_RDONLY = 1, /* Mount read-only. */
#define MS_RDONLY MS_RDONLY
+#undef MS_NOSUID
MS_NOSUID = 2, /* Ignore suid and sgid bits. */
#define MS_NOSUID MS_NOSUID
+#undef MS_NODEV
MS_NODEV = 4, /* Disallow access to device special files. */
#define MS_NODEV MS_NODEV
+#undef MS_NOEXEC
MS_NOEXEC = 8, /* Disallow program execution. */
#define MS_NOEXEC MS_NOEXEC
+#undef MS_SYNCHRONOUS
MS_SYNCHRONOUS = 16, /* Writes are synced at once. */
#define MS_SYNCHRONOUS MS_SYNCHRONOUS
+#undef MS_REMOUNT
MS_REMOUNT = 32, /* Alter flags of a mounted FS. */
#define MS_REMOUNT MS_REMOUNT
+#undef MS_MANDLOCK
MS_MANDLOCK = 64, /* Allow mandatory locks on an FS. */
#define MS_MANDLOCK MS_MANDLOCK
+#undef MS_DIRSYNC
MS_DIRSYNC = 128, /* Directory modifications are synchronous. */
#define MS_DIRSYNC MS_DIRSYNC
+#undef MS_NOSYMFOLLOW
MS_NOSYMFOLLOW = 256, /* Do not follow symlinks. */
#define MS_NOSYMFOLLOW MS_NOSYMFOLLOW
+#undef MS_NOATIME
MS_NOATIME = 1024, /* Do not update access times. */
#define MS_NOATIME MS_NOATIME
+#undef MS_NODIRATIME
MS_NODIRATIME = 2048, /* Do not update directory access times. */
#define MS_NODIRATIME MS_NODIRATIME
+#undef MS_BIND
MS_BIND = 4096, /* Bind directory at different place. */
#define MS_BIND MS_BIND
+#undef MS_MOVE
MS_MOVE = 8192,
#define MS_MOVE MS_MOVE
+#undef MS_REC
MS_REC = 16384,
#define MS_REC MS_REC
+#undef MS_SILENT
MS_SILENT = 32768,
#define MS_SILENT MS_SILENT
+#undef MS_POSIXACL
MS_POSIXACL = 1 << 16, /* VFS does not apply the umask. */
#define MS_POSIXACL MS_POSIXACL
+#undef MS_UNBINDABLE
MS_UNBINDABLE = 1 << 17, /* Change to unbindable. */
#define MS_UNBINDABLE MS_UNBINDABLE
+#undef MS_PRIVATE
MS_PRIVATE = 1 << 18, /* Change to private. */
#define MS_PRIVATE MS_PRIVATE
+#undef MS_SLAVE
MS_SLAVE = 1 << 19, /* Change to slave. */
#define MS_SLAVE MS_SLAVE
+#undef MS_SHARED
MS_SHARED = 1 << 20, /* Change to shared. */
#define MS_SHARED MS_SHARED
+#undef MS_RELATIME
MS_RELATIME = 1 << 21, /* Update atime relative to mtime/ctime. */
#define MS_RELATIME MS_RELATIME
+#undef MS_KERNMOUNT
MS_KERNMOUNT = 1 << 22, /* This is a kern_mount call. */
#define MS_KERNMOUNT MS_KERNMOUNT
+#undef MS_I_VERSION
MS_I_VERSION = 1 << 23, /* Update inode I_version field. */
#define MS_I_VERSION MS_I_VERSION
+#undef MS_STRICTATIME
MS_STRICTATIME = 1 << 24, /* Always perform atime updates. */
#define MS_STRICTATIME MS_STRICTATIME
+#undef MS_LAZYTIME
MS_LAZYTIME = 1 << 25, /* Update the on-disk [acm]times lazily. */
#define MS_LAZYTIME MS_LAZYTIME
+#undef MS_ACTIVE
MS_ACTIVE = 1 << 30,
#define MS_ACTIVE MS_ACTIVE
+#undef MS_NOUSER
MS_NOUSER = 1 << 31
#define MS_NOUSER MS_NOUSER
};
/* Flags that can be altered by MS_REMOUNT */
+#undef MS_RMT_MASK
#define MS_RMT_MASK (MS_RDONLY|MS_SYNCHRONOUS|MS_MANDLOCK|MS_I_VERSION \
|MS_LAZYTIME)
/* Magic mount flag number. Has to be or-ed to the flag values. */
+#undef MS_MGC_VAL
#define MS_MGC_VAL 0xc0ed0000 /* Magic flag number to indicate "new" flags */
#define MS_MGC_MSK 0xffff0000 /* Magic flag number mask */
@@ -106,20 +142,35 @@ enum
is probably as bad and I don't want to create yet another include
file. */
+#undef BLKROSET
#define BLKROSET _IO(0x12, 93) /* Set device read-only (0 = read-write). */
+#undef BLKROGET
#define BLKROGET _IO(0x12, 94) /* Get read-only status (0 = read_write). */
+#undef BLKRRPART
#define BLKRRPART _IO(0x12, 95) /* Re-read partition table. */
+#undef BLKGETSIZE
#define BLKGETSIZE _IO(0x12, 96) /* Return device size. */
+#undef BLKFLSBUF
#define BLKFLSBUF _IO(0x12, 97) /* Flush buffer cache. */
+#undef BLKRASET
#define BLKRASET _IO(0x12, 98) /* Set read ahead for block device. */
+#undef BLKRAGET
#define BLKRAGET _IO(0x12, 99) /* Get current read ahead setting. */
+#undef BLKFRASET
#define BLKFRASET _IO(0x12,100) /* Set filesystem read-ahead. */
+#undef BLKFRAGET
#define BLKFRAGET _IO(0x12,101) /* Get filesystem read-ahead. */
+#undef BLKSECTSET
#define BLKSECTSET _IO(0x12,102) /* Set max sectors per request. */
+#undef BLKSECTGET
#define BLKSECTGET _IO(0x12,103) /* Get max sectors per request. */
+#undef BLKSSZGET
#define BLKSSZGET _IO(0x12,104) /* Get block device sector size. */
+#undef BLKBSZGET
#define BLKBSZGET _IOR(0x12,112,size_t)
+#undef BLKBSZSET
#define BLKBSZSET _IOW(0x12,113,size_t)
+#undef BLKGETSIZE64
#define BLKGETSIZE64 _IOR(0x12,114,size_t) /* return device size. */
@@ -157,6 +208,7 @@ enum
#define MOUNT_ATTR_NOSYMFOLLOW 0x00200000 /* Do not follow symlinks. */
+#ifndef MOUNT_ATTR_SIZE_VER0
/* For mount_setattr. */
struct mount_attr
{
@@ -165,6 +217,7 @@ struct mount_attr
uint64_t propagation;
uint64_t userns_fd;
};
+#endif
#define MOUNT_ATTR_SIZE_VER0 32 /* sizeof first published struct */
@@ -185,26 +238,28 @@ struct mount_attr
#define FSPICK_EMPTY_PATH 0x00000008
+#ifndef FSOPEN_CLOEXEC
/* The type of fsconfig call made. */
enum fsconfig_command
{
FSCONFIG_SET_FLAG = 0, /* Set parameter, supplying no value */
-#define FSCONFIG_SET_FLAG FSCONFIG_SET_FLAG
+# define FSCONFIG_SET_FLAG FSCONFIG_SET_FLAG
FSCONFIG_SET_STRING = 1, /* Set parameter, supplying a string value */
-#define FSCONFIG_SET_STRING FSCONFIG_SET_STRING
+# define FSCONFIG_SET_STRING FSCONFIG_SET_STRING
FSCONFIG_SET_BINARY = 2, /* Set parameter, supplying a binary blob value */
-#define FSCONFIG_SET_BINARY FSCONFIG_SET_BINARY
+# define FSCONFIG_SET_BINARY FSCONFIG_SET_BINARY
FSCONFIG_SET_PATH = 3, /* Set parameter, supplying an object by path */
-#define FSCONFIG_SET_PATH FSCONFIG_SET_PATH
+# define FSCONFIG_SET_PATH FSCONFIG_SET_PATH
FSCONFIG_SET_PATH_EMPTY = 4, /* Set parameter, supplying an object by (empty) path */
-#define FSCONFIG_SET_PATH_EMPTY FSCONFIG_SET_PATH_EMPTY
+# define FSCONFIG_SET_PATH_EMPTY FSCONFIG_SET_PATH_EMPTY
FSCONFIG_SET_FD = 5, /* Set parameter, supplying an object by fd */
-#define FSCONFIG_SET_FD FSCONFIG_SET_FD
+# define FSCONFIG_SET_FD FSCONFIG_SET_FD
FSCONFIG_CMD_CREATE = 6, /* Invoke superblock creation */
-#define FSCONFIG_CMD_CREATE FSCONFIG_CMD_CREATE
+# define FSCONFIG_CMD_CREATE FSCONFIG_CMD_CREATE
FSCONFIG_CMD_RECONFIGURE = 7, /* Invoke superblock reconfiguration */
-#define FSCONFIG_CMD_RECONFIGURE FSCONFIG_CMD_RECONFIGURE
+# define FSCONFIG_CMD_RECONFIGURE FSCONFIG_CMD_RECONFIGURE
};
+#endif
/* open_tree flags. */
#define OPEN_TREE_CLONE 1 /* Clone the target tree and attach the clone */
diff --git a/sysdeps/unix/sysv/linux/tst-mount-compile.py b/sysdeps/unix/sysv/linux/tst-mount-compile.py
new file mode 100755
index 00000000000..0ec74d4e0b6
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/tst-mount-compile.py
@@ -0,0 +1,66 @@
+#!/usr/bin/python3
+# Check if glibc provided sys/mount.h can be used along related kernel
+# headers.
+# Copyright (C) 2022 Free Software Foundation, Inc.
+# This file is part of the GNU C Library.
+#
+# The GNU C Library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# The GNU C Library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with the GNU C Library; if not, see
+# <https://www.gnu.org/licenses/>.
+
+import argparse
+import sys
+
+import glibcextract
+
+
+def main():
+ """The main entry point."""
+ parser = argparse.ArgumentParser(
+ description='Check if glibc provided sys/mount.h can be '
+ ' used along related kernel headers.')
+ parser.add_argument('--cc', metavar='CC',
+ help='C compiler (including options) to use')
+ args = parser.parse_args()
+
+ if glibcextract.compile_c_snippet(
+ '#include <linux/mount.h>',
+ args.cc).returncode != 0:
+ sys.exit (77)
+
+ def check(testname, snippet):
+ # Add -Werror to catch macro redefinitions and _ISOMAC to avoid
+ # internal glibc definitions.
+ r = glibcextract.compile_c_snippet(snippet, args.cc,
+ '-Werror -D_ISOMAC')
+ if r.returncode != 0:
+ print('error: test {}:\n{}'.format(testname, r.output.decode()))
+ return r.returncode
+
+ status = max(
+ check("sys/mount.h + linux/mount.h",
+ "#include <sys/mount.h>\n"
+ "#include <linux/mount.h>"),
+ check("sys/mount.h + linux/fs.h",
+ "#include <sys/mount.h>\n"
+ "#include <linux/fs.h>"),
+ check("linux/mount.h + sys/mount.h",
+ "#include <linux/mount.h>\n"
+ "#include <sys/mount.h>"),
+ check("linux/fs.h + sys/mount.h",
+ "#include <linux/fs.h>\n"
+ "#include <sys/mount.h>"))
+ sys.exit(status)
+
+if __name__ == '__main__':
+ main()
--
2.23.0.windows.1

View File

@ -1,30 +0,0 @@
From c68b6044bc7945716431f1adc091b17c39b80a06 Mon Sep 17 00:00:00 2001
From: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date: Wed, 10 Aug 2022 14:24:45 -0300
Subject: [PATCH] linux: Mimic kernel defition for BLOCK_SIZE
To avoid possible warnings if the kernel header is included before
sys/mount.h.
Reviewed-by: Florian Weimer <fweimer@redhat.com>
---
sysdeps/unix/sysv/linux/sys/mount.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sysdeps/unix/sysv/linux/sys/mount.h b/sysdeps/unix/sysv/linux/sys/mount.h
index f965986ba87..df6b0dbb425 100644
--- a/sysdeps/unix/sysv/linux/sys/mount.h
+++ b/sysdeps/unix/sysv/linux/sys/mount.h
@@ -27,8 +27,8 @@
#include <stddef.h>
#include <sys/ioctl.h>
-#define BLOCK_SIZE 1024
#define BLOCK_SIZE_BITS 10
+#define BLOCK_SIZE (1<<BLOCK_SIZE_BITS)
/* These are the fs-independent mount-flags: up to 16 flags are
--
2.23.0.windows.1

View File

@ -1,176 +0,0 @@
From 0cc0033ef19bd3378445c2b851e53d7255cb1b1e Mon Sep 17 00:00:00 2001
From: Letu Ren <fantasquex@gmail.com>
Date: Fri, 21 Oct 2022 22:54:50 +0800
Subject: [PATCH] stdlib/strfrom: Add copysign to fix NAN issue on riscv (BZ
#29501)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
According to the specification of ISO/IEC TS 18661-1:2014,
The strfromd, strfromf, and strfroml functions are equivalent to
snprintf(s, n, format, fp) (7.21.6.5), except the format string contains only
the character %, an optional precision that does not contain an asterisk *, and
one of the conversion specifiers a, A, e, E, f, F, g, or G, which applies to
the type (double, float, or long double) indicated by the function suffix
(rather than by a length modifier). Use of these functions with any other 20
format string results in undefined behavior.
strfromf will convert the arguement with type float to double first.
According to the latest version of IEEE754 which is published in 2019,
Conversion of a quiet NaN from a narrower format to a wider format in the same
radix, and then back to the same narrower format, should not change the quiet
NaN payload in any way except to make it canonical.
When either an input or result is a NaN, this standard does not interpret the
sign of a NaN. However, operations on bit strings—copy, negate, abs,
copySign—specify the sign bit of a NaN result, sometimes based upon the sign
bit of a NaN operand. The logical predicates totalOrder and isSignMinus are
also affected by the sign bit of a NaN operand. For all other operations, this
standard does not specify the sign bit of a NaN result, even when there is only
one input NaN, or when the NaN is produced from an invalid operation.
converting NAN or -NAN with type float to double doesn't need to keep
the signbit. As a result, this test case isn't mandatory.
The problem is that according to RISC-V ISA manual in chapter 11.3 of
riscv-isa-20191213,
Except when otherwise stated, if the result of a floating-point operation is
NaN, it is the canonical NaN. The canonical NaN has a positive sign and all
significand bits clear except the MSB, a.k.a. the quiet bit. For
single-precision floating-point, this corresponds to the pattern 0x7fc00000.
which means that conversion -NAN from float to double won't keep the signbit.
Since glibc ought to be consistent here between types and architectures, this
patch adds copysign to fix this problem if the string is NAN. This patch
adds two different functions under sysdeps directory to work around the
issue.
This patch has been tested on x86_64 and riscv64.
Resolves: BZ #29501
v2: Change from macros to different inline functions.
v3: Add unlikely check to isnan.
v4: Fix wrong commit message header.
v5: Fix style: add space before parentheses.
v6: Add copyright.
Signed-off-by: Letu Ren <fantasquex@gmail.com>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
---
stdlib/strfrom-skeleton.c | 3 +-
.../generic/fix-float-double-convert-nan.h | 31 ++++++++++++++++
.../riscv/rvd/fix-float-double-convert-nan.h | 37 +++++++++++++++++++
3 files changed, 70 insertions(+), 1 deletion(-)
create mode 100644 sysdeps/generic/fix-float-double-convert-nan.h
create mode 100644 sysdeps/riscv/rvd/fix-float-double-convert-nan.h
diff --git a/stdlib/strfrom-skeleton.c b/stdlib/strfrom-skeleton.c
index 1fba04bf6a..36e9adcad5 100644
--- a/stdlib/strfrom-skeleton.c
+++ b/stdlib/strfrom-skeleton.c
@@ -27,6 +27,7 @@
#include <printf.h>
#include <string.h>
#include <locale/localeinfo.h>
+#include <fix-float-double-convert-nan.h>
#define UCHAR_T char
#define L_(Str) Str
@@ -61,7 +62,7 @@ STRFROM (char *dest, size_t size, const char *format, FLOAT f)
because __printf_fp and __printf_fphex only accept double and long double
as the floating-point argument. */
if (__builtin_types_compatible_p (FLOAT, float))
- fpnum.flt = f;
+ fpnum.flt = keep_sign_conversion (f);
else
fpnum.value = f;
diff --git a/sysdeps/generic/fix-float-double-convert-nan.h b/sysdeps/generic/fix-float-double-convert-nan.h
new file mode 100644
index 0000000000..66692262fc
--- /dev/null
+++ b/sysdeps/generic/fix-float-double-convert-nan.h
@@ -0,0 +1,31 @@
+/* Fix for conversion of float NAN to double. Generic version.
+ Copyright (C) 2022 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library. If not, see
+ <https://www.gnu.org/licenses/>. */
+
+#ifndef FIX_FLOAT_DOUBLE_CONVERT_NAN_H
+#define FIX_FLOAT_DOUBLE_CONVERT_NAN_H
+
+/* This function aims to work around conversions of float -NAN
+ to double returning NAN instead of the correct -NAN in some
+ architectures. */
+static inline double __attribute__ ((always_inline))
+keep_sign_conversion (float flt)
+{
+ return flt;
+}
+
+#endif
diff --git a/sysdeps/riscv/rvd/fix-float-double-convert-nan.h b/sysdeps/riscv/rvd/fix-float-double-convert-nan.h
new file mode 100644
index 0000000000..cab003f3c1
--- /dev/null
+++ b/sysdeps/riscv/rvd/fix-float-double-convert-nan.h
@@ -0,0 +1,37 @@
+/* Fix for conversion of float NAN to double. RISC-V version..
+ Copyright (C) 2022 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library. If not, see
+ <https://www.gnu.org/licenses/>. */
+
+#ifndef FIX_FLOAT_DOUBLE_CONVERT_NAN_H
+#define FIX_FLOAT_DOUBLE_CONVERT_NAN_H
+
+#include <math.h>
+
+/* RISC-V rvd instructions do not preserve the signbit of NAN
+ when converting from float to double. */
+static inline double
+keep_sign_conversion (float flt)
+{
+ if (__glibc_unlikely (isnan (flt)))
+ {
+ float x = copysignf (1.f, flt);
+ return copysign ((double) flt, (double) x);
+ }
+ return flt;
+}
+
+#endif
--
2.39.2

View File

@ -1,335 +0,0 @@
From 52a5be0df411ef3ff45c10c7c308cb92993d15b1 Mon Sep 17 00:00:00 2001
From: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date: Sun, 28 Aug 2022 16:52:53 -0300
Subject: [PATCH] syslog: Fix large messages (BZ#29536)
The a583b6add407c17cd change did not handle large messages that
would require a heap allocation correctly, where the message itself
is not take in consideration.
This patch fixes it and extend the tst-syslog to check for large
messages as well.
Checked on x86_64-linux-gnu.
Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
---
misc/syslog.c | 18 ++++---
misc/tst-syslog.c | 152 ++++++++++++++++++++++++++++++++++++++++++++++--------
2 files changed, 142 insertions(+), 28 deletions(-)
diff --git a/misc/syslog.c b/misc/syslog.c
index 554089b..b88f66c 100644
--- a/misc/syslog.c
+++ b/misc/syslog.c
@@ -193,28 +193,32 @@ __vsyslog_internal (int pri, const char *fmt, va_list ap,
int vl = __vsnprintf_internal (bufs + l, sizeof bufs - l, fmt, apc,
mode_flags);
if (0 <= vl && vl < sizeof bufs - l)
- {
- buf = bufs;
- bufsize = l + vl;
- }
+ buf = bufs;
+ bufsize = l + vl;
va_end (apc);
}
if (buf == NULL)
{
- buf = malloc (l * sizeof (char));
+ buf = malloc ((bufsize + 1) * sizeof (char));
if (buf != NULL)
{
/* Tell the cancellation handler to free this buffer. */
clarg.buf = buf;
if (has_ts)
- __snprintf (bufs, sizeof bufs,
+ __snprintf (buf, l + 1,
SYSLOG_HEADER (pri, timestamp, &msgoff, pid));
else
- __snprintf (bufs, sizeof bufs,
+ __snprintf (buf, l + 1,
SYSLOG_HEADER_WITHOUT_TS (pri, &msgoff));
+
+ va_list apc;
+ va_copy (apc, ap);
+ __vsnprintf_internal (buf + l, bufsize - l + 1, fmt, apc,
+ mode_flags);
+ va_end (apc);
}
else
{
diff --git a/misc/tst-syslog.c b/misc/tst-syslog.c
index e550d15..1d332ec 100644
--- a/misc/tst-syslog.c
+++ b/misc/tst-syslog.c
@@ -68,21 +68,19 @@ static const int priorities[] =
LOG_DEBUG
};
-enum
- {
- ident_length = 64,
- msg_length = 64
- };
+#define IDENT_LENGTH 64
+#define MSG_LENGTH 1024
#define SYSLOG_MSG_BASE "syslog_message"
#define OPENLOG_IDENT "openlog_ident"
+static char large_message[MSG_LENGTH];
struct msg_t
{
int priority;
int facility;
- char ident[ident_length];
- char msg[msg_length];
+ char ident[IDENT_LENGTH];
+ char msg[MSG_LENGTH];
pid_t pid;
};
@@ -148,6 +146,37 @@ check_syslog_message (const struct msg_t *msg, int msgnum, int options,
}
static void
+send_syslog_large (int options)
+{
+ int facility = LOG_USER;
+ int priority = LOG_INFO;
+
+ syslog (facility | priority, "%s %d %d", large_message, facility,
+ priority);
+}
+
+static void
+send_vsyslog_large (int options)
+{
+ int facility = LOG_USER;
+ int priority = LOG_INFO;
+
+ call_vsyslog (facility | priority, "%s %d %d", large_message, facility,
+ priority);
+}
+
+static bool
+check_syslog_message_large (const struct msg_t *msg, int msgnum, int options,
+ pid_t pid)
+{
+ TEST_COMPARE (msg->facility, LOG_USER);
+ TEST_COMPARE (msg->priority, LOG_INFO);
+ TEST_COMPARE_STRING (msg->msg, large_message);
+
+ return false;
+}
+
+static void
send_openlog (int options)
{
/* Define a non-default IDENT and a not default facility. */
@@ -179,6 +208,17 @@ send_openlog (int options)
closelog ();
}
+static void
+send_openlog_large (int options)
+{
+ /* Define a non-default IDENT and a not default facility. */
+ openlog (OPENLOG_IDENT, options, LOG_LOCAL0);
+
+ syslog (LOG_INFO, "%s %d %d", large_message, LOG_LOCAL0, LOG_INFO);
+
+ closelog ();
+}
+
static bool
check_openlog_message (const struct msg_t *msg, int msgnum,
int options, pid_t pid)
@@ -189,7 +229,7 @@ check_openlog_message (const struct msg_t *msg, int msgnum,
int expected_priority = priorities[msgnum % array_length (priorities)];
TEST_COMPARE (msg->priority, expected_priority);
- char expected_ident[ident_length];
+ char expected_ident[IDENT_LENGTH];
snprintf (expected_ident, sizeof (expected_ident), "%s%s%.0d%s:",
OPENLOG_IDENT,
options & LOG_PID ? "[" : "",
@@ -211,15 +251,38 @@ check_openlog_message (const struct msg_t *msg, int msgnum,
return true;
}
+static bool
+check_openlog_message_large (const struct msg_t *msg, int msgnum,
+ int options, pid_t pid)
+{
+ char expected_ident[IDENT_LENGTH];
+ snprintf (expected_ident, sizeof (expected_ident), "%s%s%.0d%s:",
+ OPENLOG_IDENT,
+ options & LOG_PID ? "[" : "",
+ options & LOG_PID ? pid : 0,
+ options & LOG_PID ? "]" : "");
+
+ TEST_COMPARE_STRING (msg->ident, expected_ident);
+ TEST_COMPARE_STRING (msg->msg, large_message);
+ TEST_COMPARE (msg->priority, LOG_INFO);
+ TEST_COMPARE (msg->facility, LOG_LOCAL0);
+
+ return false;
+}
+
static struct msg_t
parse_syslog_msg (const char *msg)
{
struct msg_t r = { .pid = -1 };
int number;
+#define STRINPUT(size) XSTRINPUT(size)
+#define XSTRINPUT(size) "%" # size "s"
+
/* The message in the form:
- <179>Apr 8 14:51:19 tst-syslog: syslog message 176 3 */
- int n = sscanf (msg, "<%3d>%*s %*d %*d:%*d:%*d %32s %64s %*d %*d",
+ <179>Apr 8 14:51:19 tst-syslog: message 176 3 */
+ int n = sscanf (msg, "<%3d>%*s %*d %*d:%*d:%*d " STRINPUT(IDENT_LENGTH)
+ " " STRINPUT(MSG_LENGTH) " %*d %*d",
&number, r.ident, r.msg);
TEST_COMPARE (n, 3);
@@ -246,7 +309,7 @@ parse_syslog_console (const char *msg)
/* The message in the form:
openlog_ident: syslog_message 128 0 */
- int n = sscanf (msg, "%32s %64s %d %d",
+ int n = sscanf (msg, STRINPUT(IDENT_LENGTH) " " STRINPUT(MSG_LENGTH) " %d %d",
r.ident, r.msg, &facility, &priority);
TEST_COMPARE (n, 4);
@@ -281,7 +344,7 @@ check_syslog_udp (void (*syslog_send)(int), int options,
int msgnum = 0;
while (1)
{
- char buf[512];
+ char buf[2048];
size_t l = xrecvfrom (server_udp, buf, sizeof (buf), 0,
(struct sockaddr *) &addr, &addrlen);
buf[l] = '\0';
@@ -325,7 +388,7 @@ check_syslog_tcp (void (*syslog_send)(int), int options,
int client_tcp = xaccept (server_tcp, NULL, NULL);
- char buf[512], *rb = buf;
+ char buf[2048], *rb = buf;
size_t rbl = sizeof (buf);
size_t prl = 0; /* Track the size of the partial record. */
int msgnum = 0;
@@ -393,20 +456,34 @@ check_syslog_console_read (FILE *fp)
}
static void
-check_syslog_console (void)
+check_syslog_console_read_large (FILE *fp)
+{
+ char buf[2048];
+ TEST_VERIFY (fgets (buf, sizeof (buf), fp) != NULL);
+ struct msg_t msg = parse_syslog_console (buf);
+
+ TEST_COMPARE_STRING (msg.ident, OPENLOG_IDENT ":");
+ TEST_COMPARE_STRING (msg.msg, large_message);
+ TEST_COMPARE (msg.priority, LOG_INFO);
+ TEST_COMPARE (msg.facility, LOG_LOCAL0);
+}
+
+static void
+check_syslog_console (void (*syslog_send)(int),
+ void (*syslog_check)(FILE *fp))
{
xmkfifo (_PATH_CONSOLE, 0666);
pid_t sender_pid = xfork ();
if (sender_pid == 0)
{
- send_openlog (LOG_CONS);
+ syslog_send (LOG_CONS);
_exit (0);
}
{
FILE *fp = xfopen (_PATH_CONSOLE, "r+");
- check_syslog_console_read (fp);
+ syslog_check (fp);
xfclose (fp);
}
@@ -425,16 +502,28 @@ send_openlog_callback (void *clousure)
}
static void
-check_syslog_perror (void)
+send_openlog_callback_large (void *clousure)
+{
+ int options = *(int *) clousure;
+ send_openlog_large (options);
+}
+
+static void
+check_syslog_perror (bool large)
{
struct support_capture_subprocess result;
- result = support_capture_subprocess (send_openlog_callback,
+ result = support_capture_subprocess (large
+ ? send_openlog_callback_large
+ : send_openlog_callback,
&(int){LOG_PERROR});
FILE *mfp = fmemopen (result.err.buffer, result.err.length, "r");
if (mfp == NULL)
FAIL_EXIT1 ("fmemopen: %m");
- check_syslog_console_read (mfp);
+ if (large)
+ check_syslog_console_read_large (mfp);
+ else
+ check_syslog_console_read (mfp);
xfclose (mfp);
support_capture_subprocess_check (&result, "tst-openlog-child", 0,
@@ -462,10 +551,31 @@ do_test (void)
check_syslog_tcp (send_openlog, LOG_PID, check_openlog_message);
/* Check the LOG_CONS option. */
- check_syslog_console ();
+ check_syslog_console (send_openlog, check_syslog_console_read);
/* Check the LOG_PERROR option. */
- check_syslog_perror ();
+ check_syslog_perror (false);
+
+ /* Similar tests as before, but with a large message to trigger the
+ syslog path that uses dynamically allocated memory. */
+ memset (large_message, 'a', sizeof large_message - 1);
+ large_message[sizeof large_message - 1] = '\0';
+
+ check_syslog_udp (send_syslog_large, 0, check_syslog_message_large);
+ check_syslog_tcp (send_syslog_large, 0, check_syslog_message_large);
+
+ check_syslog_udp (send_vsyslog_large, 0, check_syslog_message_large);
+ check_syslog_tcp (send_vsyslog_large, 0, check_syslog_message_large);
+
+ check_syslog_udp (send_openlog_large, 0, check_openlog_message_large);
+ check_syslog_tcp (send_openlog_large, 0, check_openlog_message_large);
+
+ check_syslog_udp (send_openlog_large, LOG_PID, check_openlog_message_large);
+ check_syslog_tcp (send_openlog_large, LOG_PID, check_openlog_message_large);
+
+ check_syslog_console (send_openlog_large, check_syslog_console_read_large);
+
+ check_syslog_perror (true);
return 0;
}
--
1.8.3.1

View File

@ -67,8 +67,8 @@ index e6c94dfd..c5e8deb3 100644
+ non_temporal_threshold *= threads;
+
tunable_size = TUNABLE_GET (x86_non_temporal_threshold, long int, NULL);
/* NB: Ignore the default value 0. */
if (tunable_size != 0)
if (tunable_size > minimum_non_temporal_threshold
&& tunable_size <= maximum_non_temporal_threshold)
--
2.30.0