Skip to content

Commit

Permalink
fix: musl revert
Browse files Browse the repository at this point in the history
Commit `ae35b8485584d223f414b64348adf3c36106cddd` missed some changes
from `9267aecb09c9cfe5511f6e1e1678b12b2bdaf7db`.

Signed-off-by: Noel Georgi <[email protected]>
  • Loading branch information
frezbo committed Mar 28, 2024
1 parent ae35b84 commit 33d73a0
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 1 deletion.
30 changes: 30 additions & 0 deletions musl/patches/elf.h-add-typedefs.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
https://gitlab.alpinelinux.org/alpine/aports/-/raw/master/main/musl/0001-elf.h-add-typedefs-for-Elf-_Relr.patch

From 981144ebc9ff30b085af107f1337543de7b0bf94 Mon Sep 17 00:00:00 2001
From: Natanael Copa <[email protected]>
Date: Mon, 6 Nov 2023 12:29:16 +0100
Subject: [PATCH] elf.h: add typedefs for Elf*_Relr

Add typedefs for Elf32_Relr and Elf64_relr as a follow-up to commit
d32dadd60efb (ldso: support DT_RELR relative relocation format)
---
include/elf.h | 3 +++
1 file changed, 3 insertions(+)

diff --git a/include/elf.h b/include/elf.h
index 23f2c4bc..aa186d9d 100644
--- a/include/elf.h
+++ b/include/elf.h
@@ -32,6 +32,9 @@ typedef uint16_t Elf64_Section;
typedef Elf32_Half Elf32_Versym;
typedef Elf64_Half Elf64_Versym;

+typedef Elf32_Word Elf32_Relr;
+typedef Elf64_Xword Elf64_Relr;
+
#define EI_NIDENT (16)

typedef struct {
--
2.42.1

40 changes: 40 additions & 0 deletions musl/patches/revert-faccessat2.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
From 6c7fb5f32ad0fb2558d50cdaa39ff7fb0e95c58b Mon Sep 17 00:00:00 2001
From: Ariadne Conill <[email protected]>
Date: Sat, 31 Oct 2020 06:26:46 -0600
Subject: [PATCH] Revert "use new SYS_faccessat2 syscall to implement faccessat
with flags"

This reverts commit 55fb9a177316aa46c639d93dd0323d9a9a8c160c.

Causes too many problems on Alpine right now due to seccomp.
---
src/unistd/faccessat.c | 11 +++--------
1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/src/unistd/faccessat.c b/src/unistd/faccessat.c
index 557503eb..76bbd4c7 100644
--- a/src/unistd/faccessat.c
+++ b/src/unistd/faccessat.c
@@ -25,17 +25,12 @@ static int checker(void *p)

int faccessat(int fd, const char *filename, int amode, int flag)
{
- if (flag) {
- int ret = __syscall(SYS_faccessat2, fd, filename, amode, flag);
- if (ret != -ENOSYS) return __syscall_ret(ret);
- }
+ if (!flag || (flag==AT_EACCESS && getuid()==geteuid() && getgid()==getegid()))
+ return syscall(SYS_faccessat, fd, filename, amode, flag);

- if (flag & ~AT_EACCESS)
+ if (flag != AT_EACCESS)
return __syscall_ret(-EINVAL);

- if (!flag || (getuid()==geteuid() && getgid()==getegid()))
- return syscall(SYS_faccessat, fd, filename, amode);
-
char stack[1024];
sigset_t set;
pid_t pid;
--
2.29.2
3 changes: 2 additions & 1 deletion musl/pkg.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ steps:
- |
tar -xzf musl.tar.gz --strip-components=1
patch -p1 < /pkg/patches/handle-aux-at-base.patch
patch -p1 < /pkg/patches/revert-faccessat2.patch
patch -p1 < /pkg/patches/elf.h-add-typedefs.patch
mkdir build
cd build
Expand Down

0 comments on commit 33d73a0

Please sign in to comment.