summaryrefslogtreecommitdiff
path: root/system
diff options
context:
space:
mode:
Diffstat (limited to 'system')
-rw-r--r--system/easy-kernel/APKBUILD4
-rw-r--r--system/easy-kernel/futex-cmpxchg.patch12
-rw-r--r--system/kbd/APKBUILD6
-rw-r--r--system/musl/APKBUILD10
-rw-r--r--system/musl/dcngettext-null-deref.patch82
-rw-r--r--system/musl/fix-file-locking-race.patch54
-rw-r--r--system/musl/getaddrinfo-regression.patch51
-rw-r--r--system/musl/ppc64-atomic.patch74
8 files changed, 288 insertions, 5 deletions
diff --git a/system/easy-kernel/APKBUILD b/system/easy-kernel/APKBUILD
index 4a9395acd..c8ac1329a 100644
--- a/system/easy-kernel/APKBUILD
+++ b/system/easy-kernel/APKBUILD
@@ -23,6 +23,7 @@ source="https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-4.14.tar.xz
config-x86_64
config-pmmx
config-aarch64
+ futex-cmpxchg.patch
"
builddir="$srcdir/linux-4.14"
@@ -108,4 +109,5 @@ e41d9111219342ad13367902242444ecdd847a93575c3f9709d6c6a075bc650f4a15be9db1a87984
1112f6c3fcfd7fdc0ef4d5e85df5d3adea430a9c7b4c2b34508a215f7ba14c863ccd7a5e17f13ed46c518bafec30cfb3ced70c465137c14ef5fc998b6cbcca1f config-ppc
438a66561200d570b3bf6ab0481d9725a9f482b1fcf852a90f99c6db5aa4ee02d2b67b57235bb7afc01515a79289407cbe111536340824d7a391ce1a658c9a76 config-x86_64
e8f7749877c5b2574e7e853b757477b8f99d757b43225d4f83d611c20215b8b2690cc85369608c2dc8f7d6a619136a2d7dde4648031e37d2ae4dcc5ba85652c8 config-pmmx
-0174e758ea318171c8036426ed0ad22aaafbdbac755732a46397686ec8dd24e977447f6fc275d59eed43ea047fc8a36061b7ad0d5862d522222455a60c943027 config-aarch64"
+0174e758ea318171c8036426ed0ad22aaafbdbac755732a46397686ec8dd24e977447f6fc275d59eed43ea047fc8a36061b7ad0d5862d522222455a60c943027 config-aarch64
+64486a4f53046a69f727cecd8c39400b50c2d2b15e3b5ca8c18b8249d25990f3a872ec064800ba3d190f9d25b4518899b9ea3675920f487108102856d6beb51e futex-cmpxchg.patch"
diff --git a/system/easy-kernel/futex-cmpxchg.patch b/system/easy-kernel/futex-cmpxchg.patch
new file mode 100644
index 000000000..9e2aabfb7
--- /dev/null
+++ b/system/easy-kernel/futex-cmpxchg.patch
@@ -0,0 +1,12 @@
+diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
+index 9f2b75f..d75d8ea 100644
+--- a/arch/powerpc/Kconfig
++++ b/arch/powerpc/Kconfig
+@@ -190,6 +190,7 @@ config PPC
+ select HAVE_FTRACE_MCOUNT_RECORD
+ select HAVE_FUNCTION_GRAPH_TRACER
+ select HAVE_FUNCTION_TRACER
++ select HAVE_FUTEX_CMPXCHG if FUTEX
+ select HAVE_GCC_PLUGINS
+ select HAVE_GENERIC_GUP
+ select HAVE_HW_BREAKPOINT if PERF_EVENTS && (PPC_BOOK3S || PPC_8xx)
diff --git a/system/kbd/APKBUILD b/system/kbd/APKBUILD
index 38a367e10..61d755e27 100644
--- a/system/kbd/APKBUILD
+++ b/system/kbd/APKBUILD
@@ -2,7 +2,7 @@
# Maintainer: A. Wilcox <awilfox@adelielinux.org>
pkgname=kbd
pkgver=2.0.4
-pkgrel=0
+pkgrel=1
pkgdesc="Console keyboard and font management utilities"
url=" "
arch="all"
@@ -10,8 +10,8 @@ license="GPL-2.0+"
depends=""
makedepends="linux-headers linux-pam-dev"
checkdepends="check-dev"
-subpackages="$pkgname-dev $pkgname-doc $pkgname-fonts::noarch
- $pkgname-keymaps::noarch $pkgname-lang"
+subpackages="$pkgname-doc $pkgname-fonts::noarch $pkgname-keymaps::noarch
+ $pkgname-lang"
source="https://mirrors.kernel.org/pub/linux/utils/kbd/kbd-$pkgver.tar.xz"
build() {
diff --git a/system/musl/APKBUILD b/system/musl/APKBUILD
index 09bb9b58b..a3a0eb81c 100644
--- a/system/musl/APKBUILD
+++ b/system/musl/APKBUILD
@@ -2,7 +2,7 @@
# Maintainer: A. Wilcox <awilfox@adelielinux.org>
pkgname=musl
pkgver=1.1.20
-pkgrel=1
+pkgrel=3
pkgdesc="System library (libc) implementation"
url="http://www.musl-libc.org/"
arch="all"
@@ -23,6 +23,10 @@ source="http://www.musl-libc.org/releases/musl-$pkgver.tar.gz
2000-pthread-internals-increase-DEFAULT_GUARD_SIZE-to-2-p.patch
3001-make-real-lastlog-h.patch
handle-aux-at_base.patch
+ fix-file-locking-race.patch
+ dcngettext-null-deref.patch
+ getaddrinfo-regression.patch
+ ppc64-atomic.patch
ldconfig
getent.c
@@ -114,6 +118,10 @@ sha512sums="d3a7a30aa375ca50d7dcfbd618581d59e1aa5378417f50a0ca5510099336fd74cc9d
2c8e1dde1834238097b2ee8a7bfb53471a0d9cff4a5e38b55f048b567deff1cdd47c170d0578a67b1a039f95a6c5fbb8cff369c75b6a3e4d7ed171e8e86ebb8c 2000-pthread-internals-increase-DEFAULT_GUARD_SIZE-to-2-p.patch
88ae443dbb8e0a4368235bdc3a1c5c7b718495afa75e06deb8e01becc76cb1f0d6964589e2204fc749c9c1b3190b8b9ac1ae2c0099cab8e2ce3ec877103d4332 3001-make-real-lastlog-h.patch
6a7ff16d95b5d1be77e0a0fbb245491817db192176496a57b22ab037637d97a185ea0b0d19da687da66c2a2f5578e4343d230f399d49fe377d8f008410974238 handle-aux-at_base.patch
+b967339d9048161583523e847be91779adb0e16cc225d6ff85ef51748269b2dab08a0b8e558ad01469135837a9df76a59bf9a31791dd4063d75bc5efe6e94861 fix-file-locking-race.patch
+a08d1b170356beea333ace1da12f8a8399ca80c5d9c32ff2fcd8562537a670214f566e4b1219a11b32129078e22fbf7009bb277b7de8550a89352a64b3b5090d dcngettext-null-deref.patch
+e3953a3a73ef11696dd3eb216e18b152ae35198d8bff686d157e27bc90fb558f9a0be518025a90534e9afd6ea1bf731ffdb6fcb202bb9368f2c8eec7ca886141 getaddrinfo-regression.patch
+aae9110eccb8cd7dcd3c957fcb01ed524598f79f7fa1a16b9993af40793545d1ec211e7e6aeabe7af7715d94cc26a473ea0acf6d6e66019bf65f03d4b8e24a4b ppc64-atomic.patch
cce2f1eeb61e55674469c26871a573cce61d739c3defe9c8f56f2b774f6ba5435849ad542a6714120efddc98c297098e9c98a1a424ac593df2243d4aa479f9a9 ldconfig
378d70e65bcc65bb4e1415354cecfa54b0c1146dfb24474b69e418cdbf7ad730472cd09f6f103e1c99ba6c324c9560bccdf287f5889bbc3ef0bdf0e08da47413 getent.c
9d42d66fb1facce2b85dad919be5be819ee290bd26ca2db00982b2f8e055a0196290a008711cbe2b18ec9eee8d2270e3b3a4692c5a1b807013baa5c2b70a2bbf iconv.c"
diff --git a/system/musl/dcngettext-null-deref.patch b/system/musl/dcngettext-null-deref.patch
new file mode 100644
index 000000000..bcc385e86
--- /dev/null
+++ b/system/musl/dcngettext-null-deref.patch
@@ -0,0 +1,82 @@
+From 017e67ddde79fa2b6187a5e56b1e92bafc7c4cd2 Mon Sep 17 00:00:00 2001
+From: Rich Felker <dalias@aerifal.cx>
+Date: Fri, 14 Sep 2018 13:00:41 -0400
+Subject: drop lazy plural forms init in dcngettext
+
+there is no good reason to wait to find and process the plural rules
+for a translated message file until a gettext form requesting plural
+rule processing is used. it just imposes additional synchronization,
+here in the form of clunky use of atomics.
+
+it looks like there may also have been a race condition where nplurals
+could be seen without plural_rule being seen, possibly leading to null
+pointer dereference. if so, this commit fixes it.
+---
+ src/locale/dcngettext.c | 35 +++++++++++++++++------------------
+ 1 file changed, 17 insertions(+), 18 deletions(-)
+
+diff --git a/src/locale/dcngettext.c b/src/locale/dcngettext.c
+index 7fbe7196..8b891d00 100644
+--- a/src/locale/dcngettext.c
++++ b/src/locale/dcngettext.c
+@@ -100,8 +100,8 @@ struct msgcat {
+ struct msgcat *next;
+ const void *map;
+ size_t map_size;
+- void *volatile plural_rule;
+- volatile int nplurals;
++ const char *plural_rule;
++ int nplurals;
+ struct binding *binding;
+ const struct __locale_map *lm;
+ int cat;
+@@ -200,20 +200,7 @@ notrans:
+ p->lm = lm;
+ p->map = map;
+ p->map_size = map_size;
+- do {
+- old_cats = cats;
+- p->next = old_cats;
+- } while (a_cas_p(&cats, old_cats, p) != old_cats);
+- }
+-
+- const char *trans = __mo_lookup(p->map, p->map_size, msgid1);
+- if (!trans) goto notrans;
+-
+- /* Non-plural-processing gettext forms pass a null pointer as
+- * msgid2 to request that dcngettext suppress plural processing. */
+- if (!msgid2) return (char *)trans;
+
+- if (!p->plural_rule) {
+ const char *rule = "n!=1;";
+ unsigned long np = 2;
+ const char *r = __mo_lookup(p->map, p->map_size, "");
+@@ -237,10 +224,22 @@ notrans:
+ rule = r+7;
+ }
+ }
+- a_store(&p->nplurals, np);
+- a_cas_p(&p->plural_rule, 0, (void *)rule);
++ p->nplurals = np;
++ p->plural_rule = rule;
++
++ do {
++ old_cats = cats;
++ p->next = old_cats;
++ } while (a_cas_p(&cats, old_cats, p) != old_cats);
+ }
+- if (p->nplurals) {
++
++ const char *trans = __mo_lookup(p->map, p->map_size, msgid1);
++ if (!trans) goto notrans;
++
++ /* Non-plural-processing gettext forms pass a null pointer as
++ * msgid2 to request that dcngettext suppress plural processing. */
++
++ if (msgid2 && p->nplurals) {
+ unsigned long plural = __pleval(p->plural_rule, n);
+ if (plural > p->nplurals) goto notrans;
+ while (plural--) {
+--
+cgit v1.2.1
+
diff --git a/system/musl/fix-file-locking-race.patch b/system/musl/fix-file-locking-race.patch
new file mode 100644
index 000000000..2ef91390a
--- /dev/null
+++ b/system/musl/fix-file-locking-race.patch
@@ -0,0 +1,54 @@
+From 0db393d3a77bb9f300a356c6a5484fc2dddb161d Mon Sep 17 00:00:00 2001
+From: Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>
+Date: Tue, 18 Sep 2018 10:03:27 +0300
+Subject: fix race condition in file locking
+
+The condition occurs when
+- thread #1 is holding the lock
+- thread #2 is waiting for it on __futexwait
+- thread #1 is about to release the lock and performs a_swap
+- thread #3 enters the __lockfile function and manages to grab the lock
+ before thread #1 calls __wake, resetting the MAYBE_WAITERS flag
+- thread #1 calls __wake
+- thread #2 wakes up but goes again to __futexwait as the lock is
+ held by thread #3
+- thread #3 releases the lock but does not call __wake as the
+ MAYBE_WAITERS flag is not set
+
+This condition results in thread #2 not being woken up. This patch fixes
+the problem by making the woken up thread ensure that the flag is
+properly set before going to sleep again.
+
+Mainainer's note: This fixes a regression introduced in commit
+c21f750727515602a9e84f2a190ee8a0a2aeb2a1.
+---
+ src/stdio/__lockfile.c | 12 ++++++------
+ 1 file changed, 6 insertions(+), 6 deletions(-)
+
+diff --git a/src/stdio/__lockfile.c b/src/stdio/__lockfile.c
+index 2ff75d8a..0dcb2a42 100644
+--- a/src/stdio/__lockfile.c
++++ b/src/stdio/__lockfile.c
+@@ -8,13 +8,13 @@ int __lockfile(FILE *f)
+ int owner = f->lock, tid = __pthread_self()->tid;
+ if ((owner & ~MAYBE_WAITERS) == tid)
+ return 0;
+- for (;;) {
+- owner = a_cas(&f->lock, 0, tid);
+- if (!owner) return 1;
+- if (a_cas(&f->lock, owner, owner|MAYBE_WAITERS)==owner) break;
++ owner = a_cas(&f->lock, 0, tid);
++ if (!owner) return 1;
++ while ((owner = a_cas(&f->lock, 0, tid|MAYBE_WAITERS))) {
++ if ((owner & MAYBE_WAITERS) ||
++ a_cas(&f->lock, owner, owner|MAYBE_WAITERS)==owner)
++ __futexwait(&f->lock, owner|MAYBE_WAITERS, 1);
+ }
+- while ((owner = a_cas(&f->lock, 0, tid|MAYBE_WAITERS)))
+- __futexwait(&f->lock, owner, 1);
+ return 1;
+ }
+
+--
+cgit v1.2.1
+
diff --git a/system/musl/getaddrinfo-regression.patch b/system/musl/getaddrinfo-regression.patch
new file mode 100644
index 000000000..28d4558b8
--- /dev/null
+++ b/system/musl/getaddrinfo-regression.patch
@@ -0,0 +1,51 @@
+From f381c118b2d4f7d914481d3cdc830ce41369b002 Mon Sep 17 00:00:00 2001
+From: Rich Felker <dalias@aerifal.cx>
+Date: Wed, 19 Sep 2018 18:03:22 -0400
+Subject: fix getaddrinfo regression with AI_ADDRCONFIG on some configurations
+
+despite not being documented to do so in the standard or Linux
+documentation, attempts to udp connect to 127.0.0.1 or ::1 generate
+EADDRNOTAVAIL when the loopback device is not configured and there is
+no default route for IPv6. this caused getaddrinfo with AI_ADDRCONFIG
+to fail with EAI_SYSTEM and EADDRNOTAVAIL on some no-IPv6
+configurations, rather than the intended behavior of detecting IPv6 as
+unsuppported and producing IPv4-only results.
+
+previously, only EAFNOSUPPORT was treated as unavailability of the
+address family being probed. instead, treat all errors related to
+inability to get an address or route as conclusive that the family
+being probed is unsupported, and only fail with EAI_SYSTEM on other
+errors.
+
+further improvements may be desirable, such as reporting EAI_AGAIN
+instead of EAI_SYSTEM for errors which are expected to be transient,
+but this patch should suffice to fix the serious regression.
+---
+ src/network/getaddrinfo.c | 11 ++++++++++-
+ 1 file changed, 10 insertions(+), 1 deletion(-)
+
+diff --git a/src/network/getaddrinfo.c b/src/network/getaddrinfo.c
+index ba26847a..e33bfa28 100644
+--- a/src/network/getaddrinfo.c
++++ b/src/network/getaddrinfo.c
+@@ -76,7 +76,16 @@ int getaddrinfo(const char *restrict host, const char *restrict serv, const stru
+ close(s);
+ if (!r) continue;
+ }
+- if (errno != EAFNOSUPPORT) return EAI_SYSTEM;
++ switch (errno) {
++ case EADDRNOTAVAIL:
++ case EAFNOSUPPORT:
++ case EHOSTUNREACH:
++ case ENETDOWN:
++ case ENETUNREACH:
++ break;
++ default:
++ return EAI_SYSTEM;
++ }
+ if (family == tf[i]) return EAI_NONAME;
+ family = tf[1-i];
+ }
+--
+cgit v1.2.1
+
diff --git a/system/musl/ppc64-atomic.patch b/system/musl/ppc64-atomic.patch
new file mode 100644
index 000000000..6e96a9048
--- /dev/null
+++ b/system/musl/ppc64-atomic.patch
@@ -0,0 +1,74 @@
+From 12817793301398241b6cb00c740f0d3ca41076e9 Mon Sep 17 00:00:00 2001
+From: Rich Felker <dalias@aerifal.cx>
+Date: Fri, 14 Sep 2018 10:47:16 -0400
+Subject: fix broken atomic store on powerpc[64]
+
+in our memory model, all atomics are supposed to be full barriers;
+stores are not release-only. this is important because store is used
+as an unlock operation in places where it needs to acquire the waiter
+count to determine if a futex wake is needed. at least in the
+malloc-internal locks, but possibly elsewhere, soft deadlocks from
+missing futex wake (breakable by poking the threads to restart the
+syscall, e.g. by attaching a tracer) were reported to occur.
+
+once the malloc lock is replaced with Jens Gustedt's new lock
+implementation (see commit 47d0bcd4762f223364e5b58d5a381aaa0cbd7c38),
+malloc will not be affected by the issue, but it's not clear that
+other uses won't be. reducing the strength of the ordering properties
+required from a_store would require a thorough analysis of how it's
+used.
+
+to fix the problem, I'm removing the powerpc[64]-specific a_store
+definition; now, the top-level atomic.h will implement a_store using
+a_barrier on both sides of the store.
+
+it's not clear to me yet whether there might be issues with the other
+atomics. it's possible that a_post_llsc needs to be replaced with a
+full barrier to guarantee the formal semanics we want, but either way
+I think the difference is unlikely to impact the way we use them.
+---
+ arch/powerpc/atomic_arch.h | 8 --------
+ arch/powerpc64/atomic_arch.h | 8 --------
+ 2 files changed, 16 deletions(-)
+
+diff --git a/arch/powerpc/atomic_arch.h b/arch/powerpc/atomic_arch.h
+index 5b65cde7..c2673919 100644
+--- a/arch/powerpc/atomic_arch.h
++++ b/arch/powerpc/atomic_arch.h
+@@ -30,14 +30,6 @@ static inline void a_post_llsc()
+ __asm__ __volatile__ ("isync" : : : "memory");
+ }
+
+-#define a_store a_store
+-static inline void a_store(volatile int *p, int v)
+-{
+- a_pre_llsc();
+- *p = v;
+- a_post_llsc();
+-}
+-
+ #define a_clz_32 a_clz_32
+ static inline int a_clz_32(uint32_t x)
+ {
+diff --git a/arch/powerpc64/atomic_arch.h b/arch/powerpc64/atomic_arch.h
+index 17cababd..2bed82be 100644
+--- a/arch/powerpc64/atomic_arch.h
++++ b/arch/powerpc64/atomic_arch.h
+@@ -48,14 +48,6 @@ static inline void a_post_llsc()
+ __asm__ __volatile__ ("isync" : : : "memory");
+ }
+
+-#define a_store a_store
+-static inline void a_store(volatile int *p, int v)
+-{
+- a_pre_llsc();
+- *p = v;
+- a_post_llsc();
+-}
+-
+ #define a_crash a_crash
+ static inline void a_crash()
+ {
+--
+cgit v1.2.1
+