Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

glibc: update with latest patches for 2.38 #3456

Merged
merged 1 commit into from
Sep 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
From 5bdef6f27c91f45505ed5444147be4ed0e9bc3c7 Mon Sep 17 00:00:00 2001
From: Aurelien Jarno <[email protected]>
Date: Mon, 28 Aug 2023 23:30:37 +0200
Subject: [PATCH] io: Fix record locking contants for powerpc64 with
__USE_FILE_OFFSET64

Commit 5f828ff824e3b7cd1 ("io: Fix F_GETLK, F_SETLK, and F_SETLKW for
powerpc64") fixed an issue with the value of the lock constants on
powerpc64 when not using __USE_FILE_OFFSET64, but it ended-up also
changing the value when using __USE_FILE_OFFSET64 causing an API change.

Fix that by also checking that define, restoring the pre
4d0fe291aed3a476a commit values:

Default values:
- F_GETLK: 5
- F_SETLK: 6
- F_SETLKW: 7

With -D_FILE_OFFSET_BITS=64:
- F_GETLK: 12
- F_SETLK: 13
- F_SETLKW: 14

At the same time, it has been noticed that there was no test for io lock
with __USE_FILE_OFFSET64, so just add one.

Tested on x86_64-linux-gnu, i686-linux-gnu and
powerpc64le-unknown-linux-gnu.

Resolves: BZ #30804.
Co-authored-by: Adhemerval Zanella <[email protected]>
Signed-off-by: Aurelien Jarno <[email protected]>
(cherry picked from commit 434bf72a94de68f0cc7fbf3c44bf38c1911b70cb)
---
NEWS | 2 ++
io/Makefile | 1 +
io/tst-fcntl-lock-lfs.c | 2 ++
sysdeps/unix/sysv/linux/powerpc/bits/fcntl.h | 2 +-
4 files changed, 6 insertions(+), 1 deletion(-)
create mode 100644 io/tst-fcntl-lock-lfs.c

diff --git a/NEWS b/NEWS
index c339cb444e..8156572cdf 100644
--- a/NEWS
+++ b/NEWS
@@ -133,6 +133,8 @@ The following bugs are resolved with this release:
[30579] malloc: trim_threshold in realloc lead to high memory usage
[30662] nscd: Group and password cache use errno in place of errval
[30723] posix_memalign repeatedly scans long bin lists
+ [30804] F_GETLK, F_SETLK, and F_SETLKW value change for powerpc64 with
+ -D_FILE_OFFSET_BITS=64

Version 2.37

diff --git a/io/Makefile b/io/Makefile
index 6ccc0e8691..8a3c83a3bb 100644
--- a/io/Makefile
+++ b/io/Makefile
@@ -192,6 +192,7 @@ tests := \
tst-fchownat \
tst-fcntl \
tst-fcntl-lock \
+ tst-fcntl-lock-lfs \
tst-fstatat \
tst-fts \
tst-fts-lfs \
diff --git a/io/tst-fcntl-lock-lfs.c b/io/tst-fcntl-lock-lfs.c
new file mode 100644
index 0000000000..f2a909fb02
--- /dev/null
+++ b/io/tst-fcntl-lock-lfs.c
@@ -0,0 +1,2 @@
+#define _FILE_OFFSET_BITS 64
+#include <io/tst-fcntl-lock.c>
diff --git a/sysdeps/unix/sysv/linux/powerpc/bits/fcntl.h b/sysdeps/unix/sysv/linux/powerpc/bits/fcntl.h
index f7615a447e..d8a291a331 100644
--- a/sysdeps/unix/sysv/linux/powerpc/bits/fcntl.h
+++ b/sysdeps/unix/sysv/linux/powerpc/bits/fcntl.h
@@ -33,7 +33,7 @@
# define __O_LARGEFILE 0200000
#endif

-#if __WORDSIZE == 64
+#if __WORDSIZE == 64 && !defined __USE_FILE_OFFSET64
# define F_GETLK 5
# define F_SETLK 6
# define F_SETLKW 7
--
2.41.0

51 changes: 51 additions & 0 deletions packages/glibc/0013-libio-Fix-oversized-__io_vtables.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
From 92201f16cbcfd9eafe314ef6654be2ea7ba25675 Mon Sep 17 00:00:00 2001
From: Adam Jackson <[email protected]>
Date: Fri, 8 Sep 2023 15:55:19 -0400
Subject: [PATCH] libio: Fix oversized __io_vtables

IO_VTABLES_LEN is the size of the struct array in bytes, not the number
of __IO_jump_t's in the array. Drops just under 384kb from .rodata on
LP64 machines.

Fixes: 3020f72618e ("libio: Remove the usage of __libc_IO_vtables")
Signed-off-by: Adam Jackson <[email protected]>
Reviewed-by: Florian Weimer <[email protected]>
Tested-by: Florian Weimer <[email protected]>
(cherry picked from commit 8cb69e054386f980f9ff4d93b157861d72b2019e)
---
libio/vtables.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libio/vtables.c b/libio/vtables.c
index 1d8ad612e9..34f7e15f1c 100644
--- a/libio/vtables.c
+++ b/libio/vtables.c
@@ -20,6 +20,7 @@
#include <libioP.h>
#include <stdio.h>
#include <ldsodefs.h>
+#include <array_length.h>
#include <pointer_guard.h>
#include <libio-macros.h>

@@ -88,7 +89,7 @@
# pragma weak __wprintf_buffer_as_file_xsputn
#endif

-const struct _IO_jump_t __io_vtables[IO_VTABLES_LEN] attribute_relro =
+const struct _IO_jump_t __io_vtables[] attribute_relro =
{
/* _IO_str_jumps */
[IO_STR_JUMPS] =
@@ -485,6 +486,8 @@ const struct _IO_jump_t __io_vtables[IO_VTABLES_LEN] attribute_relro =
},
#endif
};
+_Static_assert (array_length (__io_vtables) == IO_VTABLES_NUM,
+ "initializer count");

#ifdef SHARED

--
2.41.0

Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
From 7ae211a01b085d0bde54bd13b887ce8f9d57c2b4 Mon Sep 17 00:00:00 2001
From: Florian Weimer <[email protected]>
Date: Tue, 22 Aug 2023 13:56:25 +0200
Subject: [PATCH] elf: Do not run constructors for proxy objects

Otherwise, the ld.so constructor runs for each audit namespace
and each dlmopen namespace.

(cherry picked from commit f6c8204fd7fabf0cf4162eaf10ccf23258e4d10e)
---
elf/dl-init.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/elf/dl-init.c b/elf/dl-init.c
index 5b0732590f..ba4d2fdc85 100644
--- a/elf/dl-init.c
+++ b/elf/dl-init.c
@@ -25,10 +25,14 @@
static void
call_init (struct link_map *l, int argc, char **argv, char **env)
{
+ /* Do not run constructors for proxy objects. */
+ if (l != l->l_real)
+ return;
+
/* If the object has not been relocated, this is a bug. The
function pointers are invalid in this case. (Executables do not
- need relocation, and neither do proxy objects.) */
- assert (l->l_real->l_relocated || l->l_real->l_type == lt_executable);
+ need relocation.) */
+ assert (l->l_relocated || l->l_type == lt_executable);

if (l->l_init_called)
/* This object is all done. */
--
2.41.0

Loading