Merge pull request #6684 from heitbaum/glibc

glibc: update to 2.36 and drop now upstream RELR patch
This commit is contained in:
Frank Hartung 2022-08-05 20:59:21 +02:00 committed by GitHub
commit 2b672105f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 293 additions and 445 deletions

View File

@ -0,0 +1,13 @@
--- a/src/util.h 2022-01-14 19:29:35.000000000 +0000
+++ b/src/util.h 2022-07-19 09:43:36.718759307 +0000
@@ -23,7 +23,9 @@
#include <stdio.h>
#include <string.h>
#include <sys/ioctl.h>
-#include <sys/mount.h>
+#define BLKGETSIZE _IO(0x12, 96) /* Return device size. */
+#define BLKSSZGET _IO(0x12,104) /* Get block device sector size. */
+#define BLKGETSIZE64 _IOR(0x12,114,size_t) /* return device size. */
#include <sys/stat.h>
#include <sys/types.h>
#include <tgmath.h>

View File

@ -2,8 +2,8 @@
# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv)
PKG_NAME="stress-ng"
PKG_VERSION="0.13.05"
PKG_SHA256="3de49e1100866634f549e99c1644283d0cde817b844a69dcf7f80afa2227d350"
PKG_VERSION="0.14.03"
PKG_SHA256="95012c62883ab5826e6157557a075df98cce3cbce2a48bb40851bcc968a8441a"
PKG_LICENSE="GPLv2"
PKG_SITE="https://github.com/ColinIanKing/stress-ng"
PKG_URL="https://github.com/ColinIanKing/stress-ng/archive/refs/tags/V${PKG_VERSION}.tar.gz"

View File

@ -1,11 +0,0 @@
--- a/Makefile 2021-05-09 11:37:35.000000000 +0000
+++ b/Makefile 2021-05-09 11:37:43.000000000 +0000
@@ -390,7 +390,7 @@
$(V)sync
config.h:
- +$(MAKE) -f Makefile.config STATIC=$(STATIC) -j
+ +$(MAKE) -f Makefile.config STATIC=$(STATIC) -j1
.PHONY:
makeconfig: config.h

View File

@ -0,0 +1,13 @@
--- a/core-helper.c 2022-06-12 11:38:26.000000000 +0000
+++ b/core-helper.c 2022-07-19 10:00:39.040379407 +0000
@@ -55,10 +55,6 @@
#include <sys/utsname.h>
#endif
-#if defined(HAVE_LINUX_FS_H)
-#include <linux/fs.h>
-#endif
-
#if defined(HAVE_SYS_VFS_H)
#include <sys/vfs.h>
#endif

View File

@ -3,8 +3,8 @@
# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv)
PKG_NAME="glibc"
PKG_VERSION="2.35"
PKG_SHA256="5123732f6b67ccd319305efd399971d58592122bcc2a6518a1bd2510dd0cf52e"
PKG_VERSION="2.36"
PKG_SHA256="1c959fea240906226062cb4b1e7ebce71a9f0e3c0836c09e7e3423d434fcfe75"
PKG_LICENSE="GPL"
PKG_SITE="https://www.gnu.org/software/libc/"
PKG_URL="https://ftp.gnu.org/pub/gnu/glibc/${PKG_NAME}-${PKG_VERSION}.tar.xz"
@ -27,7 +27,7 @@ PKG_CONFIGURE_OPTS_TARGET="BASH_SHELL=/bin/sh \
--with-__thread \
--with-binutils=${BUILD}/toolchain/bin \
--with-headers=${SYSROOT_PREFIX}/usr/include \
--enable-kernel=5.10.0 \
--enable-kernel=5.15.0 \
--without-cvs \
--without-gd \
--disable-build-nscd \

View File

@ -0,0 +1,27 @@
From 85892fbc0d6f64f564f0d4c9514a7183ad8eb985 Mon Sep 17 00:00:00 2001
From: alex <knaerzche@gmail.com>
Date: Sun, 17 Jul 2022 12:16:20 +0200
Subject: [PATCH] HACK: Don't check GLIBC_ABI_DT_RELR support for ChromeOS
libwidevinecdm.so
---
elf/dl-version.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/elf/dl-version.c b/elf/dl-version.c
index cda0889209..058394f148 100644
--- a/elf/dl-version.c
+++ b/elf/dl-version.c
@@ -373,7 +373,8 @@ _dl_check_map_versions (struct link_map *map, int verbose, int trace_mode)
if (d->d_tag == DT_NEEDED)
{
const char *name = strtab + d->d_un.d_val;
- if (strncmp (name, "libc.so.", 8) == 0)
+ if (strncmp (name, "libc.so.", 8) == 0 &&
+ strstr (map->l_name, "libwidevinecdm.so") == NULL)
{
_dl_exception_create
(&exception, DSO_FILENAME (map->l_name),
--
2.37.1

View File

@ -1,327 +0,0 @@
From 6676e967dba405ca31d57b63e096becd13d4a200 Mon Sep 17 00:00:00 2001
From: Rahul Chaudhry <rahulchaudhry@chromium.org>
Date: Thu, 15 Mar 2018 14:30:17 -0700
Subject: [PATCH 4/8] sys-libs/glibc: add support for SHT_RELR sections.
This patch adds experimental support for SHT_RELR sections, proposed
here: https://groups.google.com/forum/#!topic/generic-abi/bX460iggiKg
SHT_RELR sections are supported for arm, aarch64, and x86_64 targets.
To enable them, pass '--experimental-use-relr' flag to gold.
Definitions for the new ELF section type and dynamic array tags, as well
as the encoding used in the new section are all under discussion and are
subject to change. We plan to send the patch upstream after the gABI has
been updated to include the new definitions.
[Adrian: forward-ported to glibc 2.32]
---
elf/do-rel.h | 41 ++++++++++++++++++++++++++++++++++--
elf/dynamic-link.h | 15 +++++++++++++
elf/elf.h | 15 +++++++++++--
elf/get-dynamic-info.h | 7 ++++++
sysdeps/aarch64/dl-machine.h | 10 +++++++++
sysdeps/arm/dl-machine.h | 10 +++++++++
sysdeps/i386/dl-machine.h | 10 +++++++++
sysdeps/x86_64/dl-machine.h | 10 +++++++++
8 files changed, 114 insertions(+), 4 deletions(-)
--- a/elf/do-rel.h
+++ b/elf/do-rel.h
@@ -28,6 +28,12 @@
# define elf_machine_rel_relative elf_machine_rela_relative
#endif
+#ifdef DO_RELR
+# define elf_dynamic_do_Rel elf_dynamic_do_Relr
+# define Rel Relr
+# define elf_machine_rel_relative elf_machine_relr_relative
+#endif
+
#ifndef DO_ELF_MACHINE_REL_RELATIVE
# define DO_ELF_MACHINE_REL_RELATIVE(map, l_addr, relative) \
elf_machine_rel_relative (l_addr, relative, \
@@ -48,12 +54,12 @@ elf_dynamic_do_Rel (struct link_map *map
const ElfW(Rel) *r = (const void *) reladdr;
const ElfW(Rel) *end = (const void *) (reladdr + relsize);
ElfW(Addr) l_addr = map->l_addr;
-# if defined ELF_MACHINE_IRELATIVE && !defined RTLD_BOOTSTRAP
+# if defined ELF_MACHINE_IRELATIVE && !defined RTLD_BOOTSTRAP && !defined DO_RELR
const ElfW(Rel) *r2 = NULL;
const ElfW(Rel) *end2 = NULL;
# endif
-#if (!defined DO_RELA || !defined ELF_MACHINE_PLT_REL) && !defined RTLD_BOOTSTRAP
+#if (!defined DO_RELA || !defined ELF_MACHINE_PLT_REL) && !defined RTLD_BOOTSTRAP && !defined DO_RELR
/* We never bind lazily during ld.so bootstrap. Unfortunately gcc is
not clever enough to see through all the function calls to realize
that. */
@@ -82,8 +88,10 @@ elf_dynamic_do_Rel (struct link_map *map
else
#endif
{
+# if !defined DO_RELR
const ElfW(Sym) *const symtab =
(const void *) D_PTR (map, l_info[DT_SYMTAB]);
+# endif
const ElfW(Rel) *relative = r;
r += nrelative;
@@ -110,9 +118,36 @@ elf_dynamic_do_Rel (struct link_map *map
if (l_addr != 0 || ! map->l_info[VALIDX(DT_GNU_PRELINKED)])
# endif
#endif
+
+#ifdef DO_RELR
+ {
+ ElfW(Addr) base = 0;
+ for (; relative < end; ++relative)
+ {
+ ElfW(Relr) entry = *relative;
+ if ((entry&1) == 0)
+ {
+ elf_machine_relr_relative (l_addr, scope, (void *) (l_addr + entry));
+ base = entry + sizeof(ElfW(Addr));
+ continue;
+ }
+ ElfW(Addr) offset = base;
+ while (entry != 0)
+ {
+ entry >>= 1;
+ if ((entry&1) != 0)
+ elf_machine_relr_relative (l_addr, scope, (void *) (l_addr + offset));
+ offset += sizeof(ElfW(Addr));
+ }
+ base += (8*sizeof(ElfW(Addr)) - 1) * sizeof(ElfW(Addr));
+ }
+ }
+#else
for (; relative < r; ++relative)
DO_ELF_MACHINE_REL_RELATIVE (map, l_addr, relative);
+#endif
+#if !defined DO_RELR
#ifdef RTLD_BOOTSTRAP
/* The dynamic linker always uses versioning. */
assert (map->l_info[VERSYMIDX (DT_VERSYM)] != NULL);
@@ -211,6 +246,7 @@ elf_dynamic_do_Rel (struct link_map *map
# endif
}
#endif
+#endif
}
}
@@ -220,3 +256,4 @@ elf_dynamic_do_Rel (struct link_map *map
#undef elf_machine_rel_relative
#undef DO_ELF_MACHINE_REL_RELATIVE
#undef DO_RELA
+#undef DO_RELR
--- a/elf/dynamic-link.h
+++ b/elf/dynamic-link.h
@@ -50,6 +50,11 @@ static inline void __attribute__((always_i
elf_machine_rela_relative (ElfW(Addr) l_addr, const ElfW(Rela) *reloc,
void *const reloc_addr);
# endif
+# if ! ELF_MACHINE_NO_RELR
+static inline void __attribute__((always_inline))
+elf_machine_relr_relative (ElfW(Addr) l_addr, struct r_scope_elem *scope[],
+ void *const reloc_addr);
+# endif
# if ELF_MACHINE_NO_RELA || defined ELF_MACHINE_PLT_REL
static inline void __attribute__((always_inline))
elf_machine_lazy_rel (struct link_map *map, struct r_scope_elem *scope[],
@@ -146,6 +151,15 @@ elf_machine_lazy_rel (struct link_map *m
# define ELF_DYNAMIC_DO_RELA(map, scope, lazy, skip_ifunc) /* Nothing to do. */
# endif
+# if ! ELF_MACHINE_NO_RELR
+# define DO_RELR
+# include "do-rel.h"
+# define ELF_DYNAMIC_DO_RELR(map, scope, lazy, skip_ifunc) \
+ _ELF_DYNAMIC_DO_RELOC (RELR, Relr, map, scope, lazy, skip_ifunc, 1)
+# else
+# define ELF_DYNAMIC_DO_RELR(map, scope, lazy, skip_ifunc) /* Nothing to do. */
+# endif
+
/* This can't just be an inline function because GCC is too dumb
to inline functions containing inlines themselves. */
# define ELF_DYNAMIC_RELOCATE(map, scope, lazy, consider_profile, skip_ifunc) \
@@ -154,6 +168,7 @@ elf_machine_lazy_rel (struct link_map *m
(consider_profile)); \
ELF_DYNAMIC_DO_REL ((map), (scope), edr_lazy, skip_ifunc); \
ELF_DYNAMIC_DO_RELA ((map), (scope), edr_lazy, skip_ifunc); \
+ ELF_DYNAMIC_DO_RELR ((map), (scope), edr_lazy, skip_ifunc); \
} while (0)
#endif
--- a/elf/elf.h
+++ b/elf/elf.h
@@ -443,7 +443,8 @@ typedef struct
#define SHT_PREINIT_ARRAY 16 /* Array of pre-constructors */
#define SHT_GROUP 17 /* Section group */
#define SHT_SYMTAB_SHNDX 18 /* Extended section indices */
-#define SHT_NUM 19 /* Number of defined types. */
+#define SHT_RELR 19 /* Relative relocation, only offsets */
+#define SHT_NUM 20 /* Number of defined types. */
#define SHT_LOOS 0x60000000 /* Start OS-specific. */
#define SHT_GNU_ATTRIBUTES 0x6ffffff5 /* Object attributes. */
#define SHT_GNU_HASH 0x6ffffff6 /* GNU-style hash table. */
@@ -662,6 +663,12 @@ typedef struct
Elf64_Sxword r_addend; /* Addend */
} Elf64_Rela;
+/* Relocation table entry for relative (in section of type SHT_RELR). */
+
+typedef Elf32_Word Elf32_Relr; /* offset/bitmap for relative relocations */
+
+typedef Elf64_Xword Elf64_Relr; /* offset/bitmap for relative relocations */
+
/* How to extract and insert information held in the r_info field. */
#define ELF32_R_SYM(val) ((val) >> 8)
@@ -887,7 +894,10 @@ typedef struct
#define DT_PREINIT_ARRAY 32 /* Array with addresses of preinit fct*/
#define DT_PREINIT_ARRAYSZ 33 /* size in bytes of DT_PREINIT_ARRAY */
#define DT_SYMTAB_SHNDX 34 /* Address of SYMTAB_SHNDX section */
-#define DT_NUM 35 /* Number used */
+#define DT_RELRSZ 35
+#define DT_RELR 36
+#define DT_RELRENT 37
+#define DT_NUM 38 /* Number used */
#define DT_LOOS 0x6000000d /* Start of OS-specific */
#define DT_HIOS 0x6ffff000 /* End of OS-specific */
#define DT_LOPROC 0x70000000 /* Start of processor-specific */
@@ -939,6 +949,7 @@ typedef struct
GNU extension. */
#define DT_VERSYM 0x6ffffff0
+#define DT_RELRCOUNT 0x6ffffff8
#define DT_RELACOUNT 0x6ffffff9
#define DT_RELCOUNT 0x6ffffffa
--- a/elf/get-dynamic-info.h
+++ b/elf/get-dynamic-info.h
@@ -89,6 +89,9 @@ elf_get_dynamic_info (struct link_map *l
# if ! ELF_MACHINE_NO_REL
ADJUST_DYN_INFO (DT_REL);
# endif
+# if ! ELF_MACHINE_NO_RELR
+ ADJUST_DYN_INFO (DT_RELR);
+#endif
ADJUST_DYN_INFO (DT_JMPREL);
ADJUST_DYN_INFO (VERSYMIDX (DT_VERSYM));
ADJUST_DYN_INFO (ADDRIDX (DT_GNU_HASH));
@@ -113,6 +116,10 @@ elf_get_dynamic_info (struct link_map *l
if (info[DT_REL] != NULL)
assert (info[DT_RELENT]->d_un.d_val == sizeof (ElfW(Rel)));
#endif
+#if ! ELF_MACHINE_NO_RELR
+ if (info[DT_RELR] != NULL)
+ assert (info[DT_RELRENT]->d_un.d_val == sizeof (ElfW(Relr)));
+# endif
if (bootstrap || static_pie_bootstrap)
{
assert (info[DT_RUNPATH] == NULL);
--- a/sysdeps/aarch64/dl-machine.h
+++ b/sysdeps/aarch64/dl-machine.h
@@ -384,6 +385,15 @@ elf_machine_rela_relative (ElfW(Addr) l_
}
static inline void
+__attribute__ ((always_inline))
+elf_machine_relr_relative (ElfW(Addr) l_addr, struct r_scope_elem *scope[],
+ void *const reloc_addr_arg)
+{
+ ElfW(Addr) *const reloc_addr = reloc_addr_arg;
+ *reloc_addr += l_addr;
+}
+
+static inline void
__attribute__ ((always_inline))
elf_machine_lazy_rel (struct link_map *map, struct r_scope_elem *scope[],
ElfW(Addr) l_addr,
--- a/sysdeps/arm/dl-machine.h
+++ b/sysdeps/arm/dl-machine.h
@@ -637,6 +638,15 @@ elf_machine_rel_relative (Elf32_Addr l_a
*reloc_addr += l_addr;
}
+static inline void
+__attribute ((always_inline))
+elf_machine_relr_relative (ElfW(Addr) l_addr, struct r_scope_elem *scope[],
+ void *const reloc_addr_arg)
+{
+ ElfW(Addr) *const reloc_addr = reloc_addr_arg;
+ *reloc_addr += l_addr;
+}
+
# ifndef RTLD_BOOTSTRAP
static inline void
__attribute__ ((always_inline))
--- a/sysdeps/i386/dl-machine.h
+++ b/sysdeps/i386/dl-machine.h
@@ -626,6 +626,15 @@ elf_machine_rel_relative (Elf32_Addr l_a
*reloc_addr += l_addr;
}
+static inline void
+__attribute ((always_inline))
+elf_machine_relr_relative (ElfW(Addr) l_addr, struct r_scope_elem *scope[],
+ void *const reloc_addr_arg)
+{
+ ElfW(Addr) *const reloc_addr = reloc_addr_arg;
+ *reloc_addr += l_addr;
+}
+
# ifndef RTLD_BOOTSTRAP
static inline void
__attribute__ ((always_inline))
--- a/sysdeps/x86_64/dl-machine.h
+++ b/sysdeps/x86_64/dl-machine.h
@@ -545,6 +546,15 @@ elf_machine_rela_relative (ElfW(Addr) l_
}
static inline void
+__attribute ((always_inline))
+elf_machine_relr_relative (ElfW(Addr) l_addr, struct r_scope_elem *scope[],
+ void *const reloc_addr_arg)
+{
+ ElfW(Addr) *const reloc_addr = reloc_addr_arg;
+ *reloc_addr += l_addr;
+}
+
+static inline void
__attribute ((always_inline))
elf_machine_lazy_rel (struct link_map *map, struct r_scope_elem *scope[],
ElfW(Addr) l_addr, const ElfW(Rela) *reloc,
--- a/sysdeps/arm/dl-machine-rel.h 2022-02-03 05:27:54.000000000 +0000
+++ b/sysdeps/arm/dl-machine-rel.h 2022-04-11 10:16:03.103743770 +0000
@@ -23,6 +23,7 @@
Prelinked libraries may use Elf32_Rela though. */
#define ELF_MACHINE_NO_RELA defined RTLD_BOOTSTRAP
#define ELF_MACHINE_NO_REL 0
+#define ELF_MACHINE_NO_RELR 0
/* ARM never uses Elf32_Rela relocations for the dynamic linker.
Prelinked libraries may use Elf32_Rela though. */
--- a/sysdeps/generic/dl-machine-rel.h 2022-02-03 05:27:54.000000000 +0000
+++ b/sysdeps/generic/dl-machine-rel.h 2022-04-11 10:28:40.996539086 +0000
@@ -23,6 +23,7 @@
#define ELF_MACHINE_NO_REL 1
/* Defined if the architecture supports Elf{32,64}_Rela relocations. */
#define ELF_MACHINE_NO_RELA 0
+#define ELF_MACHINE_NO_RELR 0
/* Used to calculate the index of link_map l_reloc_result. */
#define PLTREL ElfW(Rela)
--- a/sysdeps/i386/dl-machine-rel.h 2022-02-03 05:27:54.000000000 +0000
+++ b/sysdeps/i386/dl-machine-rel.h 2022-04-11 10:16:17.677066810 +0000
@@ -23,6 +23,7 @@
Prelinked libraries may use Elf32_Rela though. */
#define ELF_MACHINE_NO_RELA defined RTLD_BOOTSTRAP
#define ELF_MACHINE_NO_REL 0
+#define ELF_MACHINE_NO_RELR 0
/* The i386 never uses Elf32_Rela relocations for the dynamic linker.
Prelinked libraries may use Elf32_Rela though. */

View File

@ -1,31 +0,0 @@
From patchwork Thu Feb 3 20:07:40 2022
Subject: [COMMITTED] linux: Fix missing __convert_scm_timestamps (BZ #28860)
Date: Thu, 3 Feb 2022 17:07:40 -0300
From: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Commit 948ce73b31 made recvmsg/recvmmsg to always call
__convert_scm_timestamps for 64 bit time_t symbol, so adjust it to
always build it for __TIMESIZE != 64.
It fixes build for architecture with 32 bit time_t support when
configured with minimum kernel of 5.1.
---
sysdeps/unix/sysv/linux/convert_scm_timestamps.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sysdeps/unix/sysv/linux/convert_scm_timestamps.c b/sysdeps/unix/sysv/linux/convert_scm_timestamps.c
index 82171bf325..dfc8c2beff 100644
--- a/sysdeps/unix/sysv/linux/convert_scm_timestamps.c
+++ b/sysdeps/unix/sysv/linux/convert_scm_timestamps.c
@@ -16,9 +16,9 @@
License along with the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
-#include <kernel-features.h>
+#include <bits/timesize.h>
-#ifndef __ASSUME_TIME64_SYSCALLS
+#if __TIMESIZE != 64
# include <stdint.h>
# include <string.h>
# include <sys/socket.h>

View File

@ -56,7 +56,7 @@ Date: Tue Oct 1 12:09:07 2013 +0300
fct4 = __nss_lookup_function (nip, "gethostbyname4_r");
if (fct4 != NULL)
@@ -826,20 +858,22 @@ gaih_inet (const char *name, const struc
@@ -826,25 +858,27 @@ gaih_inet (const char *name, const struc
if (fct != NULL)
{
@ -66,7 +66,12 @@ Date: Tue Oct 1 12:09:07 2013 +0300
+ || req->ai_family == AF_UNSPEC)
+ && suppress_af != AF_INET6)
{
gethosts (AF_INET6);
if ((result = gethosts (fct, AF_INET6, name, req, tmpbuf,
res, &status, &no_data)) != 0)
{
__resolv_context_put (res_ctx);
goto out;
}
no_inet6_data = no_data;
inet6_status = status;
}
@ -76,18 +81,18 @@ Date: Tue Oct 1 12:09:07 2013 +0300
- && (req->ai_flags & AI_V4MAPPED)
- /* Avoid generating the mapped addresses if we
- know we are not going to need them. */
- && ((req->ai_flags & AI_ALL) || !got_ipv6)))
- && ((req->ai_flags & AI_ALL) || !res->got_ipv6)))
+ if ((req->ai_family == AF_INET
+ || req->ai_family == AF_UNSPEC
+ || (req->ai_family == AF_INET6
+ && (req->ai_flags & AI_V4MAPPED)
+ /* Avoid generating the mapped addresses if we
+ know we are not going to need them. */
+ && ((req->ai_flags & AI_ALL) || !got_ipv6)))
+ && ((req->ai_flags & AI_ALL) || !res->got_ipv6)))
+ && suppress_af != AF_INET)
{
gethosts (AF_INET);
if ((result = gethosts (fct, AF_INET, name, req, tmpbuf,
res, &status, &no_data)) != 0)
--- a/sysdeps/unix/sysv/linux/check_pf.c
+++ b/sysdeps/unix/sysv/linux/check_pf.c
@@ -224,7 +224,8 @@ make_request (int fd, pid_t pid)

View File

@ -0,0 +1,39 @@
From 2701442d0cf6292f6624443c15813d6d1a3562fe Mon Sep 17 00:00:00 2001
From: Martin Liska <mliska@suse.cz>
Date: Mon, 11 Jul 2022 22:03:14 +0200
Subject: [PATCH] libsanitizer: cherry-pick 9cf13067cb5088626ba7 from upstream
9cf13067cb5088626ba7ee1ec4c42ec59c7995a0 [sanitizer] Remove #include <linux/fs.h> to resolve fsconfig_command/mount_attr conflict with glibc 2.36
---
.../sanitizer_platform_limits_posix.cpp | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cpp b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cpp
index 8ed3e92d2704..97fd07acf9d4 100644
--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cpp
+++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cpp
@@ -73,7 +73,9 @@
#include <sys/vt.h>
#include <linux/cdrom.h>
#include <linux/fd.h>
+#if SANITIZER_ANDROID
#include <linux/fs.h>
+#endif
#include <linux/hdreg.h>
#include <linux/input.h>
#include <linux/ioctl.h>
@@ -869,10 +871,10 @@ unsigned struct_ElfW_Phdr_sz = sizeof(Elf_Phdr);
unsigned IOCTL_EVIOCGPROP = IOCTL_NOT_PRESENT;
unsigned IOCTL_EVIOCSKEYCODE_V2 = IOCTL_NOT_PRESENT;
#endif
- unsigned IOCTL_FS_IOC_GETFLAGS = FS_IOC_GETFLAGS;
- unsigned IOCTL_FS_IOC_GETVERSION = FS_IOC_GETVERSION;
- unsigned IOCTL_FS_IOC_SETFLAGS = FS_IOC_SETFLAGS;
- unsigned IOCTL_FS_IOC_SETVERSION = FS_IOC_SETVERSION;
+ unsigned IOCTL_FS_IOC_GETFLAGS = _IOR('f', 1, long);
+ unsigned IOCTL_FS_IOC_GETVERSION = _IOR('v', 1, long);
+ unsigned IOCTL_FS_IOC_SETFLAGS = _IOW('f', 2, long);
+ unsigned IOCTL_FS_IOC_SETVERSION = _IOW('v', 2, long);
unsigned IOCTL_GIO_CMAP = GIO_CMAP;
unsigned IOCTL_GIO_FONT = GIO_FONT;
unsigned IOCTL_GIO_UNIMAP = GIO_UNIMAP;

View File

@ -0,0 +1,93 @@
From 21c03ad5e9d8d0350e30dae92a5e15da318a1539 Mon Sep 17 00:00:00 2001
From: Rudi Heitbaum <rudi@heitbaum.com>
Date: Sat, 23 Jul 2022 10:38:49 +0000
Subject: [PATCH] glibc: Remove #include <linux/fs.h> to resolve
fsconfig_command/mount_attr conflict with glibc 2.36
---
meson.build | 13 ++++++++++++-
src/basic/fd-util.c | 2 ++
src/core/namespace.c | 2 ++
src/shared/mount-util.c | 2 ++
4 files changed, 18 insertions(+), 1 deletion(-)
diff --git a/meson.build b/meson.build
index 5d7c8699fe0d..88fe3f5d497e 100644
--- a/meson.build
+++ b/meson.build
@@ -506,7 +506,6 @@ decl_headers = '''
#include <uchar.h>
#include <sys/mount.h>
#include <sys/stat.h>
-#include <linux/fs.h>
'''
foreach decl : ['char16_t',
@@ -518,6 +517,17 @@ foreach decl : ['char16_t',
# We get -1 if the size cannot be determined
have = cc.sizeof(decl, prefix : decl_headers, args : '-D_GNU_SOURCE') > 0
+ if decl == 'struct mount_attr'
+ if have
+ want_linux_fs_h = false
+ else
+ have = cc.sizeof(decl,
+ prefix : decl_headers + '#include <linux/fs.h>',
+ args : '-D_GNU_SOURCE') > 0
+ want_linux_fs_h = have
+ endif
+ endif
+
if decl == 'struct statx'
if have
want_linux_stat_h = false
@@ -533,6 +543,7 @@ foreach decl : ['char16_t',
endforeach
conf.set10('WANT_LINUX_STAT_H', want_linux_stat_h)
+conf.set10('WANT_LINUX_FS_H', want_linux_fs_h)
foreach ident : ['secure_getenv', '__secure_getenv']
conf.set10('HAVE_' + ident.to_upper(), cc.has_function(ident))
diff --git a/src/basic/fd-util.c b/src/basic/fd-util.c
index 6c1de92a26ca..00591d6c2d31 100644
--- a/src/basic/fd-util.c
+++ b/src/basic/fd-util.c
@@ -3,7 +3,9 @@
#include <errno.h>
#include <fcntl.h>
#include <linux/btrfs.h>
+#if WANT_LINUX_FS_H
#include <linux/fs.h>
+#endif
#include <linux/magic.h>
#include <sys/ioctl.h>
#include <sys/resource.h>
diff --git a/src/core/namespace.c b/src/core/namespace.c
index 41457ea81647..016afe4d9e90 100644
--- a/src/core/namespace.c
+++ b/src/core/namespace.c
@@ -7,7 +7,9 @@
#include <sys/file.h>
#include <sys/mount.h>
#include <unistd.h>
+#if WANT_LINUX_FS_H
#include <linux/fs.h>
+#endif
#include "alloc-util.h"
#include "base-filesystem.h"
diff --git a/src/shared/mount-util.c b/src/shared/mount-util.c
index 8cf16affcb8f..a119a7c3c1b2 100644
--- a/src/shared/mount-util.c
+++ b/src/shared/mount-util.c
@@ -7,7 +7,9 @@
#include <sys/statvfs.h>
#include <unistd.h>
#include <linux/loop.h>
+#if WANT_LINUX_FS_H
#include <linux/fs.h>
+#endif
#include "alloc-util.h"
#include "chase-symlinks.h"

View File

@ -0,0 +1,10 @@
--- a/hdparm.c 2022-07-13 16:15:50.363620844 +0000
+++ b/hdparm.c 2022-07-13 16:15:55.453615920 +0000
@@ -25,7 +25,6 @@
#include <sys/mman.h>
#include <sys/user.h>
#include <linux/types.h>
-#include <linux/fs.h>
#include <linux/major.h>
#include <endian.h>
#include <asm/byteorder.h>

View File

@ -0,0 +1,17 @@
--- a/libinstaller/linuxioctl.h 2022-07-17 12:45:43.459729359 +0000
+++ b/libinstaller/linuxioctl.h 2022-07-17 12:58:50.204815753 +0000
@@ -16,7 +16,13 @@
#include <linux/fd.h> /* Floppy geometry */
#include <linux/hdreg.h> /* Hard disk geometry */
-#include <linux/fs.h> /* FIGETBSZ, FIBMAP, FS_IOC_* */
+#define FIBMAP _IO(0x00,1) /* bmap access */
+#define FIGETBSZ _IO(0x00,2) /* get the block size used for bmap */
+
+#define FS_IOC_GETFLAGS _IOR('f', 1, long)
+#define FS_IOC_SETFLAGS _IOW('f', 2, long)
+
+#define FS_IMMUTABLE_FL 0x00000010 /* Immutable file */
#undef SECTOR_SIZE /* Defined in msdos_fs.h for no good reason */
#undef SECTOR_BITS