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

musl: add 0 large file patch #30777

Closed
wants to merge 1 commit into from
Closed
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
musl: backport O_LARGE fix
musl 1.2.2 started defining O_LARGEFILE to an actual value for x86_64, which breaks the firefox seccomp filter when built with older musl headers. backporting this change and building firefox with it allows one to use a local more up to date musl version with firefox from repos
  • Loading branch information
dkwo committed May 10, 2021
commit af257058e055c2dc31a39ee4a5b318472cc7da54
58 changes: 58 additions & 0 deletions srcpkgs/musl/patches/fix_missing_O_LARGEFILE_values.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
author Rich Felker <[email protected]> 2020-09-03 17:37:11 -0400
committer Rich Felker <[email protected]> 2020-09-03 17:37:11 -0400
commit b8b729bd22c28c9116c2fce65dce207a35299c26

prior to commit 685e40bb09f5f24a2af54ea09c97328808f76990, x86_64 was
dkwo marked this conversation as resolved.
Show resolved Hide resolved
correctly passing O_LARGEFILE to SYS_open; it was removed (defined to
0 in the public header, and changed to use the public definition) as
part of that change, probably out of a mistaken belief that it's not
needed.

however, on a mixed system with 32-bit and 64-bit binaries, it's
important that all files be opened with O_LARGEFILE, even if the
opening process is 64-bit, in case a descriptor is passed to a 32-bit
process. otherwise, attempts to access past 2GB in the 32-bit process
could produce EOVERFLOW.

most 64-bit archs added later got this right alread, except for
mips64. x32 was also affected. there are now fixed.

diff --git a/arch/mips64/bits/fcntl.h b/arch/mips64/bits/fcntl.h
index 3bcec15e..5da1eef8 100644
--- arch/mips64/bits/fcntl.h
+++ arch/mips64/bits/fcntl.h
@@ -13,7 +13,7 @@

#define O_ASYNC 010000
#define O_DIRECT 0100000
-#define O_LARGEFILE 0
+#define O_LARGEFILE 020000
#define O_NOATIME 01000000
#define O_PATH 010000000
#define O_TMPFILE 020200000
diff --git a/arch/x32/bits/fcntl.h b/arch/x32/bits/fcntl.h
index 1b88ad39..08627f81 100644
--- arch/x32/bits/fcntl.h
+++ arch/x32/bits/fcntl.h
@@ -13,7 +13,7 @@

#define O_ASYNC 020000
#define O_DIRECT 040000
-#define O_LARGEFILE 0
+#define O_LARGEFILE 0100000
#define O_NOATIME 01000000
#define O_PATH 010000000
#define O_TMPFILE 020200000
diff --git a/arch/x86_64/bits/fcntl.h b/arch/x86_64/bits/fcntl.h
index 1b88ad39..08627f81 100644
--- arch/x86_64/bits/fcntl.h
+++ arch/x86_64/bits/fcntl.h
@@ -13,7 +13,7 @@

#define O_ASYNC 020000
#define O_DIRECT 040000
-#define O_LARGEFILE 0
+#define O_LARGEFILE 0100000
#define O_NOATIME 01000000
#define O_PATH 010000000
#define O_TMPFILE 020200000
2 changes: 1 addition & 1 deletion srcpkgs/musl/template
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@
pkgname=musl
reverts="1.2.0_1"
version=1.1.24
revision=6
revision=7
archs="*-musl"
bootstrap=yes
build_style=gnu-configure