parent
91265ee52b
commit
b55f525053
@ -1 +0,0 @@
|
|||||||
# Calculate append=skip merge(sys-kernel/calculate-sources)=>5.11,5.12
|
|
File diff suppressed because it is too large
Load Diff
@ -1,25 +0,0 @@
|
|||||||
# Calculate format=kernel name=.config
|
|
||||||
CONFIG_ACPI_ADXL=y
|
|
||||||
# CONFIG_ACPI_EXTLOG is not set
|
|
||||||
CONFIG_EDAC_AMD64_ERROR_INJECTION=y
|
|
||||||
CONFIG_EDAC_AMD64=m
|
|
||||||
# CONFIG_EDAC_DEBUG is not set
|
|
||||||
CONFIG_EDAC_DECODE_MCE=m
|
|
||||||
CONFIG_EDAC_E752X=m
|
|
||||||
CONFIG_EDAC_I10NM=m
|
|
||||||
CONFIG_EDAC_I3000=m
|
|
||||||
CONFIG_EDAC_I3200=m
|
|
||||||
CONFIG_EDAC_I5000=m
|
|
||||||
CONFIG_EDAC_I5100=m
|
|
||||||
CONFIG_EDAC_I5400=m
|
|
||||||
CONFIG_EDAC_I7300=m
|
|
||||||
CONFIG_EDAC_I7CORE=m
|
|
||||||
CONFIG_EDAC_I82975X=m
|
|
||||||
CONFIG_EDAC_IE31200=m
|
|
||||||
CONFIG_EDAC_IGEN6=m
|
|
||||||
CONFIG_EDAC_LEGACY_SYSFS=y
|
|
||||||
CONFIG_EDAC=m
|
|
||||||
CONFIG_EDAC_PND2=m
|
|
||||||
CONFIG_EDAC_SBRIDGE=m
|
|
||||||
CONFIG_EDAC_SKX=m
|
|
||||||
CONFIG_EDAC_X38=m
|
|
@ -1,14 +0,0 @@
|
|||||||
# Calculate format=kernel name=.config merge(sys-kernel/calculate-sources[-desktop])!=
|
|
||||||
# CONFIG_BT is not set
|
|
||||||
# CONFIG_GAMEPORT is not set
|
|
||||||
# CONFIG_HZ_1000 is not set
|
|
||||||
# CONFIG_INPUT_JOYSTICK is not set
|
|
||||||
# CONFIG_INPUT_MOUSE is not set
|
|
||||||
# CONFIG_INPUT_TABLET is not set
|
|
||||||
# CONFIG_INPUT_TOUCHSCREEN is not set
|
|
||||||
# CONFIG_MACINTOSH_DRIVERS is not set
|
|
||||||
# CONFIG_MEDIA_SUPPORT is not set
|
|
||||||
# CONFIG_PREEMPT is not set
|
|
||||||
# CONFIG_RC_CORE is not set
|
|
||||||
# CONFIG_SOUND is not set
|
|
||||||
# CONFIG_USB_GADGET is not set
|
|
@ -1,3 +0,0 @@
|
|||||||
# Calculate format=kernel name=.config
|
|
||||||
CONFIG_MODULE_COMPRESS_ZSTD=y
|
|
||||||
# CONFIG_MODULE_COMPRESS_XZ is not set
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,502 +0,0 @@
|
|||||||
# Calculate format=diff merge(sys-kernel/calculate-sources[fsync])!=
|
|
||||||
From df2930f79f2203bc308fa3f4ebbbe913925c9531 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Piotr Gorski <lucjan.lucjanov@gmail.com>
|
|
||||||
Date: Fri, 29 Jan 2021 13:03:58 +0100
|
|
||||||
Subject: [PATCH] futex: resync from gitlab.collabora.com
|
|
||||||
|
|
||||||
Signed-off-by: Piotr Gorski <lucjan.lucjanov@gmail.com>
|
|
||||||
---
|
|
||||||
include/uapi/linux/futex.h | 20 +++
|
|
||||||
kernel/futex.c | 357 ++++++++++++++++++++++++++++++++++++-
|
|
||||||
2 files changed, 373 insertions(+), 4 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/include/uapi/linux/futex.h b/include/uapi/linux/futex.h
|
|
||||||
index a89eb0acc..a3e760886 100644
|
|
||||||
--- a/include/uapi/linux/futex.h
|
|
||||||
+++ b/include/uapi/linux/futex.h
|
|
||||||
@@ -21,6 +21,7 @@
|
|
||||||
#define FUTEX_WAKE_BITSET 10
|
|
||||||
#define FUTEX_WAIT_REQUEUE_PI 11
|
|
||||||
#define FUTEX_CMP_REQUEUE_PI 12
|
|
||||||
+#define FUTEX_WAIT_MULTIPLE 31
|
|
||||||
|
|
||||||
#define FUTEX_PRIVATE_FLAG 128
|
|
||||||
#define FUTEX_CLOCK_REALTIME 256
|
|
||||||
@@ -40,6 +41,8 @@
|
|
||||||
FUTEX_PRIVATE_FLAG)
|
|
||||||
#define FUTEX_CMP_REQUEUE_PI_PRIVATE (FUTEX_CMP_REQUEUE_PI | \
|
|
||||||
FUTEX_PRIVATE_FLAG)
|
|
||||||
+#define FUTEX_WAIT_MULTIPLE_PRIVATE (FUTEX_WAIT_MULTIPLE | \
|
|
||||||
+ FUTEX_PRIVATE_FLAG)
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Support for robust futexes: the kernel cleans up held futexes at
|
|
||||||
@@ -150,4 +153,21 @@ struct robust_list_head {
|
|
||||||
(((op & 0xf) << 28) | ((cmp & 0xf) << 24) \
|
|
||||||
| ((oparg & 0xfff) << 12) | (cmparg & 0xfff))
|
|
||||||
|
|
||||||
+/*
|
|
||||||
+ * Maximum number of multiple futexes to wait for
|
|
||||||
+ */
|
|
||||||
+#define FUTEX_MULTIPLE_MAX_COUNT 128
|
|
||||||
+
|
|
||||||
+/**
|
|
||||||
+ * struct futex_wait_block - Block of futexes to be waited for
|
|
||||||
+ * @uaddr: User address of the futex
|
|
||||||
+ * @val: Futex value expected by userspace
|
|
||||||
+ * @bitset: Bitset for the optional bitmasked wakeup
|
|
||||||
+ */
|
|
||||||
+struct futex_wait_block {
|
|
||||||
+ __u32 __user *uaddr;
|
|
||||||
+ __u32 val;
|
|
||||||
+ __u32 bitset;
|
|
||||||
+};
|
|
||||||
+
|
|
||||||
#endif /* _UAPI_LINUX_FUTEX_H */
|
|
||||||
diff --git a/kernel/futex.c b/kernel/futex.c
|
|
||||||
index 45a13eb88..6acf2c806 100644
|
|
||||||
--- a/kernel/futex.c
|
|
||||||
+++ b/kernel/futex.c
|
|
||||||
@@ -198,6 +198,8 @@ struct futex_pi_state {
|
|
||||||
* @rt_waiter: rt_waiter storage for use with requeue_pi
|
|
||||||
* @requeue_pi_key: the requeue_pi target futex key
|
|
||||||
* @bitset: bitset for the optional bitmasked wakeup
|
|
||||||
+ * @uaddr: userspace address of futex
|
|
||||||
+ * @uval: expected futex's value
|
|
||||||
*
|
|
||||||
* We use this hashed waitqueue, instead of a normal wait_queue_entry_t, so
|
|
||||||
* we can wake only the relevant ones (hashed queues may be shared).
|
|
||||||
@@ -220,6 +222,8 @@ struct futex_q {
|
|
||||||
struct rt_mutex_waiter *rt_waiter;
|
|
||||||
union futex_key *requeue_pi_key;
|
|
||||||
u32 bitset;
|
|
||||||
+ u32 __user *uaddr;
|
|
||||||
+ u32 uval;
|
|
||||||
} __randomize_layout;
|
|
||||||
|
|
||||||
static const struct futex_q futex_q_init = {
|
|
||||||
@@ -2313,6 +2317,29 @@ static int unqueue_me(struct futex_q *q)
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
+/**
|
|
||||||
+ * unqueue_multiple() - Remove several futexes from their futex_hash_bucket
|
|
||||||
+ * @q: The list of futexes to unqueue
|
|
||||||
+ * @count: Number of futexes in the list
|
|
||||||
+ *
|
|
||||||
+ * Helper to unqueue a list of futexes. This can't fail.
|
|
||||||
+ *
|
|
||||||
+ * Return:
|
|
||||||
+ * - >=0 - Index of the last futex that was awoken;
|
|
||||||
+ * - -1 - If no futex was awoken
|
|
||||||
+ */
|
|
||||||
+static int unqueue_multiple(struct futex_q *q, int count)
|
|
||||||
+{
|
|
||||||
+ int ret = -1;
|
|
||||||
+ int i;
|
|
||||||
+
|
|
||||||
+ for (i = 0; i < count; i++) {
|
|
||||||
+ if (!unqueue_me(&q[i]))
|
|
||||||
+ ret = i;
|
|
||||||
+ }
|
|
||||||
+ return ret;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
/*
|
|
||||||
* PI futexes can not be requeued and must remove themself from the
|
|
||||||
* hash bucket. The hash bucket lock (i.e. lock_ptr) is held on entry
|
|
||||||
@@ -2680,6 +2707,205 @@ static int futex_wait_setup(u32 __user *uaddr, u32 val, unsigned int flags,
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
+/**
|
|
||||||
+ * futex_wait_multiple_setup() - Prepare to wait and enqueue multiple futexes
|
|
||||||
+ * @qs: The corresponding futex list
|
|
||||||
+ * @count: The size of the lists
|
|
||||||
+ * @flags: Futex flags (FLAGS_SHARED, etc.)
|
|
||||||
+ * @awaken: Index of the last awoken futex
|
|
||||||
+ *
|
|
||||||
+ * Prepare multiple futexes in a single step and enqueue them. This may fail if
|
|
||||||
+ * the futex list is invalid or if any futex was already awoken. On success the
|
|
||||||
+ * task is ready to interruptible sleep.
|
|
||||||
+ *
|
|
||||||
+ * Return:
|
|
||||||
+ * - 1 - One of the futexes was awaken by another thread
|
|
||||||
+ * - 0 - Success
|
|
||||||
+ * - <0 - -EFAULT, -EWOULDBLOCK or -EINVAL
|
|
||||||
+ */
|
|
||||||
+static int futex_wait_multiple_setup(struct futex_q *qs, int count,
|
|
||||||
+ unsigned int flags, int *awaken)
|
|
||||||
+{
|
|
||||||
+ struct futex_hash_bucket *hb;
|
|
||||||
+ int ret, i;
|
|
||||||
+ u32 uval;
|
|
||||||
+
|
|
||||||
+ /*
|
|
||||||
+ * Enqueuing multiple futexes is tricky, because we need to
|
|
||||||
+ * enqueue each futex in the list before dealing with the next
|
|
||||||
+ * one to avoid deadlocking on the hash bucket. But, before
|
|
||||||
+ * enqueuing, we need to make sure that current->state is
|
|
||||||
+ * TASK_INTERRUPTIBLE, so we don't absorb any awake events, which
|
|
||||||
+ * cannot be done before the get_futex_key of the next key,
|
|
||||||
+ * because it calls get_user_pages, which can sleep. Thus, we
|
|
||||||
+ * fetch the list of futexes keys in two steps, by first pinning
|
|
||||||
+ * all the memory keys in the futex key, and only then we read
|
|
||||||
+ * each key and queue the corresponding futex.
|
|
||||||
+ */
|
|
||||||
+retry:
|
|
||||||
+ for (i = 0; i < count; i++) {
|
|
||||||
+ qs[i].key = FUTEX_KEY_INIT;
|
|
||||||
+ ret = get_futex_key(qs[i].uaddr, flags & FLAGS_SHARED,
|
|
||||||
+ &qs[i].key, FUTEX_READ);
|
|
||||||
+ if (unlikely(ret)) {
|
|
||||||
+ return ret;
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ set_current_state(TASK_INTERRUPTIBLE);
|
|
||||||
+
|
|
||||||
+ for (i = 0; i < count; i++) {
|
|
||||||
+ struct futex_q *q = &qs[i];
|
|
||||||
+
|
|
||||||
+ hb = queue_lock(q);
|
|
||||||
+
|
|
||||||
+ ret = get_futex_value_locked(&uval, q->uaddr);
|
|
||||||
+ if (ret) {
|
|
||||||
+ /*
|
|
||||||
+ * We need to try to handle the fault, which
|
|
||||||
+ * cannot be done without sleep, so we need to
|
|
||||||
+ * undo all the work already done, to make sure
|
|
||||||
+ * we don't miss any wake ups. Therefore, clean
|
|
||||||
+ * up, handle the fault and retry from the
|
|
||||||
+ * beginning.
|
|
||||||
+ */
|
|
||||||
+ queue_unlock(hb);
|
|
||||||
+
|
|
||||||
+ /*
|
|
||||||
+ * Keys 0..(i-1) are implicitly put
|
|
||||||
+ * on unqueue_multiple.
|
|
||||||
+ */
|
|
||||||
+ *awaken = unqueue_multiple(qs, i);
|
|
||||||
+
|
|
||||||
+ __set_current_state(TASK_RUNNING);
|
|
||||||
+
|
|
||||||
+ /*
|
|
||||||
+ * On a real fault, prioritize the error even if
|
|
||||||
+ * some other futex was awoken. Userspace gave
|
|
||||||
+ * us a bad address, -EFAULT them.
|
|
||||||
+ */
|
|
||||||
+ ret = get_user(uval, q->uaddr);
|
|
||||||
+ if (ret)
|
|
||||||
+ return ret;
|
|
||||||
+
|
|
||||||
+ /*
|
|
||||||
+ * Even if the page fault was handled, If
|
|
||||||
+ * something was already awaken, we can safely
|
|
||||||
+ * give up and succeed to give a hint for userspace to
|
|
||||||
+ * acquire the right futex faster.
|
|
||||||
+ */
|
|
||||||
+ if (*awaken >= 0)
|
|
||||||
+ return 1;
|
|
||||||
+
|
|
||||||
+ goto retry;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (uval != q->uval) {
|
|
||||||
+ queue_unlock(hb);
|
|
||||||
+
|
|
||||||
+ /*
|
|
||||||
+ * If something was already awaken, we can
|
|
||||||
+ * safely ignore the error and succeed.
|
|
||||||
+ */
|
|
||||||
+ *awaken = unqueue_multiple(qs, i);
|
|
||||||
+ __set_current_state(TASK_RUNNING);
|
|
||||||
+ if (*awaken >= 0)
|
|
||||||
+ return 1;
|
|
||||||
+
|
|
||||||
+ return -EWOULDBLOCK;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ /*
|
|
||||||
+ * The bucket lock can't be held while dealing with the
|
|
||||||
+ * next futex. Queue each futex at this moment so hb can
|
|
||||||
+ * be unlocked.
|
|
||||||
+ */
|
|
||||||
+ queue_me(&qs[i], hb);
|
|
||||||
+ }
|
|
||||||
+ return 0;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+/**
|
|
||||||
+ * futex_wait_multiple() - Prepare to wait on and enqueue several futexes
|
|
||||||
+ * @qs: The list of futexes to wait on
|
|
||||||
+ * @op: Operation code from futex's syscall
|
|
||||||
+ * @count: The number of objects
|
|
||||||
+ * @abs_time: Timeout before giving up and returning to userspace
|
|
||||||
+ *
|
|
||||||
+ * Entry point for the FUTEX_WAIT_MULTIPLE futex operation, this function
|
|
||||||
+ * sleeps on a group of futexes and returns on the first futex that
|
|
||||||
+ * triggered, or after the timeout has elapsed.
|
|
||||||
+ *
|
|
||||||
+ * Return:
|
|
||||||
+ * - >=0 - Hint to the futex that was awoken
|
|
||||||
+ * - <0 - On error
|
|
||||||
+ */
|
|
||||||
+static int futex_wait_multiple(struct futex_q *qs, int op,
|
|
||||||
+ u32 count, ktime_t *abs_time)
|
|
||||||
+{
|
|
||||||
+ struct hrtimer_sleeper timeout, *to;
|
|
||||||
+ int ret, flags = 0, hint = 0;
|
|
||||||
+ unsigned int i;
|
|
||||||
+
|
|
||||||
+ if (!(op & FUTEX_PRIVATE_FLAG))
|
|
||||||
+ flags |= FLAGS_SHARED;
|
|
||||||
+
|
|
||||||
+ if (op & FUTEX_CLOCK_REALTIME)
|
|
||||||
+ flags |= FLAGS_CLOCKRT;
|
|
||||||
+
|
|
||||||
+ to = futex_setup_timer(abs_time, &timeout, flags, 0);
|
|
||||||
+ while (1) {
|
|
||||||
+ ret = futex_wait_multiple_setup(qs, count, flags, &hint);
|
|
||||||
+ if (ret) {
|
|
||||||
+ if (ret > 0) {
|
|
||||||
+ /* A futex was awaken during setup */
|
|
||||||
+ ret = hint;
|
|
||||||
+ }
|
|
||||||
+ break;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (to)
|
|
||||||
+ hrtimer_start_expires(&to->timer, HRTIMER_MODE_ABS);
|
|
||||||
+
|
|
||||||
+ /*
|
|
||||||
+ * Avoid sleeping if another thread already tried to
|
|
||||||
+ * wake us.
|
|
||||||
+ */
|
|
||||||
+ for (i = 0; i < count; i++) {
|
|
||||||
+ if (plist_node_empty(&qs[i].list))
|
|
||||||
+ break;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (i == count && (!to || to->task))
|
|
||||||
+ freezable_schedule();
|
|
||||||
+
|
|
||||||
+ ret = unqueue_multiple(qs, count);
|
|
||||||
+
|
|
||||||
+ __set_current_state(TASK_RUNNING);
|
|
||||||
+
|
|
||||||
+ if (ret >= 0)
|
|
||||||
+ break;
|
|
||||||
+ if (to && !to->task) {
|
|
||||||
+ ret = -ETIMEDOUT;
|
|
||||||
+ break;
|
|
||||||
+ } else if (signal_pending(current)) {
|
|
||||||
+ ret = -ERESTARTSYS;
|
|
||||||
+ break;
|
|
||||||
+ }
|
|
||||||
+ /*
|
|
||||||
+ * The final case is a spurious wakeup, for
|
|
||||||
+ * which just retry.
|
|
||||||
+ */
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (to) {
|
|
||||||
+ hrtimer_cancel(&to->timer);
|
|
||||||
+ destroy_hrtimer_on_stack(&to->timer);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ return ret;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
static int futex_wait(u32 __user *uaddr, unsigned int flags, u32 val,
|
|
||||||
ktime_t *abs_time, u32 bitset)
|
|
||||||
{
|
|
||||||
@@ -3761,6 +3987,43 @@ long do_futex(u32 __user *uaddr, int op, u32 val, ktime_t *timeout,
|
|
||||||
return -ENOSYS;
|
|
||||||
}
|
|
||||||
|
|
||||||
+/**
|
|
||||||
+ * futex_read_wait_block - Read an array of futex_wait_block from userspace
|
|
||||||
+ * @uaddr: Userspace address of the block
|
|
||||||
+ * @count: Number of blocks to be read
|
|
||||||
+ *
|
|
||||||
+ * This function creates and allocate an array of futex_q (we zero it to
|
|
||||||
+ * initialize the fields) and then, for each futex_wait_block element from
|
|
||||||
+ * userspace, fill a futex_q element with proper values.
|
|
||||||
+ */
|
|
||||||
+inline struct futex_q *futex_read_wait_block(u32 __user *uaddr, u32 count)
|
|
||||||
+{
|
|
||||||
+ unsigned int i;
|
|
||||||
+ struct futex_q *qs;
|
|
||||||
+ struct futex_wait_block fwb;
|
|
||||||
+ struct futex_wait_block __user *entry =
|
|
||||||
+ (struct futex_wait_block __user *)uaddr;
|
|
||||||
+
|
|
||||||
+ if (!count || count > FUTEX_MULTIPLE_MAX_COUNT)
|
|
||||||
+ return ERR_PTR(-EINVAL);
|
|
||||||
+
|
|
||||||
+ qs = kcalloc(count, sizeof(*qs), GFP_KERNEL);
|
|
||||||
+ if (!qs)
|
|
||||||
+ return ERR_PTR(-ENOMEM);
|
|
||||||
+
|
|
||||||
+ for (i = 0; i < count; i++) {
|
|
||||||
+ if (copy_from_user(&fwb, &entry[i], sizeof(fwb))) {
|
|
||||||
+ kfree(qs);
|
|
||||||
+ return ERR_PTR(-EFAULT);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ qs[i].uaddr = fwb.uaddr;
|
|
||||||
+ qs[i].uval = fwb.val;
|
|
||||||
+ qs[i].bitset = fwb.bitset;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ return qs;
|
|
||||||
+}
|
|
||||||
|
|
||||||
SYSCALL_DEFINE6(futex, u32 __user *, uaddr, int, op, u32, val,
|
|
||||||
struct __kernel_timespec __user *, utime, u32 __user *, uaddr2,
|
|
||||||
@@ -3773,7 +4036,8 @@ SYSCALL_DEFINE6(futex, u32 __user *, uaddr, int, op, u32, val,
|
|
||||||
|
|
||||||
if (utime && (cmd == FUTEX_WAIT || cmd == FUTEX_LOCK_PI ||
|
|
||||||
cmd == FUTEX_WAIT_BITSET ||
|
|
||||||
- cmd == FUTEX_WAIT_REQUEUE_PI)) {
|
|
||||||
+ cmd == FUTEX_WAIT_REQUEUE_PI ||
|
|
||||||
+ cmd == FUTEX_WAIT_MULTIPLE)) {
|
|
||||||
if (unlikely(should_fail_futex(!(op & FUTEX_PRIVATE_FLAG))))
|
|
||||||
return -EFAULT;
|
|
||||||
if (get_timespec64(&ts, utime))
|
|
||||||
@@ -3782,7 +4046,7 @@ SYSCALL_DEFINE6(futex, u32 __user *, uaddr, int, op, u32, val,
|
|
||||||
return -EINVAL;
|
|
||||||
|
|
||||||
t = timespec64_to_ktime(ts);
|
|
||||||
- if (cmd == FUTEX_WAIT)
|
|
||||||
+ if (cmd == FUTEX_WAIT || cmd == FUTEX_WAIT_MULTIPLE)
|
|
||||||
t = ktime_add_safe(ktime_get(), t);
|
|
||||||
else if (!(op & FUTEX_CLOCK_REALTIME))
|
|
||||||
t = timens_ktime_to_host(CLOCK_MONOTONIC, t);
|
|
||||||
@@ -3796,6 +4060,25 @@ SYSCALL_DEFINE6(futex, u32 __user *, uaddr, int, op, u32, val,
|
|
||||||
cmd == FUTEX_CMP_REQUEUE_PI || cmd == FUTEX_WAKE_OP)
|
|
||||||
val2 = (u32) (unsigned long) utime;
|
|
||||||
|
|
||||||
+ if (cmd == FUTEX_WAIT_MULTIPLE) {
|
|
||||||
+ int ret;
|
|
||||||
+ struct futex_q *qs;
|
|
||||||
+
|
|
||||||
+#ifdef CONFIG_X86_X32
|
|
||||||
+ if (unlikely(in_x32_syscall()))
|
|
||||||
+ return -ENOSYS;
|
|
||||||
+#endif
|
|
||||||
+ qs = futex_read_wait_block(uaddr, val);
|
|
||||||
+
|
|
||||||
+ if (IS_ERR(qs))
|
|
||||||
+ return PTR_ERR(qs);
|
|
||||||
+
|
|
||||||
+ ret = futex_wait_multiple(qs, op, val, tp);
|
|
||||||
+ kfree(qs);
|
|
||||||
+
|
|
||||||
+ return ret;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
return do_futex(uaddr, op, val, tp, uaddr2, val2, val3);
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -3958,6 +4241,58 @@ COMPAT_SYSCALL_DEFINE3(get_robust_list, int, pid,
|
|
||||||
#endif /* CONFIG_COMPAT */
|
|
||||||
|
|
||||||
#ifdef CONFIG_COMPAT_32BIT_TIME
|
|
||||||
+/**
|
|
||||||
+ * struct compat_futex_wait_block - Block of futexes to be waited for
|
|
||||||
+ * @uaddr: User address of the futex (compatible pointer)
|
|
||||||
+ * @val: Futex value expected by userspace
|
|
||||||
+ * @bitset: Bitset for the optional bitmasked wakeup
|
|
||||||
+ */
|
|
||||||
+struct compat_futex_wait_block {
|
|
||||||
+ compat_uptr_t uaddr;
|
|
||||||
+ __u32 pad;
|
|
||||||
+ __u32 val;
|
|
||||||
+ __u32 bitset;
|
|
||||||
+};
|
|
||||||
+
|
|
||||||
+/**
|
|
||||||
+ * compat_futex_read_wait_block - Read an array of futex_wait_block from
|
|
||||||
+ * userspace
|
|
||||||
+ * @uaddr: Userspace address of the block
|
|
||||||
+ * @count: Number of blocks to be read
|
|
||||||
+ *
|
|
||||||
+ * This function does the same as futex_read_wait_block(), except that it
|
|
||||||
+ * converts the pointer to the futex from the compat version to the regular one.
|
|
||||||
+ */
|
|
||||||
+inline struct futex_q *compat_futex_read_wait_block(u32 __user *uaddr,
|
|
||||||
+ u32 count)
|
|
||||||
+{
|
|
||||||
+ unsigned int i;
|
|
||||||
+ struct futex_q *qs;
|
|
||||||
+ struct compat_futex_wait_block fwb;
|
|
||||||
+ struct compat_futex_wait_block __user *entry =
|
|
||||||
+ (struct compat_futex_wait_block __user *)uaddr;
|
|
||||||
+
|
|
||||||
+ if (!count || count > FUTEX_MULTIPLE_MAX_COUNT)
|
|
||||||
+ return ERR_PTR(-EINVAL);
|
|
||||||
+
|
|
||||||
+ qs = kcalloc(count, sizeof(*qs), GFP_KERNEL);
|
|
||||||
+ if (!qs)
|
|
||||||
+ return ERR_PTR(-ENOMEM);
|
|
||||||
+
|
|
||||||
+ for (i = 0; i < count; i++) {
|
|
||||||
+ if (copy_from_user(&fwb, &entry[i], sizeof(fwb))) {
|
|
||||||
+ kfree(qs);
|
|
||||||
+ return ERR_PTR(-EFAULT);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ qs[i].uaddr = compat_ptr(fwb.uaddr);
|
|
||||||
+ qs[i].uval = fwb.val;
|
|
||||||
+ qs[i].bitset = fwb.bitset;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ return qs;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
SYSCALL_DEFINE6(futex_time32, u32 __user *, uaddr, int, op, u32, val,
|
|
||||||
struct old_timespec32 __user *, utime, u32 __user *, uaddr2,
|
|
||||||
u32, val3)
|
|
||||||
@@ -3969,14 +4304,15 @@ SYSCALL_DEFINE6(futex_time32, u32 __user *, uaddr, int, op, u32, val,
|
|
||||||
|
|
||||||
if (utime && (cmd == FUTEX_WAIT || cmd == FUTEX_LOCK_PI ||
|
|
||||||
cmd == FUTEX_WAIT_BITSET ||
|
|
||||||
- cmd == FUTEX_WAIT_REQUEUE_PI)) {
|
|
||||||
+ cmd == FUTEX_WAIT_REQUEUE_PI ||
|
|
||||||
+ cmd == FUTEX_WAIT_MULTIPLE)) {
|
|
||||||
if (get_old_timespec32(&ts, utime))
|
|
||||||
return -EFAULT;
|
|
||||||
if (!timespec64_valid(&ts))
|
|
||||||
return -EINVAL;
|
|
||||||
|
|
||||||
t = timespec64_to_ktime(ts);
|
|
||||||
- if (cmd == FUTEX_WAIT)
|
|
||||||
+ if (cmd == FUTEX_WAIT || cmd == FUTEX_WAIT_MULTIPLE)
|
|
||||||
t = ktime_add_safe(ktime_get(), t);
|
|
||||||
else if (!(op & FUTEX_CLOCK_REALTIME))
|
|
||||||
t = timens_ktime_to_host(CLOCK_MONOTONIC, t);
|
|
||||||
@@ -3986,6 +4322,19 @@ SYSCALL_DEFINE6(futex_time32, u32 __user *, uaddr, int, op, u32, val,
|
|
||||||
cmd == FUTEX_CMP_REQUEUE_PI || cmd == FUTEX_WAKE_OP)
|
|
||||||
val2 = (int) (unsigned long) utime;
|
|
||||||
|
|
||||||
+ if (cmd == FUTEX_WAIT_MULTIPLE) {
|
|
||||||
+ int ret;
|
|
||||||
+ struct futex_q *qs = compat_futex_read_wait_block(uaddr, val);
|
|
||||||
+
|
|
||||||
+ if (IS_ERR(qs))
|
|
||||||
+ return PTR_ERR(qs);
|
|
||||||
+
|
|
||||||
+ ret = futex_wait_multiple(qs, op, val, tp);
|
|
||||||
+ kfree(qs);
|
|
||||||
+
|
|
||||||
+ return ret;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
return do_futex(uaddr, op, val, tp, uaddr2, val2, val3);
|
|
||||||
}
|
|
||||||
#endif /* CONFIG_COMPAT_32BIT_TIME */
|
|
||||||
--
|
|
||||||
2.30.1.457.gf011795891
|
|
||||||
|
|
@ -1,74 +0,0 @@
|
|||||||
# Calculate format=diff
|
|
||||||
From 7fdea2366b0c549f929fca64eb8a33c626c99e3c Mon Sep 17 00:00:00 2001
|
|
||||||
From: Piotr Gorski <lucjan.lucjanov@gmail.com>
|
|
||||||
Date: Wed, 5 Aug 2020 16:41:38 -0800
|
|
||||||
Subject: [PATCH] init: add support for zstd compressed modules
|
|
||||||
|
|
||||||
Signed-off-by: Piotr Gorski <lucjan.lucjanov@gmail.com>
|
|
||||||
---
|
|
||||||
Makefile | 7 +++++--
|
|
||||||
init/Kconfig | 9 ++++++---
|
|
||||||
2 files changed, 11 insertions(+), 5 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/Makefile b/Makefile
|
|
||||||
index 2fce782..a87dbc8 100644
|
|
||||||
--- a/Makefile
|
|
||||||
+++ b/Makefile
|
|
||||||
@@ -1050,8 +1050,8 @@ endif # INSTALL_MOD_STRIP
|
|
||||||
export mod_strip_cmd
|
|
||||||
|
|
||||||
# CONFIG_MODULE_COMPRESS, if defined, will cause module to be compressed
|
|
||||||
-# after they are installed in agreement with CONFIG_MODULE_COMPRESS_GZIP
|
|
||||||
-# or CONFIG_MODULE_COMPRESS_XZ.
|
|
||||||
+# after they are installed in agreement with CONFIG_MODULE_COMPRESS_GZIP,
|
|
||||||
+# CONFIG_MODULE_COMPRESS_XZ, or CONFIG_MODULE_COMPRESS_ZSTD.
|
|
||||||
|
|
||||||
mod_compress_cmd = true
|
|
||||||
ifdef CONFIG_MODULE_COMPRESS
|
|
||||||
@@ -1061,6 +1061,9 @@ ifdef CONFIG_MODULE_COMPRESS
|
|
||||||
ifdef CONFIG_MODULE_COMPRESS_XZ
|
|
||||||
mod_compress_cmd = $(XZ) -f
|
|
||||||
endif # CONFIG_MODULE_COMPRESS_XZ
|
|
||||||
+ ifdef CONFIG_MODULE_COMPRESS_ZSTD
|
|
||||||
+ mod_compress_cmd = $(ZSTD) -T0 -20 --ultra --rm -f
|
|
||||||
+ endif # CONFIG_MODULE_COMPRESS_ZSTD
|
|
||||||
endif # CONFIG_MODULE_COMPRESS
|
|
||||||
export mod_compress_cmd
|
|
||||||
|
|
||||||
diff --git a/init/Kconfig b/init/Kconfig
|
|
||||||
index c4de917..a17590c 100644
|
|
||||||
--- a/init/Kconfig
|
|
||||||
+++ b/init/Kconfig
|
|
||||||
@@ -2277,8 +2277,8 @@ config MODULE_COMPRESS
|
|
||||||
bool "Compress modules on installation"
|
|
||||||
help
|
|
||||||
|
|
||||||
- Compresses kernel modules when 'make modules_install' is run; gzip or
|
|
||||||
- xz depending on "Compression algorithm" below.
|
|
||||||
+ Compresses kernel modules when 'make modules_install' is run; gzip,
|
|
||||||
+ xz, or zstd depending on "Compression algorithm" below.
|
|
||||||
|
|
||||||
module-init-tools MAY support gzip, and kmod MAY support gzip and xz.
|
|
||||||
|
|
||||||
@@ -2300,7 +2300,7 @@ choice
|
|
||||||
This determines which sort of compression will be used during
|
|
||||||
'make modules_install'.
|
|
||||||
|
|
||||||
- GZIP (default) and XZ are supported.
|
|
||||||
+ GZIP (default), XZ, and ZSTD are supported.
|
|
||||||
|
|
||||||
config MODULE_COMPRESS_GZIP
|
|
||||||
bool "GZIP"
|
|
||||||
@@ -2308,6 +2308,9 @@ config MODULE_COMPRESS_GZIP
|
|
||||||
config MODULE_COMPRESS_XZ
|
|
||||||
bool "XZ"
|
|
||||||
|
|
||||||
+config MODULE_COMPRESS_ZSTD
|
|
||||||
+ bool "ZSTD"
|
|
||||||
+
|
|
||||||
endchoice
|
|
||||||
|
|
||||||
config MODULE_ALLOW_MISSING_NAMESPACE_IMPORTS
|
|
||||||
--
|
|
||||||
2.29.2.456.g3a0b884cab
|
|
||||||
|
|
@ -1,10 +1,6 @@
|
|||||||
DIST linux-5.10.tar.xz 116606704 BLAKE2B b923d7b66309224f42f35f8a5fa219421b0a9362d2adacdadd8d96251f61f7230878ea297a269a7f3b3c56830f0b177e068691e1d7f88501a05653b0a13274d1 SHA512 95bc137d0cf9148da6a9d1f1a878698dc27b40f68e22c597544010a6c591ce1b256f083489d3ff45ff77753289b535135590194d88ef9f007d0ddab3d74de70e
|
DIST linux-5.10.tar.xz 116606704 BLAKE2B b923d7b66309224f42f35f8a5fa219421b0a9362d2adacdadd8d96251f61f7230878ea297a269a7f3b3c56830f0b177e068691e1d7f88501a05653b0a13274d1 SHA512 95bc137d0cf9148da6a9d1f1a878698dc27b40f68e22c597544010a6c591ce1b256f083489d3ff45ff77753289b535135590194d88ef9f007d0ddab3d74de70e
|
||||||
DIST linux-5.11.tar.xz 117619104 BLAKE2B 81300c27bd5476387a83123aaeb4163c73eb61e9245806c23660cb5e6a4fa88ffc9def027031335fa0270fc4080506cd415990014364e3a98b9d2e8c58a29524 SHA512 a567ec133018bb5ec00c60281479b466c26e02137a93a9c690e83997947df02b6fd94e76e8df748f6d70ceb58a19bacc3b1467de10b7a1fad2763db32b3f1330
|
|
||||||
DIST linux-5.12.tar.xz 118112412 BLAKE2B 842d921b9a73d2aaade763dbd2ec67bdfe0275baa6d628b775f5c87574ad7dc86f0419afcd48c10c1235f4bffa16084243f2cf4556e6afcd391e975fe8ba530b SHA512 be03b6fee1d1ea8087b09874d27c0a602c0b04fd90ad38b975bd2c8455a07e83c29b56814aaf1389e82305fae0e4c2d1701075a7f0a7295dd28149f967ec5b3d
|
DIST linux-5.12.tar.xz 118112412 BLAKE2B 842d921b9a73d2aaade763dbd2ec67bdfe0275baa6d628b775f5c87574ad7dc86f0419afcd48c10c1235f4bffa16084243f2cf4556e6afcd391e975fe8ba530b SHA512 be03b6fee1d1ea8087b09874d27c0a602c0b04fd90ad38b975bd2c8455a07e83c29b56814aaf1389e82305fae0e4c2d1701075a7f0a7295dd28149f967ec5b3d
|
||||||
DIST linux-5.4.tar.xz 109441440 BLAKE2B 193bc4a3147e147d5529956164ec4912fad5d5c6fb07f909ff1056e57235834173194afc686993ccd785c1ff15804de0961b625f3008cca0e27493efc8f27b13 SHA512 9f60f77e8ab972b9438ac648bed17551c8491d6585a5e85f694b2eaa4c623fbc61eb18419b2656b6795eac5deec0edaa04547fc6723fbda52256bd7f3486898f
|
DIST linux-5.4.tar.xz 109441440 BLAKE2B 193bc4a3147e147d5529956164ec4912fad5d5c6fb07f909ff1056e57235834173194afc686993ccd785c1ff15804de0961b625f3008cca0e27493efc8f27b13 SHA512 9f60f77e8ab972b9438ac648bed17551c8491d6585a5e85f694b2eaa4c623fbc61eb18419b2656b6795eac5deec0edaa04547fc6723fbda52256bd7f3486898f
|
||||||
DIST patch-5.10.32.xz 1061980 BLAKE2B 574dab80eb35810b466d4e13bb80c1aed947c7fdecd2e526c11546a42ac129209b07a3158107ba7d2c43f7050f09de8f2b30f2529af7f4c7d1cbe1794f84cc07 SHA512 2fa2457c4030e988b5f21fe18dff0c4388d54f53b5d64431ada02bbc491908e9a1edb99e8c2ecd42c1945518eb8b4a8928c961a81ccc502c0a5e9945de27d7de
|
DIST patch-5.10.42.xz 1439320 BLAKE2B c7c2b7ea7b2c5e71135142f15d8a4a7958f11cc6b44bfa157fb0791b453479285ec800bc2a20c6d9fb1748e2f92a4927933e43b6bb5a1d815f5c16e39be10eae SHA512 ce17a528f5cad21f1221529c259529dd044b5d1d05a386a53945dbbfe3d6dd79ccbc93c8534c5a6456e1984fd911d34b7a81a9c15e0ca869bb6853ee0e6b4734
|
||||||
DIST patch-5.10.41.xz 1386280 BLAKE2B 223a299c0d5902fbdc8890b95aa20707a384595e7f7d3299117f1d847f5e8bda041e45a4df076f38f1ced8103b7477b5f2c990849f7e5557f65f99ccf92841fb SHA512 58164cd7a7f75b5de01affc61795f3f9386f9e4adfcc71ea8a4f03ffe34c1ec33e48f9c537a456a06afad2cdd9af672485c51ecff0fa495ef7f72f5ee2b5fa6f
|
DIST patch-5.12.9.xz 552052 BLAKE2B d1de3a40d85315ad09fe7d188c4b8dc2e17f369954bb7ae7ce36a13dd6412459168f29547d11b1f0fe3c4fb3a48f1aa1c15748e67005ca3b7ca53297f4e6a7b3 SHA512 d1aa28613d3574bf73b9025fc8c91296c9ac3149476dd7548112a9f80a76bb8db33e6b566cd918d21000a4c84e3e2b089153e2eac3d6333eca3c5e0b6286729b
|
||||||
DIST patch-5.11.22.xz 989468 BLAKE2B 5acc1d915899d9a0c3770dc2dc088648b2d660a3832b7865f26aca1df6e9961e2153651ab09da5dfc25855e62c5baf01b00dff0e2bc07c71d91c87875b18f88f SHA512 ee3830fd837136368d02ed27973873acb943992f4d0934aed06d03bb3a5f3784c6a572d324685655effba7148795146f7936308871125634378baf4908d4223d
|
DIST patch-5.4.124.xz 3006220 BLAKE2B 394645f0cf7898c98d416e93858b3effe171d5bdbc968bccd876c41de527ce0221331a06744cc081a05407d3b539d7ab83ae526ff1cc99e9e17629af7b968932 SHA512 9a8a5388d921c55a6f620f2da0528c4d0ed4487cfa58ac876b7b9625247860e3b25bbfcd39b4ae73f34c2d2b8a45b155a149613a650a1306bdab4bad57f8f9e9
|
||||||
DIST patch-5.12.8.xz 478216 BLAKE2B dfe75a8e8ce03bd2a96151908f37bdcc3a20ae5e9530724670a8aac555cc8ac3d83c7bca38661651a60121dc8cec94818eeca599e9b2b00f70285759d638b2b8 SHA512 fbb37ec298437b3be125bcd23f9d1561c978840982b15298964c57bdda65f2c5edd505f4c382a6a2b9c89ff07674f27b77e7912a7b5a287adef263334d6150ae
|
|
||||||
DIST patch-5.4.114.xz 2841756 BLAKE2B a59deaa5ec6857506eeab1f0ea7be8df770b3252e9665f5448e9757c85e8bb0cc8719d1b3704c920dee6a8ae3412fecbcef8112794a8f106acc976fbfd2ce59c SHA512 aa24db7ad0e3992eab415de10981d291399cd00c837da95dc009084f658bc97006dacd533ae85bcb43c30d3b10cb060d1c72585315484b3917550519b7c9345a
|
|
||||||
DIST patch-5.4.123.xz 2972932 BLAKE2B 736c6230da98fab6c85d555bcfae6d3551a81bcc897a62a6d994b0fd668a5ddef5e326f5e91e2b7283f5b56d05b1b525263be76f05db3fe6f44d3e5c988ded45 SHA512 ca54bad5a466c283bb74aae632d91b831005b253b41137d69d466e59f35d687e45b3b1a8b4b4caa813bf2c55ac497cfca69bd6d0c264e56a697e1b44b6a6883f
|
|
||||||
|
@ -1,24 +0,0 @@
|
|||||||
# Copyright 1999-2015 Gentoo Foundation
|
|
||||||
# Distributed under the terms of the GNU General Public License v2
|
|
||||||
# $Header: $
|
|
||||||
|
|
||||||
EAPI=7
|
|
||||||
ETYPE="sources"
|
|
||||||
|
|
||||||
inherit calculate-kernel-8 eutils
|
|
||||||
|
|
||||||
DESCRIPTION="Calculate Linux kernel image"
|
|
||||||
KEYWORDS="~amd64"
|
|
||||||
HOMEPAGE="http://www.calculate-linux.org"
|
|
||||||
|
|
||||||
SRC_URI="${KERNEL_URI} ${ARCH_URI}"
|
|
||||||
|
|
||||||
IUSE="fsync muqss uksm"
|
|
||||||
|
|
||||||
src_unpack() {
|
|
||||||
calculate-kernel-8_src_unpack
|
|
||||||
}
|
|
||||||
|
|
||||||
pkg_postinst() {
|
|
||||||
calculate-kernel-8_pkg_postinst
|
|
||||||
}
|
|
@ -1,24 +0,0 @@
|
|||||||
# Copyright 1999-2015 Gentoo Foundation
|
|
||||||
# Distributed under the terms of the GNU General Public License v2
|
|
||||||
# $Header: $
|
|
||||||
|
|
||||||
EAPI=7
|
|
||||||
ETYPE="sources"
|
|
||||||
|
|
||||||
inherit calculate-kernel-8 eutils
|
|
||||||
|
|
||||||
DESCRIPTION="Calculate Linux kernel image"
|
|
||||||
KEYWORDS="~amd64"
|
|
||||||
HOMEPAGE="http://www.calculate-linux.org"
|
|
||||||
|
|
||||||
SRC_URI="${KERNEL_URI} ${ARCH_URI}"
|
|
||||||
|
|
||||||
IUSE="fsync muqss uksm"
|
|
||||||
|
|
||||||
src_unpack() {
|
|
||||||
calculate-kernel-8_src_unpack
|
|
||||||
}
|
|
||||||
|
|
||||||
pkg_postinst() {
|
|
||||||
calculate-kernel-8_pkg_postinst
|
|
||||||
}
|
|
@ -1,24 +0,0 @@
|
|||||||
# Copyright 1999-2015 Gentoo Foundation
|
|
||||||
# Distributed under the terms of the GNU General Public License v2
|
|
||||||
# $Header: $
|
|
||||||
|
|
||||||
EAPI=7
|
|
||||||
ETYPE="sources"
|
|
||||||
|
|
||||||
inherit calculate-kernel-8 eutils
|
|
||||||
|
|
||||||
DESCRIPTION="Calculate Linux kernel image"
|
|
||||||
KEYWORDS="~amd64"
|
|
||||||
HOMEPAGE="http://www.calculate-linux.org"
|
|
||||||
|
|
||||||
SRC_URI="${KERNEL_URI} ${ARCH_URI}"
|
|
||||||
|
|
||||||
IUSE="fsync muqss uksm"
|
|
||||||
|
|
||||||
src_unpack() {
|
|
||||||
calculate-kernel-8_src_unpack
|
|
||||||
}
|
|
||||||
|
|
||||||
pkg_postinst() {
|
|
||||||
calculate-kernel-8_pkg_postinst
|
|
||||||
}
|
|
Loading…
Reference in new issue