4.14.158-stable review
Subsystems (6)
Greg Kroah-Hartman
maintainerPATCH 182/209 mtd: rawnand: atmel: Fix spelling mistake in error message
In reply to Greg Kroah-HartmanFrom: Miquel Raynal <[email protected]>
commit e39bb786816453788836c367caefd72eceea380c upstream.
Wrong copy/paste from the previous block, the error message should refer to #size-cells instead of #address-cells.
--- drivers/mtd/nand/atmel/nand-controller.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mtd/nand/atmel/nand-controller.c +1 -1
@@ -1888,7 +1888,7 @@ static int atmel_nand_controller_add_nan ret =of_property_read_u32 (np,"#size-cells" , &val);if (ret) { -dev_err (dev,"missing #address-cells property\n" ); +dev_err (dev,"missing #size-cells property\n" );return ret; }
Greg Kroah-Hartman
maintainerPATCH 183/209 mtd: rawnand: atmel: fix possible object reference leak
In reply to Greg Kroah-HartmanFrom: Wen Yang <[email protected]>
commit a12085d13997ed15f745f33a0e01002541160179 upstream.
of_find_device_by_node() takes a reference to the struct device when it finds a match via get_device, there is no need to call get_device() twice.
We also should make sure to drop the reference to the device taken by of_find_device_by_node() on driver unbind.
--- drivers/mtd/nand/atmel/pmecc.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-)
drivers/mtd/nand/atmel/pmecc.c +15 -6
@@ -875,23 +875,32 @@ static struct atmel_pmecc *atmel_pmecc_g {struct platform_device *pdev;struct atmel_pmecc *pmecc, **ptr; +int ret; pdev =of_find_device_by_node (np); -if (!pdev || !platform_get_drvdata (pdev)) +if (!pdev)return ERR_PTR (-EPROBE_DEFER ); + pmecc =platform_get_drvdata (pdev); +if (!pmecc) { + ret = -EPROBE_DEFER ; + goto err_put_device; + } ptr =devres_alloc (devm_atmel_pmecc_put,sizeof (*ptr),GFP_KERNEL ); -if (!ptr) -return ERR_PTR (-ENOMEM ); - -get_device (&pdev->dev); - pmecc =platform_get_drvdata (pdev); +if (!ptr) { + ret = -ENOMEM ; + goto err_put_device; + } *ptr = pmecc;devres_add (userdev, ptr);return pmecc; + +err_put_device: +put_device (&pdev->dev); +return ERR_PTR (ret); }static const int atmel_pmecc_strengths[] = {2 ,4 ,8 ,12 ,24 ,32 };
Greg Kroah-Hartman
maintainerPATCH 184/209 mtd: spi-nor: cast to u64 to avoid uint overflows
In reply to Greg Kroah-HartmanFrom: huijin.park <[email protected]>
commit 84a1c2109d23df3543d96231c4fee1757299bb1a upstream.
The "params->size" is defined as "u64".
And "info->sector_size" and "info->n_sectors" are defined as unsigned int and u16.
Thus, u64 data might have strange data(loss data) if the result overflows an unsigned int.
This patch casts "info->sector_size" to an u64.
--- drivers/mtd/spi-nor/spi-nor.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mtd/spi-nor/spi-nor.c +1 -1
@@ -2382,7 +2382,7 @@ static int spi_nor_init_params(struct spmemset (params,0 ,sizeof (*params));/* Set SPI NOR sizes. */ - params->size = info->sector_size * info->n_sectors; + params->size = (u64 )info->sector_size * info->n_sectors; params->page_size = info->page_size;/* (Fast) Read settings. */
Greg Kroah-Hartman
maintainerPATCH 185/209 y2038: futex: Move compat implementation into futex.c
In reply to Greg Kroah-HartmanFrom: Arnd Bergmann <[email protected]>
commit 04e7712f4460585e5eed5b853fd8b82a9943958f upstream.
We are going to share the compat_sys_futex() handler between 64-bit architectures and 32-bit architectures that need to deal with both 32-bit and 64-bit time_t, and this is easier if both entry points are in the same file.
In fact, most other system call handlers do the same thing these days, so let's follow the trend here and merge all of futex_compat.c into futex.c.
In the process, a few minor changes have to be done to make sure everything still makes sense: handle_futex_death() and futex_cmpxchg_enabled() become local symbol, and the compat version of the fetch_robust_entry() function gets renamed to compat_fetch_robust_entry() to avoid a symbol clash.
This is intended as a purely cosmetic patch, no behavior should change.
--- include/linux/futex.h | 8 - kernel/Makefile | 3 kernel/futex.c | 195 +++++++++++++++++++++++++++++++++++++++++++++++- kernel/futex_compat.c | 202 -------------------------------------------------- 4 files changed, 192 insertions(+), 216 deletions(-)
include/linux/futex.h +0 -8
@@ -12,9 +12,6 @@ struct task_struct;long do_futex (u32 __user *uaddr,int op,u32 val,ktime_t *timeout,u32 __user *uaddr2,u32 val2,u32 val3); -extern int -handle_futex_death (u32 __user *uaddr,struct task_struct *curr,int pi); -/* * Futexes are matched on equal values of this key. * The key type depends on whether it's a shared or private mapping.
@@ -55,11 +52,6 @@ union futex_key {#ifdef CONFIG_FUTEX extern void exit_robust_list (struct task_struct *curr); -#ifdef CONFIG_HAVE_FUTEX_CMPXCHG -#define futex_cmpxchg_enabled 1 -#else -extern int futex_cmpxchg_enabled; -#endif #else static inline void exit_robust_list (struct task_struct *curr) {
kernel/Makefile +0 -3
@@ -49,9 +49,6 @@ obj-$(CONFIG_PROFILING) += profile.o obj-$(CONFIG_STACKTRACE) += stacktrace.o obj-y += time/ obj-$(CONFIG_FUTEX) += futex.o -ifeq ($(CONFIG_COMPAT),y) -obj-$(CONFIG_FUTEX) += futex_compat.o -endif obj-$(CONFIG_GENERIC_ISA_DMA) += dma.o obj-$(CONFIG_SMP) += smp.o ifneq ($(CONFIG_SMP),y)
kernel/futex.c +192 -3
219 lines not on this page · raw message
kernel/futex_compat.c deleted +0 -202
202 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 186/209 futex: Prevent robust futex exit race
In reply to Greg Kroah-HartmanFrom: Yang Tao <[email protected]>
commit ca16d5bee59807bf04deaab0a8eccecd5061528c upstream.
Robust futexes utilize the robust_list mechanism to allow the kernel to release futexes which are held when a task exits. The exit can be voluntary or caused by a signal or fault. This prevents that waiters block forever.
The futex operations in user space store a pointer to the futex they are either locking or unlocking in the op_pending member of the per task robust list.
After a lock operation has succeeded the futex is queued in the robust list linked list and the op_pending pointer is cleared.
After an unlock operation has succeeded the futex is removed from the robust list linked list and the op_pending pointer is cleared.
The robust list exit code checks for the pending operation and any futex which is queued in the linked list. It carefully checks whether the futex value is the TID of the exiting task. If so, it sets the OWNER_DIED bit and tries to wake up a potential waiter.
This is race free for the lock operation but unlock has two race scenarios where waiters might not be woken up. These issues can be observed with regular robust pthread mutexes. PI aware pthread mutexes are not affected.
(1) Unlocking task is killed after unlocking the futex value in user space
before being able to wake a waiter.
pthread_mutex_unlock()
|
V
atomic_exchange_rel (&mutex->__data.__lock, 0)
<------------------------killed
lll_futex_wake () |
|
|(__lock = 0)
|(enter kernel)
|
V
do_exit()
exit_mm()
mm_release()
exit_robust_list()
handle_futex_death()
|
|(__lock = 0)
|(uval = 0)
|
V
if ((uval & FUTEX_TID_MASK) != task_pid_vnr(curr))
return 0;
The sanity check which ensures that the user space futex is owned by
the exiting task prevents the wakeup of waiters which in consequence
block infinitely.(2) Waiting task is killed after a wakeup and before it can acquire the futex in user space.
OWNER WAITER
futex_wait()
pthread_mutex_unlock() |
| |
|(__lock = 0) |
| |
V |
futex_wake() ------------> wakeup()
|
|(return to userspace)
|(__lock = 0)
|
V
oldval = mutex->__data.__lock
<-----------------killed
atomic_compare_and_exchange_val_acq (&mutex->__data.__lock, |
id | assume_other_futex_waiters, 0) |
|
|
(enter kernel)|
|
V
do_exit()
|
|
V
handle_futex_death()
|
|(__lock = 0)
|(uval = 0)
|
V
if ((uval & FUTEX_TID_MASK) != task_pid_vnr(curr))
return 0;
The sanity check which ensures that the user space futex is owned
by the exiting task prevents the wakeup of waiters, which seems to
be correct as the exiting task does not own the futex value, but
the consequence is that other waiters wont be woken up and block
infinitely.In both scenarios the following conditions are true:
- task->robust_list->list_op_pending != NULL
- user space futex value == 0
- Regular futex (not PI)
If these conditions are met then it is reasonably safe to wake up a potential waiter in order to prevent the above problems.
As this might be a false positive it can cause spurious wakeups, but the waiter side has to handle other types of unrelated wakeups, e.g. signals gracefully anyway. So such a spurious wakeup will not affect the correctness of these operations.
This workaround must not touch the user space futex value and cannot set the OWNER_DIED bit because the lock value is 0, i.e. uncontended. Setting OWNER_DIED in this case would result in inconsistent state and subsequently in malfunction of the owner died handling in user space.
The rest of the user space state is still consistent as no other task can observe the list_op_pending entry in the exiting tasks robust list.
The eventually woken up waiter will observe the uncontended lock value and take it over.
[ tglx: Massaged changelog and comment. Made the return explicit and not
depend on the subsequent check and added constants to hand into handle_futex_death() instead of plain numbers. Fixed a few coding style issues. ]
--- kernel/futex.c | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 51 insertions(+), 7 deletions(-)
kernel/futex.c +51 -7
@@ -3475,11 +3475,16 @@ err_unlock:return ret; } +/* Constants for the pending_op argument of handle_futex_death */ +#define HANDLE_DEATH_PENDING true +#define HANDLE_DEATH_LIST false +/* * Process a futex-list entry, check whether it's owned by the * dying task, and do notification if so: */ -static int handle_futex_death (u32 __user *uaddr,struct task_struct *curr,int pi) +static int handle_futex_death (u32 __user *uaddr,struct task_struct *curr, +bool pi,bool pending_op) {u32 uval,uninitialized_var (nval ), mval;int err;
@@ -3492,6 +3497,42 @@ retry:if (get_user (uval, uaddr))return -1 ; +/* +* Special case for regular (non PI) futexes. The unlock path in +* user space has two race scenarios: +* +* 1. The unlock path releases the user space futex value and +* before it can execute the futex() syscall to wake up +* waiters it is killed. +* +* 2. A woken up waiter is killed before it can acquire the +* futex in user space. +* +* In both cases the TID validation below prevents a wakeup of +* potential waiters which can cause these waiters to block +* forever. +* +* In both cases the following conditions are met: +* +* 1) task->robust_list->list_op_pending != NULL +* @pending_op == true +* 2) User space futex value == 0 +* 3) Regular futex: @pi == false +* +* If these conditions are met, it is safe to attempt waking up a +* potential waiter without touching the user space futex value and +* trying to set the OWNER_DIED bit. The user space futex value is +* uncontended and the rest of the user space mutex state is +* consistent, so a woken waiter will just take over the +* uncontended futex. Setting the OWNER_DIED bit would create +* inconsistent state and malfunction of the user space owner died +* handling. +*/ +if (pending_op && !pi && !uval) { +futex_wake (uaddr,1 ,1 ,FUTEX_BITSET_MATCH_ANY ); +return 0 ; + } +if ((uval &FUTEX_TID_MASK ) !=task_pid_vnr (curr))return 0 ;
@@ -3611,10 +3652,11 @@ void exit_robust_list(struct task_struct* A pending lock might already be on the list, so * don't process it twice: */ -if (entry != pending) +if (entry != pending) {if (handle_futex_death ((void __user *)entry + futex_offset, - curr, pi)) + curr, pi,HANDLE_DEATH_LIST ))return ; + }if (rc)return ; entry = next_entry;
@@ -3628,9 +3670,10 @@ void exit_robust_list(struct task_structcond_resched (); } -if (pending) +if (pending) {handle_futex_death ((void __user *)pending + futex_offset, - curr, pip); + curr, pip,HANDLE_DEATH_PENDING ); + } } long do_futex(u32 __user *uaddr, int op, u32 val, ktime_t *timeout,
@@ -3805,7 +3848,8 @@ void compat_exit_robust_list(struct taskif (entry != pending) {void __user *uaddr =futex_uaddr (entry, futex_offset); -if (handle_futex_death (uaddr, curr, pi)) +if (handle_futex_death (uaddr, curr, pi, +HANDLE_DEATH_LIST ))return ; }if (rc)
@@ -3824,7 +3868,7 @@ void compat_exit_robust_list(struct taskif (pending) {void __user *uaddr =futex_uaddr (pending, futex_offset); -handle_futex_death (uaddr, curr, pip); +handle_futex_death (uaddr, curr, pip,HANDLE_DEATH_PENDING ); } }
Greg Kroah-Hartman
maintainerPATCH 187/209 futex: Move futex exit handling into futex code
In reply to Greg Kroah-HartmanFrom: Thomas Gleixner <[email protected]>
commit ba31c1a48538992316cc71ce94fa9cd3e7b427c0 upstream.
The futex exit handling is #ifdeffed into mm_release() which is not pretty to begin with. But upcoming changes to address futex exit races need to add more functionality to this exit code.
Split it out into a function, move it into futex code and make the various futex exit functions static.
Preparatory only and no functional change.
Folded build fix from Borislav.
--- include/linux/compat.h | 2 -- include/linux/futex.h | 25 ++++++++++++++++--------- kernel/fork.c | 25 +++---------------------- kernel/futex.c | 33 +++++++++++++++++++++++++++++---- 4 files changed, 48 insertions(+), 37 deletions(-)
include/linux/compat.h +0 -2
@@ -324,8 +324,6 @@ struct compat_kexec_segment;struct compat_mq_attr ;struct compat_msgbuf ; -extern void compat_exit_robust_list (struct task_struct *curr); -asmlinkage long compat_sys_set_robust_list (struct compat_robust_list_head __user *head,compat_size_t len);
include/linux/futex.h +16 -9
@@ -2,7 +2,9 @@#ifndef _LINUX_FUTEX_H#define _LINUX_FUTEX_H +#include <linux/sched.h> #include <linux/ktime.h> +#include <uapi/linux/futex.h> struct inode ;
@@ -51,19 +53,24 @@ union futex_key {#define FUTEX_KEY_INIT (union futex_key) { .both = { .ptr = NULL } }#ifdef CONFIG_FUTEX -extern void exit_robust_list (struct task_struct *curr); -#else -static inline void exit_robust_list (struct task_struct *curr) + +static inline void futex_init_task (struct task_struct *tsk) { -} + tsk->robust_list =NULL ; +#ifdef CONFIG_COMPAT + tsk->compat_robust_list =NULL ;#endif +INIT_LIST_HEAD (&tsk->pi_state_list); + tsk->pi_state_cache =NULL ; +} -#ifdef CONFIG_FUTEX_PI -extern void exit_pi_state_list (struct task_struct *curr); +void futex_mm_release (struct task_struct *tsk); + +long do_futex (u32 __user *uaddr,int op,u32 val,ktime_t *timeout, +u32 __user *uaddr2,u32 val2,u32 val3);#else -static inline void exit_pi_state_list (struct task_struct *curr) -{ -} +static inline void futex_init_task (struct task_struct *tsk) { } +static inline void futex_mm_release (struct task_struct *tsk) { }#endif #endif
kernel/fork.c +3 -22
@@ -1135,20 +1135,7 @@ static int wait_for_vfork_done(struct tavoid mm_release (struct task_struct *tsk,struct mm_struct *mm) {/* Get rid of any futexes when releasing the mm */ -#ifdef CONFIG_FUTEX -if (unlikely (tsk->robust_list)) { -exit_robust_list (tsk); - tsk->robust_list =NULL ; - } -#ifdef CONFIG_COMPAT -if (unlikely (tsk->compat_robust_list)) { -compat_exit_robust_list (tsk); - tsk->compat_robust_list =NULL ; - } -#endif -if (unlikely (!list_empty (&tsk->pi_state_list))) -exit_pi_state_list (tsk); -#endif +futex_mm_release (tsk);uprobe_free_utask (tsk);
@@ -1796,14 +1783,8 @@ static __latent_entropy struct task_stru#ifdef CONFIG_BLOCK p->plug =NULL ;#endif -#ifdef CONFIG_FUTEX - p->robust_list =NULL ; -#ifdef CONFIG_COMPAT - p->compat_robust_list =NULL ; -#endif -INIT_LIST_HEAD (&p->pi_state_list); - p->pi_state_cache =NULL ; -#endif +futex_init_task (p); +/* * sigaltstack should be cleared when sharing the same VM */
kernel/futex.c +29 -4
@@ -341,6 +341,12 @@ static inline bool should_fail_futex(boo }#endif /* CONFIG_FAIL_FUTEX */ +#ifdef CONFIG_COMPAT +static void compat_exit_robust_list (struct task_struct *curr); +#else +static inline void compat_exit_robust_list (struct task_struct *curr) { } +#endif +static inline void futex_get_mm (union futex_key *key) {mmgrab (key->private.mm);
@@ -890,7 +896,7 @@ static struct task_struct *futex_find_ge* Kernel cleans up PI-state, but userspace is likely hosed. * (Robust-futex cleanup is separate and might save the day for userspace.) */ -void exit_pi_state_list (struct task_struct *curr) +static void exit_pi_state_list (struct task_struct *curr) {struct list_head *next, *head = &curr->pi_state_list;struct futex_pi_state *pi_state;
@@ -960,7 +966,8 @@ void exit_pi_state_list(struct task_stru }raw_spin_unlock_irq (&curr->pi_lock); } - +#else +static inline void exit_pi_state_list (struct task_struct *curr) { }#endif /*
@@ -3611,7 +3618,7 @@ static inline int fetch_robust_entry(str* * We silently return on any sign of list-walking problem. */ -void exit_robust_list (struct task_struct *curr) +static void exit_robust_list (struct task_struct *curr) {struct robust_list_head __user *head = curr->robust_list;struct robust_list __user *entry, *next_entry, *pending;
@@ -3676,6 +3683,24 @@ void exit_robust_list(struct task_struct } } +void futex_mm_release (struct task_struct *tsk) +{ +if (unlikely (tsk->robust_list)) { +exit_robust_list (tsk); + tsk->robust_list =NULL ; + } + +#ifdef CONFIG_COMPAT +if (unlikely (tsk->compat_robust_list)) { +compat_exit_robust_list (tsk); + tsk->compat_robust_list =NULL ; + } +#endif + +if (unlikely (!list_empty (&tsk->pi_state_list))) +exit_pi_state_list (tsk); +} +long do_futex (u32 __user *uaddr,int op,u32 val,ktime_t *timeout,u32 __user *uaddr2,u32 val2,u32 val3) {
@@ -3801,7 +3826,7 @@ static void __user *futex_uaddr(struct r* * We silently return on any sign of list-walking problem. */ -void compat_exit_robust_list (struct task_struct *curr) +static void compat_exit_robust_list (struct task_struct *curr) {struct compat_robust_list_head __user *head = curr->compat_robust_list;struct robust_list __user *entry, *next_entry, *pending;
Greg Kroah-Hartman
maintainerPATCH 188/209 futex: Replace PF_EXITPIDONE with a state
In reply to Greg Kroah-HartmanFrom: Thomas Gleixner <[email protected]>
commit 3d4775df0a89240f671861c6ab6e8d59af8e9e41 upstream.
The futex exit handling relies on PF_ flags. That's suboptimal as it requires a smp_mb() and an ugly lock/unlock of the exiting tasks pi_lock in the middle of do_exit() to enforce the observability of PF_EXITING in the futex code.
Add a futex_state member to task_struct and convert the PF_EXITPIDONE logic over to the new state. The PF_EXITING dependency will be cleaned up in a later step.
This prepares for handling various futex exit issues later.
--- include/linux/futex.h | 33 +++++++++++++++++++++++++++++++++ include/linux/sched.h | 2 +- kernel/exit.c | 18 ++---------------- kernel/futex.c | 25 +++++++++++++------------ 4 files changed, 49 insertions(+), 29 deletions(-)
include/linux/futex.h +33 -0
@@ -53,6 +53,10 @@ union futex_key {#define FUTEX_KEY_INIT (union futex_key) { .both = { .ptr = NULL } }#ifdef CONFIG_FUTEX +enum { +FUTEX_STATE_OK , +FUTEX_STATE_DEAD , +};static inline void futex_init_task (struct task_struct *tsk) {
@@ -62,6 +66,34 @@ static inline void futex_init_task(struc#endif INIT_LIST_HEAD (&tsk->pi_state_list); tsk->pi_state_cache =NULL ; + tsk->futex_state =FUTEX_STATE_OK ; +} + +/** +* futex_exit_done - Sets the tasks futex state to FUTEX_STATE_DEAD +* @tsk: task to set the state on +* +* Set the futex exit state of the task lockless. The futex waiter code +* observes that state when a task is exiting and loops until the task has +* actually finished the futex cleanup. The worst case for this is that the +* waiter runs through the wait loop until the state becomes visible. +* +* This has two callers: +* +* - futex_mm_release() after the futex exit cleanup has been done +* +* - do_exit() from the recursive fault handling path. +* +* In case of a recursive fault this is best effort. Either the futex exit +* code has run already or not. If the OWNER_DIED bit has been set on the +* futex then the waiter can take it over. If not, the problem is pushed +* back to user space. If the futex exit code did not run yet, then an +* already queued waiter might block forever, but there is nothing which +* can be done about that. +*/ +static inline void futex_exit_done (struct task_struct *tsk) +{ + tsk->futex_state =FUTEX_STATE_DEAD ; }void futex_mm_release (struct task_struct *tsk);
@@ -71,6 +103,7 @@ long do_futex(u32 __user *uaddr, int op,#else static inline void futex_init_task (struct task_struct *tsk) { }static inline void futex_mm_release (struct task_struct *tsk) { } +static inline void futex_exit_done (struct task_struct *tsk) { }#endif #endif
include/linux/sched.h +1 -1
@@ -959,6 +959,7 @@ struct task_struct {#endif struct list_head pi_state_list;struct futex_pi_state *pi_state_cache; +unsigned int futex_state;#endif #ifdef CONFIG_PERF_EVENTS struct perf_event_context *perf_event_ctxp[perf_nr_task_contexts];
@@ -1334,7 +1335,6 @@ extern struct pid *cad_pid;*/ #define PF_IDLE 0x00000002/* I am an IDLE thread */ #define PF_EXITING 0x00000004/* Getting shut down */ -#define PF_EXITPIDONE 0x00000008/* PI exit done on shut down */ #define PF_VCPU 0x00000010/* I'm a virtual CPU */ #define PF_WQ_WORKER 0x00000020/* I'm a workqueue worker */ #define PF_FORKNOEXEC 0x00000040/* Forked but didn't exec */
kernel/exit.c +2 -16
@@ -803,16 +803,7 @@ void __noreturn do_exit(long code)*/ if (unlikely (tsk->flags &PF_EXITING )) {pr_alert ("Fixing recursive fault but reboot is needed!\n" ); -/* -* We can do this unlocked here. The futex code uses -* this flag just to verify whether the pi state -* cleanup has been done or not. In the worst case it -* loops once more. We pretend that the cleanup was -* done as there is no way to return. Either the -* OWNER_DIED bit is set by now or we push the blocked -* task into the wait for ever nirwana as well. -*/ - tsk->flags |=PF_EXITPIDONE ; +futex_exit_done (tsk);set_current_state (TASK_UNINTERRUPTIBLE );schedule (); }
@@ -902,12 +893,7 @@ void __noreturn do_exit(long code)* Make sure we are holding no locks: */ debug_check_no_locks_held (); -/* -* We can do this unlocked here. The futex code uses this flag -* just to verify whether the pi state cleanup has been done -* or not. In the worst case it loops once more. -*/ - tsk->flags |=PF_EXITPIDONE ; +futex_exit_done (tsk);if (tsk->io_context)exit_io_context (tsk);
kernel/futex.c +13 -12
@@ -1182,9 +1182,10 @@ static int handle_exit_race(u32 __user *u32 uval2;/* -* If PF_EXITPIDONE is not yet set, then try again. +* If the futex exit state is not yet FUTEX_STATE_DEAD, wait +* for it to finish. */ -if (tsk && !(tsk->flags &PF_EXITPIDONE )) +if (tsk && tsk->futex_state !=FUTEX_STATE_DEAD )return -EAGAIN ;/*
@@ -1203,8 +1204,9 @@ static int handle_exit_race(u32 __user ** *uaddr = 0xC0000000; tsk = get_task(PID); * } if (!tsk->flags & PF_EXITING) { * ... attach(); -* tsk->flags |= PF_EXITPIDONE; } else { -* if (!(tsk->flags & PF_EXITPIDONE)) +* tsk->futex_state = } else { +* FUTEX_STATE_DEAD; if (tsk->futex_state != +* FUTEX_STATE_DEAD) * return -EAGAIN; * return -ESRCH; <--- FAIL * }
@@ -1260,17 +1262,16 @@ static int attach_to_pi_owner(u32 __user }/* -* We need to look at the task state flags to figure out, -* whether the task is exiting. To protect against the do_exit -* change of the task flags, we do this protected by -* p->pi_lock: +* We need to look at the task state to figure out, whether the +* task is exiting. To protect against the change of the task state +* in futex_exit_release(), we do this protected by p->pi_lock: */ raw_spin_lock_irq (&p->pi_lock); -if (unlikely (p->flags &PF_EXITING )) { +if (unlikely (p->futex_state !=FUTEX_STATE_OK )) {/* -* The task is on the way out. When PF_EXITPIDONE is -* set, we know that the task has finished the -* cleanup: +* The task is on the way out. When the futex state is +* FUTEX_STATE_DEAD, we know that the task has finished +* the cleanup: */ int ret =handle_exit_race (uaddr, uval, p);
Greg Kroah-Hartman
maintainerPATCH 189/209 exit/exec: Seperate mm_release()
In reply to Greg Kroah-HartmanFrom: Thomas Gleixner <[email protected]>
commit 4610ba7ad877fafc0a25a30c6c82015304120426 upstream.
mm_release() contains the futex exit handling. mm_release() is called from do_exit()->exit_mm() and from exec()->exec_mm().
In the exit_mm() case PF_EXITING and the futex state is updated. In the exec_mm() case these states are not touched.
As the futex exit code needs further protections against exit races, this needs to be split into two functions.
Preparatory only, no functional change.
--- fs/exec.c | 2 +- include/linux/sched/mm.h | 6 ++++-- kernel/exit.c | 2 +- kernel/fork.c | 12 +++++++++++- 4 files changed, 17 insertions(+), 5 deletions(-)
fs/exec.c +1 -1
@@ -1007,7 +1007,7 @@ static int exec_mmap(struct mm_struct *m/* Notify parent that we're no longer interested in the old VM */ tsk = current; old_mm = current->mm; -mm_release (tsk, old_mm); +exec_mm_release (tsk, old_mm);if (old_mm) {sync_mm_rss (old_mm);
include/linux/sched/mm.h +4 -2
@@ -125,8 +125,10 @@ extern struct mm_struct *get_task_mm(str* succeeds. */ extern struct mm_struct *mm_access (struct task_struct *task,unsigned int mode); -/* Remove the current tasks stale references to the old mm_struct */ -extern void mm_release (struct task_struct *,struct mm_struct *); +/* Remove the current tasks stale references to the old mm_struct on exit() */ +extern void exit_mm_release (struct task_struct *,struct mm_struct *); +/* Remove the current tasks stale references to the old mm_struct on exec() */ +extern void exec_mm_release (struct task_struct *,struct mm_struct *);#ifdef CONFIG_MEMCG extern void mm_update_next_owner (struct mm_struct *mm);
kernel/exit.c +1 -1
@@ -497,7 +497,7 @@ static void exit_mm(void)struct mm_struct *mm = current->mm;struct core_state *core_state; -mm_release (current, mm); +exit_mm_release (current, mm);if (!mm)return ;sync_mm_rss (mm);
kernel/fork.c +11 -1
@@ -1132,7 +1132,7 @@ static int wait_for_vfork_done(struct ta* restoring the old one. . . * Eric Biederman 10 January 1998 */ -void mm_release (struct task_struct *tsk,struct mm_struct *mm) +static void mm_release (struct task_struct *tsk,struct mm_struct *mm) {/* Get rid of any futexes when releasing the mm */ futex_mm_release (tsk);
@@ -1169,6 +1169,16 @@ void mm_release(struct task_struct *tsk,complete_vfork_done (tsk); } +void exit_mm_release (struct task_struct *tsk,struct mm_struct *mm) +{ +mm_release (tsk, mm); +} + +void exec_mm_release (struct task_struct *tsk,struct mm_struct *mm) +{ +mm_release (tsk, mm); +} +/* * Allocate a new mm structure and copy contents from the * mm structure of the passed in task structure.
Greg Kroah-Hartman
maintainerPATCH 190/209 futex: Split futex_mm_release() for exit/exec
In reply to Greg Kroah-HartmanFrom: Thomas Gleixner <[email protected]>
commit 150d71584b12809144b8145b817e83b81158ae5f upstream.
To allow separate handling of the futex exit state in the futex exit code for exit and exec, split futex_mm_release() into two functions and invoke them from the corresponding exit/exec_mm_release() callsites.
Preparatory only, no functional change.
--- include/linux/futex.h | 6 ++++-- kernel/fork.c | 5 ++--- kernel/futex.c | 7 ++++++- 3 files changed, 12 insertions(+), 6 deletions(-)
include/linux/futex.h +4 -2
@@ -96,14 +96,16 @@ static inline void futex_exit_done(struc tsk->futex_state =FUTEX_STATE_DEAD ; } -void futex_mm_release (struct task_struct *tsk); +void futex_exit_release (struct task_struct *tsk); +void futex_exec_release (struct task_struct *tsk);long do_futex (u32 __user *uaddr,int op,u32 val,ktime_t *timeout,u32 __user *uaddr2,u32 val2,u32 val3);#else static inline void futex_init_task (struct task_struct *tsk) { } -static inline void futex_mm_release (struct task_struct *tsk) { }static inline void futex_exit_done (struct task_struct *tsk) { } +static inline void futex_exit_release (struct task_struct *tsk) { } +static inline void futex_exec_release (struct task_struct *tsk) { }#endif #endif
kernel/fork.c +2 -3
@@ -1134,9 +1134,6 @@ static int wait_for_vfork_done(struct ta*/ static void mm_release (struct task_struct *tsk,struct mm_struct *mm) { -/* Get rid of any futexes when releasing the mm */ -futex_mm_release (tsk); -uprobe_free_utask (tsk);/* Get rid of any cached register state */
@@ -1171,11 +1168,13 @@ static void mm_release(struct task_strucvoid exit_mm_release (struct task_struct *tsk,struct mm_struct *mm) { +futex_exit_release (tsk);mm_release (tsk, mm); }void exec_mm_release (struct task_struct *tsk,struct mm_struct *mm) { +futex_exec_release (tsk);mm_release (tsk, mm); }
kernel/futex.c +6 -1
@@ -3684,7 +3684,7 @@ static void exit_robust_list(struct task } } -void futex_mm_release (struct task_struct *tsk) +void futex_exec_release (struct task_struct *tsk) {if (unlikely (tsk->robust_list)) {exit_robust_list (tsk);
@@ -3702,6 +3702,11 @@ void futex_mm_release(struct task_structexit_pi_state_list (tsk); } +void futex_exit_release (struct task_struct *tsk) +{ +futex_exec_release (tsk); +} +long do_futex (u32 __user *uaddr,int op,u32 val,ktime_t *timeout,u32 __user *uaddr2,u32 val2,u32 val3) {
Greg Kroah-Hartman
maintainerPATCH 191/209 futex: Set task::futex_state to DEAD right after handling futex exit
In reply to Greg Kroah-HartmanFrom: Thomas Gleixner <[email protected]>
commit f24f22435dcc11389acc87e5586239c1819d217c upstream.
Setting task::futex_state in do_exit() is rather arbitrarily placed for no reason. Move it into the futex code.
Note, this is only done for the exit cleanup as the exec cleanup cannot set the state to FUTEX_STATE_DEAD because the task struct is still in active use.
--- kernel/exit.c | 1 - kernel/futex.c | 1 + 2 files changed, 1 insertion(+), 1 deletion(-)
kernel/exit.c +0 -1
@@ -893,7 +893,6 @@ void __noreturn do_exit(long code)* Make sure we are holding no locks: */ debug_check_no_locks_held (); -futex_exit_done (tsk);if (tsk->io_context)exit_io_context (tsk);
kernel/futex.c +1 -0
@@ -3705,6 +3705,7 @@ void futex_exec_release(struct task_struvoid futex_exit_release (struct task_struct *tsk) {futex_exec_release (tsk); +futex_exit_done (tsk); } long do_futex(u32 __user *uaddr, int op, u32 val, ktime_t *timeout,
Greg Kroah-Hartman
maintainerPATCH 192/209 futex: Mark the begin of futex exit explicitly
In reply to Greg Kroah-HartmanFrom: Thomas Gleixner <[email protected]>
commit 18f694385c4fd77a09851fd301236746ca83f3cb upstream.
Instead of relying on PF_EXITING use an explicit state for the futex exit and set it in the futex exit function. This moves the smp barrier and the lock/unlock serialization into the futex code.
As with the DEAD state this is restricted to the exit path as exec continues to use the same task struct.
This allows to simplify that logic in a next step.
--- include/linux/futex.h | 31 +++---------------------------- kernel/exit.c | 13 +------------ kernel/futex.c | 37 ++++++++++++++++++++++++++++++++++++- 3 files changed, 40 insertions(+), 41 deletions(-)
include/linux/futex.h +3 -28
@@ -55,6 +55,7 @@ union futex_key {#ifdef CONFIG_FUTEX enum {FUTEX_STATE_OK , +FUTEX_STATE_EXITING ,FUTEX_STATE_DEAD , };
@@ -69,33 +70,7 @@ static inline void futex_init_task(struc tsk->futex_state =FUTEX_STATE_OK ; } -/** -* futex_exit_done - Sets the tasks futex state to FUTEX_STATE_DEAD -* @tsk: task to set the state on -* -* Set the futex exit state of the task lockless. The futex waiter code -* observes that state when a task is exiting and loops until the task has -* actually finished the futex cleanup. The worst case for this is that the -* waiter runs through the wait loop until the state becomes visible. -* -* This has two callers: -* -* - futex_mm_release() after the futex exit cleanup has been done -* -* - do_exit() from the recursive fault handling path. -* -* In case of a recursive fault this is best effort. Either the futex exit -* code has run already or not. If the OWNER_DIED bit has been set on the -* futex then the waiter can take it over. If not, the problem is pushed -* back to user space. If the futex exit code did not run yet, then an -* already queued waiter might block forever, but there is nothing which -* can be done about that. -*/ -static inline void futex_exit_done (struct task_struct *tsk) -{ - tsk->futex_state =FUTEX_STATE_DEAD ; -} - +void futex_exit_recursive (struct task_struct *tsk);void futex_exit_release (struct task_struct *tsk);void futex_exec_release (struct task_struct *tsk);
@@ -103,7 +78,7 @@ long do_futex(u32 __user *uaddr, int op, u32 __user *uaddr2, u32 val2, u32 val3);#else static inline void futex_init_task (struct task_struct *tsk) { } -static inline void futex_exit_done (struct task_struct *tsk) { } +static inline void futex_exit_recursive (struct task_struct *tsk) { }static inline void futex_exit_release (struct task_struct *tsk) { }static inline void futex_exec_release (struct task_struct *tsk) { }#endif
kernel/exit.c +1 -12
@@ -803,23 +803,12 @@ void __noreturn do_exit(long code)*/ if (unlikely (tsk->flags &PF_EXITING )) {pr_alert ("Fixing recursive fault but reboot is needed!\n" ); -futex_exit_done (tsk); +futex_exit_recursive (tsk);set_current_state (TASK_UNINTERRUPTIBLE );schedule (); }exit_signals (tsk);/* sets PF_EXITING */ -/* -* Ensure that all new tsk->pi_lock acquisitions must observe -* PF_EXITING. Serializes against futex.c:attach_to_pi_owner(). -*/ -smp_mb (); -/* -* Ensure that we must observe the pi_state in exit_mm() -> -* mm_release() -> exit_pi_state_list(). -*/ -raw_spin_lock_irq (&tsk->pi_lock); -raw_spin_unlock_irq (&tsk->pi_lock);if (unlikely (in_atomic ())) { pr_info("note: %s[%d] exited with preempt_count %d\n",
kernel/futex.c +36 -1
@@ -3702,10 +3702,45 @@ void futex_exec_release(struct task_struexit_pi_state_list (tsk); } +/** +* futex_exit_recursive - Set the tasks futex state to FUTEX_STATE_DEAD +* @tsk: task to set the state on +* +* Set the futex exit state of the task lockless. The futex waiter code +* observes that state when a task is exiting and loops until the task has +* actually finished the futex cleanup. The worst case for this is that the +* waiter runs through the wait loop until the state becomes visible. +* +* This is called from the recursive fault handling path in do_exit(). +* +* This is best effort. Either the futex exit code has run already or +* not. If the OWNER_DIED bit has been set on the futex then the waiter can +* take it over. If not, the problem is pushed back to user space. If the +* futex exit code did not run yet, then an already queued waiter might +* block forever, but there is nothing which can be done about that. +*/ +void futex_exit_recursive (struct task_struct *tsk) +{ + tsk->futex_state =FUTEX_STATE_DEAD ; +} +void futex_exit_release (struct task_struct *tsk) { + tsk->futex_state =FUTEX_STATE_EXITING ; +/* +* Ensure that all new tsk->pi_lock acquisitions must observe +* FUTEX_STATE_EXITING. Serializes against attach_to_pi_owner(). +*/ +smp_mb (); +/* +* Ensure that we must observe the pi_state in exit_pi_state_list(). +*/ +raw_spin_lock_irq (&tsk->pi_lock); +raw_spin_unlock_irq (&tsk->pi_lock); +futex_exec_release (tsk); -futex_exit_done (tsk); + + tsk->futex_state =FUTEX_STATE_DEAD ; } long do_futex(u32 __user *uaddr, int op, u32 val, ktime_t *timeout,
Greg Kroah-Hartman
maintainerPATCH 193/209 futex: Sanitize exit state handling
In reply to Greg Kroah-HartmanFrom: Thomas Gleixner <[email protected]>
commit 4a8e991b91aca9e20705d434677ac013974e0e30 upstream.
Instead of having a smp_mb() and an empty lock/unlock of task::pi_lock move the state setting into to the lock section.
--- kernel/futex.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-)
kernel/futex.c +10 -7
@@ -3726,16 +3726,19 @@ void futex_exit_recursive(struct task_stvoid futex_exit_release (struct task_struct *tsk) { - tsk->futex_state =FUTEX_STATE_EXITING ; -/* -* Ensure that all new tsk->pi_lock acquisitions must observe -* FUTEX_STATE_EXITING. Serializes against attach_to_pi_owner(). -*/ -smp_mb ();/* -* Ensure that we must observe the pi_state in exit_pi_state_list(). +* Switch the state to FUTEX_STATE_EXITING under tsk->pi_lock. +* +* This ensures that all subsequent checks of tsk->futex_state in +* attach_to_pi_owner() must observe FUTEX_STATE_EXITING with +* tsk->pi_lock held. +* +* It guarantees also that a pi_state which was queued right before +* the state change under tsk->pi_lock by a concurrent waiter must +* be observed in exit_pi_state_list(). */ raw_spin_lock_irq (&tsk->pi_lock); + tsk->futex_state =FUTEX_STATE_EXITING ;raw_spin_unlock_irq (&tsk->pi_lock);futex_exec_release (tsk);
Greg Kroah-Hartman
maintainerPATCH 194/209 futex: Provide state handling for exec() as well
In reply to Greg Kroah-HartmanFrom: Thomas Gleixner <[email protected]>
commit af8cbda2cfcaa5515d61ec500498d46e9a8247e2 upstream.
exec() attempts to handle potentially held futexes gracefully by running the futex exit handling code like exit() does.
The current implementation has no protection against concurrent incoming waiters. The reason is that the futex state cannot be set to FUTEX_STATE_DEAD after the cleanup because the task struct is still active and just about to execute the new binary.
While its arguably buggy when a task holds a futex over exec(), for consistency sake the state handling can at least cover the actual futex exit cleanup section. This provides state consistency protection accross the cleanup. As the futex state of the task becomes FUTEX_STATE_OK after the cleanup has been finished, this cannot prevent subsequent attempts to attach to the task in case that the cleanup was not successfull in mopping up all leftovers.
--- kernel/futex.c | 38 ++++++++++++++++++++++++++++++++++---- 1 file changed, 34 insertions(+), 4 deletions(-)
kernel/futex.c +34 -4
@@ -3684,7 +3684,7 @@ static void exit_robust_list(struct task } } -void futex_exec_release (struct task_struct *tsk) +static void futex_cleanup (struct task_struct *tsk) {if (unlikely (tsk->robust_list)) {exit_robust_list (tsk);
@@ -3724,7 +3724,7 @@ void futex_exit_recursive(struct task_st tsk->futex_state =FUTEX_STATE_DEAD ; } -void futex_exit_release (struct task_struct *tsk) +static void futex_cleanup_begin (struct task_struct *tsk) {/* * Switch the state to FUTEX_STATE_EXITING under tsk->pi_lock.
@@ -3740,10 +3740,40 @@ void futex_exit_release(struct task_struraw_spin_lock_irq (&tsk->pi_lock); tsk->futex_state =FUTEX_STATE_EXITING ;raw_spin_unlock_irq (&tsk->pi_lock); +} -futex_exec_release (tsk); +static void futex_cleanup_end (struct task_struct *tsk,int state) +{ +/* +* Lockless store. The only side effect is that an observer might +* take another loop until it becomes visible. +*/ + tsk->futex_state = state; +} - tsk->futex_state =FUTEX_STATE_DEAD ; +void futex_exec_release (struct task_struct *tsk) +{ +/* +* The state handling is done for consistency, but in the case of +* exec() there is no way to prevent futher damage as the PID stays +* the same. But for the unlikely and arguably buggy case that a +* futex is held on exec(), this provides at least as much state +* consistency protection which is possible. +*/ +futex_cleanup_begin (tsk); +futex_cleanup (tsk); +/* +* Reset the state to FUTEX_STATE_OK. The task is alive and about +* exec a new binary. +*/ +futex_cleanup_end (tsk,FUTEX_STATE_OK ); +} + +void futex_exit_release (struct task_struct *tsk) +{ +futex_cleanup_begin (tsk); +futex_cleanup (tsk); +futex_cleanup_end (tsk,FUTEX_STATE_DEAD ); } long do_futex(u32 __user *uaddr, int op, u32 val, ktime_t *timeout,
Greg Kroah-Hartman
maintainerPATCH 195/209 futex: Add mutex around futex exit
In reply to Greg Kroah-HartmanFrom: Thomas Gleixner <[email protected]>
commit 3f186d974826847a07bc7964d79ec4eded475ad9 upstream.
The mutex will be used in subsequent changes to replace the busy looping of a waiter when the futex owner is currently executing the exit cleanup to prevent a potential live lock.
--- include/linux/futex.h | 1 + include/linux/sched.h | 1 + kernel/futex.c | 16 ++++++++++++++++ 3 files changed, 18 insertions(+)
include/linux/futex.h +1 -0
@@ -68,6 +68,7 @@ static inline void futex_init_task(strucINIT_LIST_HEAD (&tsk->pi_state_list); tsk->pi_state_cache =NULL ; tsk->futex_state =FUTEX_STATE_OK ; +mutex_init (&tsk->futex_exit_mutex); }void futex_exit_recursive (struct task_struct *tsk);
include/linux/sched.h +1 -0
@@ -959,6 +959,7 @@ struct task_struct {#endif struct list_head pi_state_list;struct futex_pi_state *pi_state_cache; +struct mutex futex_exit_mutex;unsigned int futex_state;#endif #ifdef CONFIG_PERF_EVENTS
kernel/futex.c +16 -0
@@ -3721,12 +3721,23 @@ static void futex_cleanup(struct task_st*/ void futex_exit_recursive (struct task_struct *tsk) { +/* If the state is FUTEX_STATE_EXITING then futex_exit_mutex is held */ +if (tsk->futex_state ==FUTEX_STATE_EXITING ) +mutex_unlock (&tsk->futex_exit_mutex); tsk->futex_state =FUTEX_STATE_DEAD ; }static void futex_cleanup_begin (struct task_struct *tsk) {/* +* Prevent various race issues against a concurrent incoming waiter +* including live locks by forcing the waiter to block on +* tsk->futex_exit_mutex when it observes FUTEX_STATE_EXITING in +* attach_to_pi_owner(). +*/ +mutex_lock (&tsk->futex_exit_mutex); + +/* * Switch the state to FUTEX_STATE_EXITING under tsk->pi_lock. * * This ensures that all subsequent checks of tsk->futex_state in
@@ -3749,6 +3760,11 @@ static void futex_cleanup_end(struct tas* take another loop until it becomes visible. */ tsk->futex_state = state; +/* +* Drop the exit protection. This unblocks waiters which observed +* FUTEX_STATE_EXITING to reevaluate the state. +*/ +mutex_unlock (&tsk->futex_exit_mutex); }void futex_exec_release (struct task_struct *tsk)
Greg Kroah-Hartman
maintainerPATCH 196/209 futex: Provide distinct return value when owner is exiting
In reply to Greg Kroah-HartmanFrom: Thomas Gleixner <[email protected]>
commit ac31c7ff8624409ba3c4901df9237a616c187a5d upstream.
attach_to_pi_owner() returns -EAGAIN for various cases:
- Owner task is exiting
- Futex value has changed
The caller drops the held locks (hash bucket, mmap_sem) and retries the operation. In case of the owner task exiting this can result in a live lock.
As a preparatory step for seperating those cases, provide a distinct return value (EBUSY) for the owner exiting case.
No functional change.
--- kernel/futex.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-)
kernel/futex.c +9 -7
@@ -1182,11 +1182,11 @@ static int handle_exit_race(u32 __user *u32 uval2;/* -* If the futex exit state is not yet FUTEX_STATE_DEAD, wait -* for it to finish. +* If the futex exit state is not yet FUTEX_STATE_DEAD, tell the +* caller that the alleged owner is busy. */ if (tsk && tsk->futex_state !=FUTEX_STATE_DEAD ) -return -EAGAIN ; +return -EBUSY ;/* * Reread the user space value to handle the following situation:
@@ -2093,12 +2093,13 @@ retry_private:if (!ret) goto retry; goto out; +case -EBUSY :case -EAGAIN :/* * Two reasons for this: -* - Owner is exiting and we just wait for the +* - EBUSY: Owner is exiting and we just wait for the * exit to complete. -* - The user space value changed. +* - EAGAIN: The user space value changed. */ double_unlock_hb (hb1, hb2);hb_waiters_dec (hb2);
@@ -2859,12 +2860,13 @@ retry_private: goto out_unlock_put_key;case -EFAULT : goto uaddr_faulted; +case -EBUSY :case -EAGAIN :/* * Two reasons for this: -* - Task is exiting and we just wait for the +* - EBUSY: Task is exiting and we just wait for the * exit to complete. -* - The user space value changed. +* - EAGAIN: The user space value changed. */ queue_unlock (hb);put_futex_key (&q.key);
Greg Kroah-Hartman
maintainerPATCH 197/209 futex: Prevent exit livelock
In reply to Greg Kroah-HartmanFrom: Thomas Gleixner <[email protected]>
commit 3ef240eaff36b8119ac9e2ea17cbf41179c930ba upstream.
Oleg provided the following test case:
int main(void)
{
struct sched_param sp = {};
sp.sched_priority = 2;
assert(sched_setscheduler(0, SCHED_FIFO, &sp) == 0);
int lock = vfork();
if (!lock) {
sp.sched_priority = 1;
assert(sched_setscheduler(0, SCHED_FIFO, &sp) == 0);
_exit(0);
}
syscall(__NR_futex, &lock, FUTEX_LOCK_PI, 0,0,0);
return 0;
}This creates an unkillable RT process spinning in futex_lock_pi() on a UP machine or if the process is affine to a single CPU. The reason is:
parent child
set FIFO prio 2
vfork() -> set FIFO prio 1
implies wait_for_child() sched_setscheduler(...)
exit()
do_exit() .... mm_release() tsk->futex_state = FUTEX_STATE_EXITING; exit_futex(); (NOOP in this case) complete() --> wakes parent
sys_futex()
loop infinite because
tsk->futex_state == FUTEX_STATE_EXITING
The same problem can happen just by regular preemption as well:
task holds futex
...
do_exit()
tsk->futex_state = FUTEX_STATE_EXITING;--> preemption (unrelated wakeup of some other higher prio task, e.g. timer)
switch_to(other_task)
return to user
sys_futex()
loop infinite as above
Just for the fun of it the futex exit cleanup could trigger the wakeup itself before the task sets its futex state to DEAD.
To cure this, the handling of the exiting owner is changed so:
- A refcount is held on the task
- The task pointer is stored in a caller visible location
- The caller drops all locks (hash bucket, mmap_sem) and blocks on task::futex_exit_mutex. When the mutex is acquired then the exiting task has completed the cleanup and the state is consistent and can be reevaluated.
This is not a pretty solution, but there is no choice other than returning an error code to user space, which would break the state consistency guarantee and open another can of problems including regressions.
For stable backports the preparatory commits ac31c7ff8624 .. ba31c1a48538 are required as well, but for anything older than 5.3.y the backports are going to be provided when this hits mainline as the other dependencies for those kernels are definitely not stable material.
--- kernel/futex.c | 106 ++++++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 91 insertions(+), 15 deletions(-)
kernel/futex.c +91 -15
@@ -1176,6 +1176,36 @@ out_error:return ret; } +/** +* wait_for_owner_exiting - Block until the owner has exited +* @exiting: Pointer to the exiting task +* +* Caller must hold a refcount on @exiting. +*/ +static void wait_for_owner_exiting (int ret,struct task_struct *exiting) +{ +if (ret != -EBUSY ) { +WARN_ON_ONCE (exiting); +return ; + } + +if (WARN_ON_ONCE (ret == -EBUSY && !exiting)) +return ; + +mutex_lock (&exiting->futex_exit_mutex); +/* +* No point in doing state checking here. If the waiter got here +* while the task was in exec()->exec_futex_release() then it can +* have any FUTEX_STATE_* value when the waiter has acquired the +* mutex. OK, if running, EXITING or DEAD if it reached exit() +* already. Highly unlikely and not a problem. Just one more round +* through the futex maze. +*/ +mutex_unlock (&exiting->futex_exit_mutex); + +put_task_struct (exiting); +} +static int handle_exit_race (u32 __user *uaddr,u32 uval,struct task_struct *tsk) {
@@ -1237,7 +1267,8 @@ static int handle_exit_race(u32 __user ** it after doing proper sanity checks. */ static int attach_to_pi_owner (u32 __user *uaddr,u32 uval,union futex_key *key, -struct futex_pi_state **ps) +struct futex_pi_state **ps, +struct task_struct **exiting) {pid_t pid = uval &FUTEX_TID_MASK ;struct futex_pi_state *pi_state;
@@ -1276,7 +1307,19 @@ static int attach_to_pi_owner(u32 __userint ret =handle_exit_race (uaddr, uval, p);raw_spin_unlock_irq (&p->pi_lock); -put_task_struct (p); +/* +* If the owner task is between FUTEX_STATE_EXITING and +* FUTEX_STATE_DEAD then store the task pointer and keep +* the reference on the task struct. The calling code will +* drop all locks, wait for the task to reach +* FUTEX_STATE_DEAD and then drop the refcount. This is +* required to prevent a live lock when the current task +* preempted the exiting task between the two states. +*/ +if (ret == -EBUSY ) + *exiting = p; +else +put_task_struct (p);return ret; }
@@ -1315,7 +1358,8 @@ static int attach_to_pi_owner(u32 __userstatic int lookup_pi_state (u32 __user *uaddr,u32 uval,struct futex_hash_bucket *hb, -union futex_key *key,struct futex_pi_state **ps) +union futex_key *key,struct futex_pi_state **ps, +struct task_struct **exiting) {struct futex_q *top_waiter =futex_top_waiter (hb, key);
@@ -1330,7 +1374,7 @@ static int lookup_pi_state(u32 __user *u* We are the first waiter - try to look up the owner based on * @uval and attach to it. */ -return attach_to_pi_owner (uaddr, uval, key, ps); +return attach_to_pi_owner (uaddr, uval, key, ps, exiting); }static int lock_pi_update_atomic (u32 __user *uaddr,u32 uval,u32 newval)
@@ -1358,6 +1402,8 @@ static int lock_pi_update_atomic(u32 __u* lookup * @task: the task to perform the atomic lock work for. This will * be "current" except in the case of requeue pi. +* @exiting: Pointer to store the task pointer of the owner task +* which is in the middle of exiting * @set_waiters: force setting the FUTEX_WAITERS bit (1) or not (0) * * Return:
@@ -1366,11 +1412,17 @@ static int lock_pi_update_atomic(u32 __u* - <0 - error * * The hb->lock and futex_key refs shall be held by the caller. +* +* @exiting is only set when the return value is -EBUSY. If so, this holds +* a refcount on the exiting task on return and the caller needs to drop it +* after waiting for the exit to complete. */ static int futex_lock_pi_atomic (u32 __user *uaddr,struct futex_hash_bucket *hb,union futex_key *key,struct futex_pi_state **ps, -struct task_struct *task,int set_waiters) +struct task_struct *task, +struct task_struct **exiting, +int set_waiters) {u32 uval, newval, vpid =task_pid_vnr (task);struct futex_q *top_waiter;
@@ -1440,7 +1492,7 @@ static int futex_lock_pi_atomic(u32 __us* attach to the owner. If that fails, no harm done, we only * set the FUTEX_WAITERS bit in the user space variable. */ -return attach_to_pi_owner (uaddr, newval, key, ps); +return attach_to_pi_owner (uaddr, newval, key, ps, exiting); }/**
@@ -1859,6 +1911,8 @@ void requeue_pi_wake_futex(struct futex_* @key1: the from futex key * @key2: the to futex key * @ps: address to store the pi_state pointer +* @exiting: Pointer to store the task pointer of the owner task +* which is in the middle of exiting * @set_waiters: force setting the FUTEX_WAITERS bit (1) or not (0) * * Try and get the lock on behalf of the top waiter if we can do it atomically.
@@ -1866,16 +1920,20 @@ void requeue_pi_wake_futex(struct futex_* then direct futex_lock_pi_atomic() to force setting the FUTEX_WAITERS bit. * hb1 and hb2 must be held by the caller. * +* @exiting is only set when the return value is -EBUSY. If so, this holds +* a refcount on the exiting task on return and the caller needs to drop it +* after waiting for the exit to complete. +* * Return: * - 0 - failed to acquire the lock atomically; * - >0 - acquired the lock, return value is vpid of the top_waiter * - <0 - error */ -static int futex_proxy_trylock_atomic (u32 __user *pifutex, -struct futex_hash_bucket *hb1, -struct futex_hash_bucket *hb2, -union futex_key *key1,union futex_key *key2, -struct futex_pi_state **ps,int set_waiters) +static int +futex_proxy_trylock_atomic (u32 __user *pifutex,struct futex_hash_bucket *hb1, +struct futex_hash_bucket *hb2,union futex_key *key1, +union futex_key *key2,struct futex_pi_state **ps, +struct task_struct **exiting,int set_waiters) {struct futex_q *top_waiter =NULL ;u32 curval;
@@ -1912,7 +1970,7 @@ static int futex_proxy_trylock_atomic(u3*/ vpid =task_pid_vnr (top_waiter->task); ret =futex_lock_pi_atomic (pifutex, hb2, key2, ps, top_waiter->task, - set_waiters); + exiting, set_waiters);if (ret ==1 ) {requeue_pi_wake_futex (top_waiter, key2, hb2);return vpid;
@@ -2041,6 +2099,8 @@ retry_private: }if (requeue_pi && (task_count - nr_wake < nr_requeue)) { +struct task_struct *exiting =NULL ; +/* * Attempt to acquire uaddr2 and wake the top waiter. If we * intend to requeue waiters, force setting the FUTEX_WAITERS
@@ -2048,7 +2108,8 @@ retry_private:* faults rather in the requeue loop below. */ ret =futex_proxy_trylock_atomic (uaddr2, hb1, hb2, &key1, - &key2, &pi_state, nr_requeue); + &key2, &pi_state, + &exiting, nr_requeue);/* * At this point the top_waiter has either taken uaddr2 or is
@@ -2075,7 +2136,8 @@ retry_private:* If that call succeeds then we have pi_state and an * initial refcount on it. */ - ret =lookup_pi_state (uaddr2, ret, hb2, &key2, &pi_state); + ret =lookup_pi_state (uaddr2, ret, hb2, &key2, + &pi_state, &exiting); }switch (ret) {
@@ -2105,6 +2167,12 @@ retry_private:hb_waiters_dec (hb2);put_futex_key (&key2);put_futex_key (&key1); +/* +* Handle the case where the owner is in the middle of +* exiting. Wait for the exit to complete otherwise +* this task might loop forever, aka. live lock. +*/ +wait_for_owner_exiting (ret, exiting);cond_resched (); goto retry;default :
@@ -2820,6 +2888,7 @@ static int futex_lock_pi(u32 __user *uad {struct hrtimer_sleeper timeout, *to =NULL ;struct futex_pi_state *pi_state =NULL ; +struct task_struct *exiting =NULL ;struct rt_mutex_waiter rt_waiter;struct futex_hash_bucket *hb;struct futex_q q = futex_q_init;
@@ -2847,7 +2916,8 @@ retry: retry_private: hb =queue_lock (&q); - ret =futex_lock_pi_atomic (uaddr, hb, &q.key, &q.pi_state, current,0 ); + ret =futex_lock_pi_atomic (uaddr, hb, &q.key, &q.pi_state, current, + &exiting,0 );if (unlikely (ret)) {/* * Atomic work succeeded and we got the lock,
@@ -2870,6 +2940,12 @@ retry_private:*/ queue_unlock (hb);put_futex_key (&q.key); +/* +* Handle the case where the owner is in the middle of +* exiting. Wait for the exit to complete otherwise +* this task might loop forever, aka. live lock. +*/ +wait_for_owner_exiting (ret, exiting);cond_resched (); goto retry;default :
Greg Kroah-Hartman
maintainerPATCH 198/209 HID: core: check whether Usage Page item is after Usage ID items
In reply to Greg Kroah-HartmanFrom: Candle Sun <[email protected]>
commit 1cb0d2aee26335d0bccf29100c7bed00ebece851 upstream.
Upstream commit 58e75155009c ("HID: core: move Usage Page concatenation to Main item") adds support for Usage Page item after Usage ID items (such as keyboards manufactured by Primax).
Usage Page concatenation in Main item works well for following report descriptor patterns:
USAGE_PAGE (Keyboard) 05 07
USAGE_MINIMUM (Keyboard LeftControl) 19 E0
USAGE_MAXIMUM (Keyboard Right GUI) 29 E7
LOGICAL_MINIMUM (0) 15 00
LOGICAL_MAXIMUM (1) 25 01
REPORT_SIZE (1) 75 01
REPORT_COUNT (8) 95 08
INPUT (Data,Var,Abs) 81 02-------------
USAGE_MINIMUM (Keyboard LeftControl) 19 E0
USAGE_MAXIMUM (Keyboard Right GUI) 29 E7
LOGICAL_MINIMUM (0) 15 00
LOGICAL_MAXIMUM (1) 25 01
REPORT_SIZE (1) 75 01
REPORT_COUNT (8) 95 08
USAGE_PAGE (Keyboard) 05 07
INPUT (Data,Var,Abs) 81 02But it makes the parser act wrong for the following report descriptor pattern(such as some Gamepads):
USAGE_PAGE (Button) 05 09
USAGE (Button 1) 09 01
USAGE (Button 2) 09 02
USAGE (Button 4) 09 04
USAGE (Button 5) 09 05
USAGE (Button 7) 09 07
USAGE (Button 8) 09 08
USAGE (Button 14) 09 0E
USAGE (Button 15) 09 0F
USAGE (Button 13) 09 0D
USAGE_PAGE (Consumer Devices) 05 0C
USAGE (Back) 0a 24 02
USAGE (HomePage) 0a 23 02
LOGICAL_MINIMUM (0) 15 00
LOGICAL_MAXIMUM (1) 25 01
REPORT_SIZE (1) 75 01
REPORT_COUNT (11) 95 0B
INPUT (Data,Var,Abs) 81 02With Usage Page concatenation in Main item, parser recognizes all the 11 Usages as consumer keys, it is not the HID device's real intention.
This patch checks whether Usage Page is really defined after Usage ID items by comparing usage page using status.
Usage Page concatenation on currently defined Usage Page will always do in local parsing when Usage ID items encountered.
When Main item is parsing, concatenation will do again with last defined Usage Page if this page has not been used in the previous usages concatenation.
--- drivers/hid/hid-core.c | 51 +++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 45 insertions(+), 6 deletions(-)
drivers/hid/hid-core.c +45 -6
@@ -196,6 +196,18 @@ static unsigned hid_lookup_collection(st }/* +* Concatenate usage which defines 16 bits or less with the +* currently defined usage page to form a 32 bit usage +*/ + +static void complete_usage (struct hid_parser *parser,unsigned int index) +{ + parser->local.usage[index] &=0xFFFF ; + parser->local.usage[index] |= + (parser->global.usage_page &0xFFFF ) <<16 ; +} + +/* * Add a usage to the temporary parser table. */
@@ -206,6 +218,14 @@ static int hid_add_usage(struct hid_parsreturn -1 ; } parser->local.usage[parser->local.usage_index] = usage; + +/* +* If Usage item only includes usage id, concatenate it with +* currently defined usage page +*/ +if (size <=2 ) +complete_usage (parser, parser->local.usage_index); + parser->local.usage_size[parser->local.usage_index] = size; parser->local.collection_index[parser->local.usage_index] = parser->collection_stack_ptr ?
@@ -522,13 +542,32 @@ static int hid_parser_local(struct hid_p* usage value." */ -static void hid_concatenate_usage_page (struct hid_parser *parser) +static void hid_concatenate_last_usage_page (struct hid_parser *parser) {int i; +unsigned int usage_page; +unsigned int current_page; + +if (!parser->local.usage_index) +return ; -for (i =0 ; i < parser->local.usage_index; i++) -if (parser->local.usage_size[i] <=2 ) - parser->local.usage[i] += parser->global.usage_page <<16 ; + usage_page = parser->global.usage_page; + +/* +* Concatenate usage page again only if last declared Usage Page +* has not been already used in previous usages concatenation +*/ +for (i = parser->local.usage_index -1 ; i >=0 ; i--) { +if (parser->local.usage_size[i] >2 ) +/* Ignore extended usages */ +continue ; + + current_page = parser->local.usage[i] >>16 ; +if (current_page == usage_page) +break ; + +complete_usage (parser, i); + } }/*
@@ -540,7 +579,7 @@ static int hid_parser_main(struct hid_pa__u32 data;int ret; -hid_concatenate_usage_page (parser); +hid_concatenate_last_usage_page (parser); data =item_udata (item);
@@ -751,7 +790,7 @@ static int hid_scan_main(struct hid_pars__u32 data;int i; -hid_concatenate_usage_page (parser); +hid_concatenate_last_usage_page (parser); data =item_udata (item);
Greg Kroah-Hartman
maintainerPATCH 199/209 crypto: stm32/hash - Fix hmac issue more than 256 bytes
In reply to Greg Kroah-HartmanFrom: Lionel Debieve <[email protected]>
commit 0acabecebc912b3ba06289e4ef40476acc499a37 upstream.
Correct condition for the second hmac loop. Key must be only set in the first loop. Initial condition was wrong, HMAC_KEY flag was not properly checked.
--- drivers/crypto/stm32/stm32-hash.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/crypto/stm32/stm32-hash.c +1 -1
@@ -361,7 +361,7 @@ static int stm32_hash_xmit_cpu(struct streturn -ETIMEDOUT ;if ((hdev->flags &HASH_FLAGS_HMAC ) && - (hdev->flags & ~HASH_FLAGS_HMAC_KEY )) { + (!(hdev->flags &HASH_FLAGS_HMAC_KEY ))) { hdev->flags |=HASH_FLAGS_HMAC_KEY ;stm32_hash_write_key (hdev);if (stm32_hash_wait_busy (hdev))
Greg Kroah-Hartman
maintainerPATCH 200/209 media: stm32-dcmi: fix DMA corruption when stopping streaming
In reply to Greg Kroah-HartmanFrom: Hugues Fruchet <[email protected]>
commit b3ce6f6ff3c260ee53b0f2236e5fd950d46957da upstream.
Avoid call of dmaengine_terminate_all() between dmaengine_prep_slave_single() and dmaengine_submit() by locking the whole DMA submission sequence.
--- drivers/media/platform/stm32/stm32-dcmi.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
drivers/media/platform/stm32/stm32-dcmi.c +17 -0
@@ -161,6 +161,9 @@ struct stm32_dcmi {u32 misr;int errors_count;int buffers_count; + +/* Ensure DMA operations atomicity */ +struct mutex dma_lock; };static inline struct stm32_dcmi *notifier_to_dcmi (struct v4l2_async_notifier *n)
@@ -291,6 +294,13 @@ static int dcmi_start_dma(struct stm32_dreturn ret; } +/* +* Avoid call of dmaengine_terminate_all() between +* dmaengine_prep_slave_single() and dmaengine_submit() +* by locking the whole DMA submission sequence +*/ +mutex_lock (&dcmi->dma_lock); +/* Prepare a DMA transaction */ desc = dmaengine_prep_slave_single(dcmi->dma_chan, buf->paddr, buf->size,
@@ -298,6 +308,7 @@ static int dcmi_start_dma(struct stm32_dif (!desc) {dev_err (dcmi->dev,"%s: DMA dmaengine_prep_slave_single failed for buffer size %zu\n" , __func__, buf->size); +mutex_unlock (&dcmi->dma_lock);return -EINVAL ; }
@@ -309,9 +320,12 @@ static int dcmi_start_dma(struct stm32_d dcmi->dma_cookie =dmaengine_submit (desc);if (dma_submit_error (dcmi->dma_cookie)) {dev_err (dcmi->dev,"%s: DMA submission failed\n" , __func__); +mutex_unlock (&dcmi->dma_lock);return -ENXIO ; } +mutex_unlock (&dcmi->dma_lock); +dma_async_issue_pending (dcmi->dma_chan);return 0 ;
@@ -690,7 +704,9 @@ static void dcmi_stop_streaming(struct vspin_unlock_irq (&dcmi->irqlock);/* Stop all pending DMA operations */ +mutex_lock (&dcmi->dma_lock);dmaengine_terminate_all (dcmi->dma_chan); +mutex_unlock (&dcmi->dma_lock);clk_disable (dcmi->mclk);
@@ -1662,6 +1678,7 @@ static int dcmi_probe(struct platform_despin_lock_init (&dcmi->irqlock);mutex_init (&dcmi->lock); +mutex_init (&dcmi->dma_lock);init_completion (&dcmi->complete);INIT_LIST_HEAD (&dcmi->buffers);
Greg Kroah-Hartman
maintainerPATCH 201/209 hwrng: stm32 - fix unbalanced pm_runtime_enable
In reply to Greg Kroah-HartmanFrom: Lionel Debieve <[email protected]>
commit af0d4442dd6813de6e77309063beb064fa8e89ae upstream.
No remove function implemented yet in the driver. Without remove function, the pm_runtime implementation complains when removing and probing again the driver.
--- drivers/char/hw_random/stm32-rng.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/char/hw_random/stm32-rng.c +8 -0
@@ -166,6 +166,13 @@ static int stm32_rng_probe(struct platforeturn devm_hwrng_register (dev, &priv->rng); } +static int stm32_rng_remove (struct platform_device *ofdev) +{ +pm_runtime_disable (&ofdev->dev); + +return 0 ; +} +#ifdef CONFIG_PM static int stm32_rng_runtime_suspend (struct device *dev) {
@@ -202,6 +209,7 @@ static struct platform_driver stm32_rng_ .of_match_table = stm32_rng_match, }, .probe = stm32_rng_probe, + .remove = stm32_rng_remove, };module_platform_driver (stm32_rng_driver);
Greg Kroah-Hartman
maintainerPATCH 202/209 mailbox: mailbox-test: fix null pointer if no mmio
In reply to Greg Kroah-HartmanFrom: Fabien Dessenne <[email protected]>
commit 6899b4f7c99c72968e58e502f96084f74f6e5e86 upstream.
Fix null pointer issue if resource_size is called with no ioresource.
--- drivers/mailbox/mailbox-test.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
drivers/mailbox/mailbox-test.c +8 -6
@@ -363,22 +363,24 @@ static int mbox_test_probe(struct platfo/* It's okay for MMIO to be NULL */ res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); - size =resource_size (res); tdev->tx_mmio =devm_ioremap_resource (&pdev->dev, res); -if (PTR_ERR (tdev->tx_mmio) == -EBUSY ) +if (PTR_ERR (tdev->tx_mmio) == -EBUSY ) {/* if reserved area in SRAM, try just ioremap */ + size =resource_size (res); tdev->tx_mmio =devm_ioremap (&pdev->dev, res->start, size); -else if (IS_ERR (tdev->tx_mmio)) + }else if (IS_ERR (tdev->tx_mmio)) { tdev->tx_mmio =NULL ; + }/* If specified, second reg entry is Rx MMIO */ res =platform_get_resource (pdev,IORESOURCE_MEM ,1 ); - size =resource_size (res); tdev->rx_mmio =devm_ioremap_resource (&pdev->dev, res); -if (PTR_ERR (tdev->rx_mmio) == -EBUSY ) +if (PTR_ERR (tdev->rx_mmio) == -EBUSY ) { + size =resource_size (res); tdev->rx_mmio =devm_ioremap (&pdev->dev, res->start, size); -else if (IS_ERR (tdev->rx_mmio)) + }else if (IS_ERR (tdev->rx_mmio)) { tdev->rx_mmio = tdev->tx_mmio; + } tdev->tx_channel =mbox_test_request_channel (pdev,"tx" ); tdev->rx_channel =mbox_test_request_channel (pdev,"rx" );
Greg Kroah-Hartman
maintainerPATCH 203/209 pinctrl: stm32: fix memory leak issue
In reply to Greg Kroah-HartmanFrom: Alexandre Torgue <[email protected]>
commit cd8c9b5a49576bf28990237715bc2cb2210ac80a upstream.
configs is allocated by pinconf_generic_parse_dt_config(), pinctrl_utils_add_map_configs() duplicates configs so it can and has to be freed to prevent memory leaks.
--- drivers/pinctrl/stm32/pinctrl-stm32.c | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-)
drivers/pinctrl/stm32/pinctrl-stm32.c +16 -10
@@ -403,7 +403,7 @@ static int stm32_pctrl_dt_subnode_to_mapunsigned int num_configs;bool has_config =0 ;unsigned reserve =0 ; -int num_pins, num_funcs, maps_per_pin, i, err; +int num_pins, num_funcs, maps_per_pin, i, err =0 ; pctl =pinctrl_dev_get_drvdata (pctldev);
@@ -430,41 +430,45 @@ static int stm32_pctrl_dt_subnode_to_mapif (has_config && num_pins >=1 ) maps_per_pin++; -if (!num_pins || !maps_per_pin) -return -EINVAL ; +if (!num_pins || !maps_per_pin) { + err = -EINVAL ; + goto exit; + } reserve = num_pins * maps_per_pin; err =pinctrl_utils_reserve_map (pctldev, map, reserved_maps, num_maps, reserve);if (err) -return err; + goto exit;for (i =0 ; i < num_pins; i++) { err =of_property_read_u32_index (node,"pinmux" , i, &pinfunc);if (err) -return err; + goto exit; pin =STM32_GET_PIN_NO (pinfunc); func =STM32_GET_PIN_FUNC (pinfunc);if (!stm32_pctrl_is_function_valid (pctl, pin, func)) {dev_err (pctl->dev,"invalid function.\n" ); -return -EINVAL ; + err = -EINVAL ; + goto exit; } grp =stm32_pctrl_find_group_by_pin (pctl, pin);if (!grp) {dev_err (pctl->dev,"unable to match pin %d to group\n" , pin); -return -EINVAL ; + err = -EINVAL ; + goto exit; } err =stm32_pctrl_dt_node_to_map_func (pctl, pin, func, grp, map, reserved_maps, num_maps);if (err) -return err; + goto exit;if (has_config) { err = pinctrl_utils_add_map_configs(pctldev, map,
@@ -472,11 +476,13 @@ static int stm32_pctrl_dt_subnode_to_map configs, num_configs, PIN_MAP_TYPE_CONFIGS_GROUP);if (err) -return err; + goto exit; } } -return 0 ; +exit: +kfree (configs); +return err; } static int stm32_pctrl_dt_node_to_map(struct pinctrl_dev *pctldev,
Greg Kroah-Hartman
maintainerPATCH 204/209 ASoC: stm32: i2s: fix dma configuration
In reply to Greg Kroah-HartmanFrom: Olivier Moysan <[email protected]>
commit 1ac2bd16448997d9ec01922423486e1e85535eda upstream.
DMA configuration is not balanced on start/stop. Move DMA configuration to trigger callback.
--- sound/soc/stm/stm32_i2s.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
sound/soc/stm/stm32_i2s.c +7 -7
@@ -488,7 +488,7 @@ static int stm32_i2s_configure(struct sn {struct stm32_i2s_data *i2s =snd_soc_dai_get_drvdata (cpu_dai);int format =params_width (params); -u32 cfgr, cfgr_mask, cfg1, cfg1_mask; +u32 cfgr, cfgr_mask, cfg1;unsigned int fthlv;int ret;
@@ -529,15 +529,11 @@ static int stm32_i2s_configure(struct snif (ret <0 )return ret; - cfg1 =I2S_CFG1_RXDMAEN |I2S_CFG1_TXDMAEN ; - cfg1_mask = cfg1; - fthlv =STM32_I2S_FIFO_SIZE *I2S_FIFO_TH_ONE_QUARTER /4 ; - cfg1 |=I2S_CFG1_FTHVL_SET (fthlv -1 ); - cfg1_mask |=I2S_CFG1_FTHVL_MASK ; + cfg1 =I2S_CFG1_FTHVL_SET (fthlv -1 );return regmap_update_bits (i2s->regmap,STM32_I2S_CFG1_REG , - cfg1_mask, cfg1); +I2S_CFG1_FTHVL_MASK , cfg1); } static int stm32_i2s_startup(struct snd_pcm_substream *substream,
@@ -589,6 +585,10 @@ static int stm32_i2s_trigger(struct snd_/* Enable i2s */ dev_dbg (cpu_dai->dev,"start I2S\n" ); + cfg1_mask =I2S_CFG1_RXDMAEN |I2S_CFG1_TXDMAEN ; +regmap_update_bits (i2s->regmap,STM32_I2S_CFG1_REG , + cfg1_mask, cfg1_mask); + ret =regmap_update_bits (i2s->regmap,STM32_I2S_CR1_REG ,I2S_CR1_SPE ,I2S_CR1_SPE );if (ret <0 ) {
Greg Kroah-Hartman
maintainerPATCH 205/209 ASoC: stm32: i2s: fix 16 bit format support
In reply to Greg Kroah-HartmanFrom: Olivier Moysan <[email protected]>
commit 0c4c68d6fa1bae74d450e50823c24fcc3cd0b171 upstream.
I2S supports 16 bits data in 32 channel length. However the expected driver behavior, is to
set channel length to 16 bits when data format is 16 bits.
--- sound/soc/stm/stm32_i2s.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/stm/stm32_i2s.c +1 -1
@@ -501,7 +501,7 @@ static int stm32_i2s_configure(struct snswitch (format) {case 16 : cfgr =I2S_CGFR_DATLEN_SET (I2S_I2SMOD_DATLEN_16 ); - cfgr_mask =I2S_CGFR_DATLEN_MASK ; + cfgr_mask =I2S_CGFR_DATLEN_MASK |I2S_CGFR_CHLEN ;break ;case 32 : cfgr = I2S_CGFR_DATLEN_SET(I2S_I2SMOD_DATLEN_32) |
Greg Kroah-Hartman
maintainerPATCH 206/209 ASoC: stm32: i2s: fix IRQ clearing
In reply to Greg Kroah-HartmanFrom: Olivier Moysan <[email protected]>
commit 8ba3c5215d69c09f5c39783ff3b78347769822ad upstream.
Because of regmap cache, interrupts may not be cleared as expected.
Declare IFCR register as write only and make writings to IFCR register unconditional.
--- sound/soc/stm/stm32_i2s.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)
sound/soc/stm/stm32_i2s.c +6 -7
@@ -246,8 +246,8 @@ static irqreturn_t stm32_i2s_isr(int irqreturn IRQ_NONE ; } -regmap_update_bits (i2s->regmap,STM32_I2S_IFCR_REG , -I2S_IFCR_MASK , flags); +regmap_write_bits (i2s->regmap,STM32_I2S_IFCR_REG , +I2S_IFCR_MASK , flags);if (flags &I2S_SR_OVR ) {dev_dbg (&pdev->dev,"Overrun\n" );
@@ -276,7 +276,6 @@ static bool stm32_i2s_readable_reg(struccase STM32_I2S_CFG2_REG :case STM32_I2S_IER_REG :case STM32_I2S_SR_REG : -case STM32_I2S_IFCR_REG :case STM32_I2S_TXDR_REG :case STM32_I2S_RXDR_REG :case STM32_I2S_CGFR_REG :
@@ -547,8 +546,8 @@ static int stm32_i2s_startup(struct snd_ i2s->refcount++;spin_unlock (&i2s->lock_fd); -return regmap_update_bits (i2s->regmap,STM32_I2S_IFCR_REG , -I2S_IFCR_MASK ,I2S_IFCR_MASK ); +return regmap_write_bits (i2s->regmap,STM32_I2S_IFCR_REG , +I2S_IFCR_MASK ,I2S_IFCR_MASK ); } static int stm32_i2s_hw_params(struct snd_pcm_substream *substream,
@@ -603,8 +602,8 @@ static int stm32_i2s_trigger(struct snd_return ret; } -regmap_update_bits (i2s->regmap,STM32_I2S_IFCR_REG , -I2S_IFCR_MASK ,I2S_IFCR_MASK ); +regmap_write_bits (i2s->regmap,STM32_I2S_IFCR_REG , +I2S_IFCR_MASK ,I2S_IFCR_MASK );if (playback_flg) { ier =I2S_IER_UDRIE ;
Greg Kroah-Hartman
maintainerPATCH 207/209 platform/x86: hp-wmi: Fix ACPI errors caused by too small buffer
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
commit 16245db1489cd9aa579506f64afeeeb13d825a93 upstream.
The HP WMI calls may take up to 128 bytes of data as input, and the AML methods implementing the WMI calls, declare a couple of fields for accessing input in different sizes, specifycally the HWMC method contains:
CreateField (Arg1, 0x80, 0x0400, D128)
Even though we do not use any of the WMI command-types which need a buffer of this size, the APCI interpreter still tries to create it as it is declared in generoc code at the top of the HWMC method which runs before the code looks at which command-type is requested.
This results in many of these errors on many different HP laptop models:
[ 14.459261] ACPI Error: Field [D128] at 1152 exceeds Buffer [NULL] size 160 (bits) (20170303/dsopcode-236) [ 14.459268] ACPI Error: Method parse/execution failed [\HWMC] (Node ffff8edcc61507f8), AE_AML_BUFFER_LIMIT (20170303/psparse-543) [ 14.459279] ACPI Error: Method parse/execution failed [\_SB.WMID.WMAA] (Node ffff8edcc61523c0), AE_AML_BUFFER_LIMIT (20170303/psparse-543)
This commit increases the size of the data element of the bios_args struct to 128 bytes fixing these errors.
--- drivers/platform/x86/hp-wmi.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/platform/x86/hp-wmi.c +3 -3
@@ -78,7 +78,7 @@ struct bios_args {u32 command;u32 commandtype;u32 datasize; -u32 data; +u8 data[128 ]; };enum hp_wmi_commandtype {
@@ -229,7 +229,7 @@ static int hp_wmi_perform_query(int quer .command = command, .commandtype = query, .datasize = insize, - .data = 0, + .data = { 0 }, };struct acpi_buffer input = {sizeof (struct bios_args ), &args };struct acpi_buffer output = {ACPI_ALLOCATE_BUFFER ,NULL };
@@ -241,7 +241,7 @@ static int hp_wmi_perform_query(int querif (WARN_ON (insize >sizeof (args.data)))return -EINVAL ; -memcpy (&args.data, buffer, insize); +memcpy (&args.data[0 ], buffer, insize);wmi_evaluate_method (HPWMI_BIOS_GUID ,0 , mid, &input, &output);
Greg Kroah-Hartman
maintainerPATCH 208/209 platform/x86: hp-wmi: Fix ACPI errors caused by passing 0 as input size
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
commit f3e4f3fc8ee9729c4b1b27a478c68b713df53c0c upstream.
The AML code implementing the WMI methods creates a variable length field to hold the input data we pass like this:
CreateDWordField (Arg1, 0x0C, DSZI)
Local5 = DSZI /* \HWMC.DSZI */
CreateField (Arg1, 0x80, (Local5 * 0x08), DAIN)If we pass 0 as bios_args.datasize argument then (Local5 * 0x08) is 0 which results in these errors:
[ 71.973305] ACPI BIOS Error (bug): Attempt to CreateField of length zero (20190816/dsopcode-133) [ 71.973332] ACPI Error: Aborting method \HWMC due to previous error (AE_AML_OPERAND_VALUE) (20190816/psparse-529) [ 71.973413] ACPI Error: Aborting method \_SB.WMID.WMAA due to previous error (AE_AML_OPERAND_VALUE) (20190816/psparse-529)
And in our HPWMI_WIRELESS2_QUERY calls always failing. for read commands like HPWMI_WIRELESS2_QUERY the DSZI value is not used / checked, except for read commands where extra input is needed to specify exactly what to read.
So for HPWMI_WIRELESS2_QUERY we can safely pass the size of the expected output as insize to hp_wmi_perform_query(), as we are already doing for all other HPWMI_READ commands we send. Doing so fixes these errors.
--- drivers/platform/x86/hp-wmi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/platform/x86/hp-wmi.c +2 -2
@@ -393,7 +393,7 @@ static int hp_wmi_rfkill2_refresh(void)int err, i; err =hp_wmi_perform_query (HPWMI_WIRELESS2_QUERY ,HPWMI_READ , &state, -0 ,sizeof (state)); +sizeof (state),sizeof (state));if (err)return err;
@@ -790,7 +790,7 @@ static int __init hp_wmi_rfkill2_setup(sint err, i; err =hp_wmi_perform_query (HPWMI_WIRELESS2_QUERY ,HPWMI_READ , &state, -0 ,sizeof (state)); +sizeof (state),sizeof (state));if (err)return err <0 ? err : -EINVAL ;
Greg Kroah-Hartman
maintainerPATCH 209/209 net: fec: fix clock count mis-match
In reply to Greg Kroah-HartmanFrom: Chuhong Yuan <[email protected]>
commit a31eda65ba210741b598044d045480494d0ed52a upstream.
pm_runtime_put_autosuspend in probe will call runtime suspend to disable clks automatically if CONFIG_PM is defined. (If CONFIG_PM is not defined, its implementation will be empty, then runtime suspend will not be called.)
Therefore, we can call pm_runtime_get_sync to runtime resume it first to enable clks, which matches the runtime suspend. (Only when CONFIG_PM is defined, otherwise pm_runtime_get_sync will also be empty, then runtime resume will not be called.)
Then it is fine to disable clks without causing clock count mis-match.
--- drivers/net/ethernet/freescale/fec_main.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-)
drivers/net/ethernet/freescale/fec_main.c +11 -4
@@ -3565,6 +3565,11 @@ fec_drv_remove(struct platform_device *pstruct net_device *ndev =platform_get_drvdata (pdev);struct fec_enet_private *fep =netdev_priv (ndev);struct device_node *np = pdev->dev.of_node; +int ret; + + ret =pm_runtime_get_sync (&pdev->dev); +if (ret <0 ) +return ret;cancel_work_sync (&fep->tx_timeout_work);fec_ptp_stop (pdev);
@@ -3572,15 +3577,17 @@ fec_drv_remove(struct platform_device *pfec_enet_mii_remove (fep);if (fep->reg_phy)regulator_disable (fep->reg_phy); -pm_runtime_put (&pdev->dev); -pm_runtime_disable (&pdev->dev); -clk_disable_unprepare (fep->clk_ahb); -clk_disable_unprepare (fep->clk_ipg); +if (of_phy_is_fixed_link (np))of_phy_deregister_fixed_link (np);of_node_put (fep->phy_node);free_netdev (ndev); +clk_disable_unprepare (fep->clk_ahb); +clk_disable_unprepare (fep->clk_ipg); +pm_runtime_put_noidle (&pdev->dev); +pm_runtime_disable (&pdev->dev); +return 0 ; }
Quoted 10 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.14.158 release. There are 209 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Fri, 06 Dec 2019 17:50:10 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.14.158-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.14.y
and the diffstat can be found below.thanks,
greg k-h
Results from Linaro’s test farm.
No regressions on arm64, arm, x86_64, and i386.
Summary
------------------------------------------------------------------------
kernel: 4.14.158-rc1
git repo: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
git branch: linux-4.14.y
git commit: ce267d7b1d71f10d722fd3c8a729ccca53830262
git describe: v4.14.157-210-gce267d7b1d71
Test details: https://qa-reports.linaro.org/lkft/linux-stable-rc-4.14-oe/build/v4.14.157-210-gce267d7b1d71
No regressions (compared to build v4.14.157)
No fixes (compared to build v4.14.157)
Ran 24134 total tests in the following environments and test suites.
Environments
--------------
- dragonboard-410c - arm64
- hi6220-hikey - arm64
- i386
- juno-r2 - arm64
- qemu_arm
- qemu_arm64
- qemu_i386
- qemu_x86_64
- x15 - arm
- x86_64
Test Suites
-----------
* build
* install-android-platform-tools-r2600
* kselftest
* libhugetlbfs
* linux-log-parser
* ltp-containers-tests
* ltp-cve-tests
* ltp-dio-tests
* ltp-fs-tests
* ltp-io-tests
* spectre-meltdown-checker-test
* ltp-commands-tests
* ltp-hugetlb-tests
* ltp-ipc-tests
* ltp-math-tests
* ltp-mm-tests
* ltp-cap_bounds-tests
* ltp-cpuhotplug-tests
* ltp-fcntl-locktests-tests
* ltp-filecaps-tests
* ltp-fs_bind-tests
* ltp-fs_perms_simple-tests
* ltp-fsx-tests
* ltp-nptl-tests
* ltp-open-posix-tests
* ltp-pty-tests
* ltp-sched-tests
* ltp-securebits-tests
* ltp-syscalls-tests
* network-basic-tests
* perf
* v4l2-compliance
* kvm-unit-tests
* kselftest-vsyscall-mode-native
* kselftest-vsyscall-mode-none
* ssuite
Signature · 2 lines
Linaro LKFT https://lkft.linaro.org
Greg Kroah-Hartman
maintainerQuoted 17 lines · Naresh Kamboju
Quoted 15 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.14.158 release. There are 209 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Fri, 06 Dec 2019 17:50:10 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.14.158-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.14.y
and the diffstat can be found below.
Quoted 6 lines
Quoted 3 lines
thanks,
greg k-h
Results from Linaro’s test farm.
No regressions on arm64, arm,x86_64, and i386.
Thanks for testing all of these and letting me know.
greg k-h
Jon Hunter
maintainerQuoted 14 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.14.158 release. There are 209 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Fri, 06 Dec 2019 17:50:10 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.14.158-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.14.y
and the diffstat can be found below.
Quoted 5 lines
thanks,
greg k-h
-------------
All tests are passing for Tegra ...
Test results for stable-v4.14:
8 builds: 8 pass, 0 fail
16 boots: 16 pass, 0 fail
24 tests: 24 pass, 0 failLinux version: 4.14.158-rc1-gce267d7b1d71
Boards tested: tegra124-jetson-tk1, tegra20-ventana,
tegra210-p2371-2180, tegra30-cardhu-a04
Cheers
Jon
Signature · 1 line
nvpublic
Greg Kroah-Hartman
maintainerQuoted 24 lines · Jon Hunter
Quoted 14 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.14.158 release. There are 209 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Fri, 06 Dec 2019 17:50:10 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.14.158-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.14.y
and the diffstat can be found below.Quoted 5 lines
thanks,
greg k-h
-------------
All tests are passing for Tegra ...
Quoted 9 lines
Test results for stable-v4.14:
8 builds: 8 pass, 0 fail 16 boots: 16 pass, 0 fail 24 tests: 24 pass, 0 failLinux version: 4.14.158-rc1-gce267d7b1d71
Boards tested: tegra124-jetson-tk1, tegra20-ventana,tegra210-p2371-2180, tegra30-cardhu-a04
Thanks for testing all of these and letting me know.
greg k-h
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.14.158 release. There are 209 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Fri, 06 Dec 2019 17:50:10 +0000. Anything received after that time might be too late.
Build results:
total: 172 pass: 172 fail: 0 Qemu test results: total: 372 pass: 372 fail: 0
Guenter
Greg Kroah-Hartman
maintainerQuoted 6 lines · Guenter Roeck
Quoted 5 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.14.158 release. There are 209 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Quoted 8 lines
Quoted 3 lines
Responses should be made by Fri, 06 Dec 2019 17:50:10 +0000. Anything received after that time might be too late.
Build results:
total: 172 pass: 172 fail: 0 Qemu test results: total: 372 pass: 372 fail: 0
Great, thanks for testing and letting me know.
greg k-h
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.14.158 release. There are 209 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Fri, 06 Dec 2019 17:50:10 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 9 lines
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.14.158-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.14.y
and the diffstat can be found below.thanks,
greg k-h
Starting with Linux 4.14.157, 4.9.204, and 4.4.204 stables stopped booting on my system. It can't find the root disk. No config changes in between.
I have been bisecting 4.14 and 4.9 with no luck so far. I updated to Ubuntu 19.10 in between.
The only other thing I see is CONFIG_GCC_VERSION which is supported starting 4.18. I don't this boot failing issue on 4.19 + up. I am also chasing any links between this config and scripts and tools that generate the initramfs.
I am still debugging ... Serious for me since I can no longer test older stables. :(
thanks,
-- Shuah
Greg Kroah-Hartman
maintainerQuoted 24 lines · shuah
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.14.158 release. There are 209 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Fri, 06 Dec 2019 17:50:10 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 9 lines
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.14.158-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.14.y
and the diffstat can be found below.thanks,
greg k-h
Starting with Linux 4.14.157, 4.9.204, and 4.4.204 stables stopped booting on my system. It can't find the root disk. No config changes in between.
Quoted 7 lines
I have been bisecting 4.14 and 4.9 with no luck so far. I updated to Ubuntu 19.10 in between.
The only other thing I see is
CONFIG_GCC_VERSIONwhich is supported starting 4.18. I don't this boot failing issue on 4.19 + up. I am also chasing any links between this config and scripts and tools that generate the initramfs.
Did you also upgrade your version of gcc? I know I build those older kernels with the latest version of gcc for build tests, but I do not boot them. I think everyone who still uses them uses older versions of gcc.
Quoted 2 lines
I am still debugging ... Serious for me since I can no longer test older stables. :(
Ick, not good, sorry. If you find anything bisecting, please let me know.
thanks,
greg k-h
Quoted 33 lines · Greg Kroah-Hartman
Quoted 24 lines · shuah
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.14.158 release. There are 209 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Fri, 06 Dec 2019 17:50:10 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 9 lines
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.14.158-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.14.y
and the diffstat can be found below.thanks,
greg k-h
Starting with Linux 4.14.157, 4.9.204, and 4.4.204 stables stopped booting on my system. It can't find the root disk. No config changes in between.
Quoted 7 lines
I have been bisecting 4.14 and 4.9 with no luck so far. I updated to Ubuntu 19.10 in between.
The only other thing I see is
CONFIG_GCC_VERSIONwhich is supported starting 4.18. I don't this boot failing issue on 4.19 + up. I am also chasing any links between this config and scripts and tools that generate the initramfs.
Quoted 4 lines
Did you also upgrade your version of gcc? I know I build those older kernels with the latest version of gcc for build tests, but I do not boot them. I think everyone who still uses them uses older versions of gcc.
Yes. gcc version changed. That has been my strong suspect since I started poking around the CONFIG_GCC_VERSION.
I will try to force it to use older gcc and see if things improve.
Quoted 7 lines
Quoted 3 lines
I am still debugging ... Serious for me since I can no longer test older stables. :(
Ick, not good, sorry. If you find anything bisecting, please let me know.
Will do.
thanks,
-- Shuah
Quoted 34 lines · shuah
Quoted 33 lines · Greg Kroah-Hartman
Quoted 31 lines · shuah
Quoted 14 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.14.158 release. There are 209 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Fri, 06 Dec 2019 17:50:10 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.14.158-rc1.gz
or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-4.14.y and the diffstat can be found below.Quoted 4 lines
thanks,
greg k-h
Starting with Linux 4.14.157, 4.9.204, and 4.4.204 stables stopped booting on my system. It can't find the root disk. No config changes in between.
I have been bisecting 4.14 and 4.9 with no luck so far. I updated to Ubuntu 19.10 in between.
The only other thing I see is
CONFIG_GCC_VERSIONwhich is supported starting 4.18. I don't this boot failing issue on 4.19 + up. I am also chasing any links between this config and scripts and tools that generate the initramfs.
Quoted 7 lines
Quoted 4 lines
Did you also upgrade your version of gcc? I know I build those older kernels with the latest version of gcc for build tests, but I do not boot them. I think everyone who still uses them uses older versions of gcc.
Yes. gcc version changed. That has been my strong suspect since I started poking around the
CONFIG_GCC_VERSION.
What version of gcc are you using ? I currently use gcc 8.3.0 for all qemu boot tests (except for 3.16 which doesn't support it, or at least it didn't when I last checked), and have not observed any problems.
Thanks,
Guenter
Quoted 41 lines · Guenter Roeck
Quoted 40 lines · shuah
Quoted 38 lines · Greg Kroah-Hartman
Quoted 25 lines · shuah
Quoted 11 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.14.158 release. There are 209 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Fri, 06 Dec 2019 17:50:10 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.14.158-rc1.gzQuoted 8 lines
or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-4.14.y and the diffstat can be found below.thanks,
greg k-h
Starting with Linux 4.14.157, 4.9.204, and 4.4.204 stables stopped booting on my system. It can't find the root disk. No config changes in between.
Quoted 7 lines
I have been bisecting 4.14 and 4.9 with no luck so far. I updated to Ubuntu 19.10 in between.
The only other thing I see is
CONFIG_GCC_VERSIONwhich is supported starting 4.18. I don't this boot failing issue on 4.19 + up. I am also chasing any links between this config and scripts and tools that generate the initramfs.Did you also upgrade your version of gcc? I know I build those older kernels with the latest version of gcc for build tests, but I do not boot them. I think everyone who still uses them uses older versions of gcc.
Quoted 7 lines
Quoted 2 lines
Yes. gcc version changed. That has been my strong suspect since I started poking around the
CONFIG_GCC_VERSION.What version of gcc are you using ? I currently use gcc 8.3.0 for all qemu boot tests (except for 3.16 which doesn't support it, or at least it didn't when I last checked), and have not observed any problems.
With the upgrade gcc version went from 8.3.0 to 9.2.1
Interestingly enough all the older 4.14, 4.9, and 4.4 kernel I have on the system boot just fine. It fails when build newer rcs with new gcc, boot fails.
I would really like to understand it just in case something in our kbuild scrips is the issue.
thanks,
-- Shuah
Quoted 49 lines · shuah
Quoted 40 lines · Guenter Roeck
Quoted 39 lines · shuah
Quoted 37 lines · Greg Kroah-Hartman
Quoted 24 lines · shuah
Quoted 14 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.14.158 release. There are 209 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Fri, 06 Dec 2019 17:50:10 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.14.158-rc1.gz
or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-4.14.y and the diffstat can be found below.Quoted 4 lines
thanks,
greg k-h
Starting with Linux 4.14.157, 4.9.204, and 4.4.204 stables stopped booting on my system. It can't find the root disk. No config changes in between.
Quoted 7 lines
I have been bisecting 4.14 and 4.9 with no luck so far. I updated to Ubuntu 19.10 in between.
The only other thing I see is
CONFIG_GCC_VERSIONwhich is supported starting 4.18. I don't this boot failing issue on 4.19 + up. I am also chasing any links between this config and scripts and tools that generate the initramfs.Did you also upgrade your version of gcc? I know I build those older kernels with the latest version of gcc for build tests, but I do not boot them. I think everyone who still uses them uses older versions of gcc.
Quoted 7 lines
Quoted 2 lines
Yes. gcc version changed. That has been my strong suspect since I started poking around the
CONFIG_GCC_VERSION.What version of gcc are you using ? I currently use gcc 8.3.0 for all qemu boot tests (except for 3.16 which doesn't support it, or at least it didn't when I last checked), and have not observed any problems.
Quoted 9 lines
With the upgrade gcc version went from 8.3.0 to 9.2.1
Interestingly enough all the older 4.14, 4.9, and 4.4 kernel I have on the system boot just fine. It fails when build newer rcs with new gcc, boot fails.
I would really like to understand it just in case something in our kbuild scrips is the issue.
v4.4.206 boots for me into qemu when compiled with gcc 9.2.0 (9.2.1 does not appear to be an official release). So at least it isn't that simple. Let me know if I can test anything else.
Thanks,
Guenter
Quoted 57 lines · Guenter Roeck
Quoted 56 lines · shuah
Quoted 41 lines · Guenter Roeck
Quoted 40 lines · shuah
Quoted 38 lines · Greg Kroah-Hartman
Quoted 25 lines · shuah
Quoted 11 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.14.158 release. There are 209 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Fri, 06 Dec 2019 17:50:10 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.14.158-rc1.gzQuoted 8 lines
or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-4.14.y and the diffstat can be found below.thanks,
greg k-h
Starting with Linux 4.14.157, 4.9.204, and 4.4.204 stables stopped booting on my system. It can't find the root disk. No config changes in between.
Quoted 7 lines
I have been bisecting 4.14 and 4.9 with no luck so far. I updated to Ubuntu 19.10 in between.
The only other thing I see is
CONFIG_GCC_VERSIONwhich is supported starting 4.18. I don't this boot failing issue on 4.19 + up. I am also chasing any links between this config and scripts and tools that generate the initramfs.Did you also upgrade your version of gcc? I know I build those older kernels with the latest version of gcc for build tests, but I do not boot them. I think everyone who still uses them uses older versions of gcc.
Quoted 7 lines
Quoted 2 lines
Yes. gcc version changed. That has been my strong suspect since I started poking around the
CONFIG_GCC_VERSION.What version of gcc are you using ? I currently use gcc 8.3.0 for all qemu boot tests (except for 3.16 which doesn't support it, or at least it didn't when I last checked), and have not observed any problems.
With the upgrade gcc version went from 8.3.0 to 9.2.1
Interestingly enough all the older 4.14, 4.9, and 4.4 kernel I have on the system boot just fine. It fails when build newer rcs with new gcc, boot fails.
Quoted 8 lines
Quoted 3 lines
I would really like to understand it just in case something in our kbuild scrips is the issue.
v4.4.206 boots for me into qemu when compiled with gcc 9.2.0 (9.2.1 does not appear to be an official release). So at least it isn't that simple. Let me know if I can test anything else.
Update on this. I managed to boot 4.14.158 by installing stripping modules INSTALL_MOD_STRIP=1. I also disabled KASAN.
The above doesn't work on Linux 4.9.206 or Linux 4.4.206. Investigating still.
thanks,
-- Shuah