I found a dead code in the queue/4.9 branch of the stable-rc repository.
2021-02-03: commit c27f392040e2f6 ("futex: Provide distinct return value when owner is exiting") The function handle_exit_race does not exist. Therefore, the change in handle_exit_race() is ignored in the patch round.
2021-02-22: commit e55cb811e612 ("futex: Cure exit race") Define the handle_exit_race() function, but no branch in the function returns EBUSY. As a result, dead code occurs in the attach_to_pi_owner():
int ret = handle_exit_race(uaddr, uval, p); ... if (ret == -EBUSY) *exiting = p; /* dead code */
To fix the dead code, modify the commit e55cb811e612 ("futex: Cure exit race"), or install a patch to incorporate the changes in handle_exit_race().
I am unfamiliar with the processing of the stable-rc queue branch, and I cannot find the patch mail of the current branch in https://lore.kernel.org/lkml/?q=%22futex%3A+Cure+exit+race%22 Therefore, I re-integrated commit ac31c7ff8624 ("futex: Provide distinct return value when owner is exiting").
-----
Thomas Gleixner (1): futex: Provide distinct return value when owner is exiting
kernel/futex.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
From: Thomas Gleixner tglx@linutronix.de
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.
Signed-off-by: Thomas Gleixner tglx@linutronix.de Reviewed-by: Ingo Molnar mingo@kernel.org Acked-by: Peter Zijlstra (Intel) peterz@infradead.org Link: https://lkml.kernel.org/r/20191106224556.935606117@linutronix.de
[nixiaoming: Modify handle_exit_race() to avoid dead code.] Cc: stable@vger.kernel.org # queue/4.9 Signed-off-by: Xiaoming Ni nixiaoming@huawei.com --- kernel/futex.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/kernel/futex.c b/kernel/futex.c index b65dbb5d60bb..0fd785410150 100644 --- a/kernel/futex.c +++ b/kernel/futex.c @@ -1207,11 +1207,11 @@ static int handle_exit_race(u32 __user *uaddr, u32 uval, 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:
On Mon, Feb 22, 2021 at 03:03:28PM +0800, Xiaoming Ni wrote:
From: Thomas Gleixner tglx@linutronix.de
commit ac31c7ff8624409ba3c4901df9237a616c187a5d upstream.
This commit is already in the 4.9 tree. If the backport was incorrect, say that here, and describe what went wrong and why this commit fixes it.
Also state what commit this fixes as well, otherwise this changelog just looks like it is being applied again to the tree, which doesn't make much sense.
thanks,
greg k-h
On 2021/2/22 18:16, Greg KH wrote:
On Mon, Feb 22, 2021 at 03:03:28PM +0800, Xiaoming Ni wrote:
From: Thomas Gleixnertglx@linutronix.de
commit ac31c7ff8624409ba3c4901df9237a616c187a5d upstream.
This commit is already in the 4.9 tree. If the backport was incorrect, say that here, and describe what went wrong and why this commit fixes it.
Also state what commit this fixes as well, otherwise this changelog just looks like it is being applied again to the tree, which doesn't make much sense.
thanks,
greg k-h .
I wrote a cover for it. but forgot to adjust the title of the cover:
https://lore.kernel.org/lkml/20210222070328.102384-1-nixiaoming@huawei.com/
I found a dead code in the queue/4.9 branch of the stable-rc repository.
2021-02-03: commit c27f392040e2f6 ("futex: Provide distinct return value when owner is exiting") The function handle_exit_race does not exist. Therefore, the change in handle_exit_race() is ignored in the patch round.
2021-02-22: commit e55cb811e612 ("futex: Cure exit race") Define the handle_exit_race() function, but no branch in the function returns EBUSY. As a result, dead code occurs in the attach_to_pi_owner():
int ret = handle_exit_race(uaddr, uval, p); ... if (ret == -EBUSY) *exiting = p; /* dead code */
To fix the dead code, modify the commit e55cb811e612 ("futex: Cure exit race"), or install a patch to incorporate the changes in handle_exit_race().
I am unfamiliar with the processing of the stable-rc queue branch, and I cannot find the patch mail of the current branch in https://lore.kernel.org/lkml/?q=%22futex%3A+Cure+exit+race%22 Therefore, I re-integrated commit ac31c7ff8624 ("futex: Provide distinct return value when owner is exiting"). And wrote a cover (but forgot to adjust the title of the cover):
https://lore.kernel.org/lkml/20210222070328.102384-1-nixiaoming@huawei.com/
Thanks Xiaoming Ni
On Mon, Feb 22, 2021 at 06:54:06PM +0800, Xiaoming Ni wrote:
On 2021/2/22 18:16, Greg KH wrote:
On Mon, Feb 22, 2021 at 03:03:28PM +0800, Xiaoming Ni wrote:
From: Thomas Gleixnertglx@linutronix.de
commit ac31c7ff8624409ba3c4901df9237a616c187a5d upstream.
This commit is already in the 4.9 tree. If the backport was incorrect, say that here, and describe what went wrong and why this commit fixes it.
Also state what commit this fixes as well, otherwise this changelog just looks like it is being applied again to the tree, which doesn't make much sense.
thanks,
greg k-h .
I wrote a cover for it. but forgot to adjust the title of the cover:
https://lore.kernel.org/lkml/20210222070328.102384-1-nixiaoming@huawei.com/
I found a dead code in the queue/4.9 branch of the stable-rc repository.
2021-02-03: commit c27f392040e2f6 ("futex: Provide distinct return value when owner is exiting") The function handle_exit_race does not exist. Therefore, the change in handle_exit_race() is ignored in the patch round.
2021-02-22: commit e55cb811e612 ("futex: Cure exit race") Define the handle_exit_race() function, but no branch in the function returns EBUSY. As a result, dead code occurs in the attach_to_pi_owner():
int ret = handle_exit_race(uaddr, uval, p); ... if (ret == -EBUSY) *exiting = p; /* dead code */
To fix the dead code, modify the commit e55cb811e612 ("futex: Cure exit race"), or install a patch to incorporate the changes in handle_exit_race().
I am unfamiliar with the processing of the stable-rc queue branch, and I cannot find the patch mail of the current branch in https://lore.kernel.org/lkml/?q=%22futex%3A+Cure+exit+race%22 Therefore, I re-integrated commit ac31c7ff8624 ("futex: Provide distinct return value when owner is exiting"). And wrote a cover (but forgot to adjust the title of the cover):
https://lore.kernel.org/lkml/20210222070328.102384-1-nixiaoming@huawei.com/
So this is a "fixup" patch, right?
Please clearly label it as such in your patch description and resend this as what is here I can not apply at all.
thanks,
greg k-h
On 2021/2/22 20:09, Greg KH wrote:
On Mon, Feb 22, 2021 at 06:54:06PM +0800, Xiaoming Ni wrote:
On 2021/2/22 18:16, Greg KH wrote:
On Mon, Feb 22, 2021 at 03:03:28PM +0800, Xiaoming Ni wrote:
From: Thomas Gleixnertglx@linutronix.de
commit ac31c7ff8624409ba3c4901df9237a616c187a5d upstream.
This commit is already in the 4.9 tree. If the backport was incorrect, say that here, and describe what went wrong and why this commit fixes it.
Also state what commit this fixes as well, otherwise this changelog just looks like it is being applied again to the tree, which doesn't make much sense.
thanks,
greg k-h .
I wrote a cover for it. but forgot to adjust the title of the cover:
https://lore.kernel.org/lkml/20210222070328.102384-1-nixiaoming@huawei.com/
I found a dead code in the queue/4.9 branch of the stable-rc repository.
2021-02-03: commit c27f392040e2f6 ("futex: Provide distinct return value when owner is exiting") The function handle_exit_race does not exist. Therefore, the change in handle_exit_race() is ignored in the patch round.
2021-02-22: commit e55cb811e612 ("futex: Cure exit race") Define the handle_exit_race() function, but no branch in the function returns EBUSY. As a result, dead code occurs in the attach_to_pi_owner():
int ret = handle_exit_race(uaddr, uval, p); ... if (ret == -EBUSY) *exiting = p; /* dead code */
To fix the dead code, modify the commit e55cb811e612 ("futex: Cure exit race"), or install a patch to incorporate the changes in handle_exit_race().
I am unfamiliar with the processing of the stable-rc queue branch, and I cannot find the patch mail of the current branch in https://lore.kernel.org/lkml/?q=%22futex%3A+Cure+exit+race%22 Therefore, I re-integrated commit ac31c7ff8624 ("futex: Provide distinct return value when owner is exiting"). And wrote a cover (but forgot to adjust the title of the cover):
https://lore.kernel.org/lkml/20210222070328.102384-1-nixiaoming@huawei.com/
So this is a "fixup" patch, right?
Please clearly label it as such in your patch description and resend this as what is here I can not apply at all.
thanks,
greg k-h .
Thank you for your guidance. I have updated the patch description and resent the patch based on v4.9.258-rc1 https://lore.kernel.org/lkml/20210222125352.110124-1-nixiaoming@huawei.com/
Thanks Xiaoming Ni
On Mon, Feb 22, 2021 at 10:11:37PM +0800, Xiaoming Ni wrote:
On 2021/2/22 20:09, Greg KH wrote:
On Mon, Feb 22, 2021 at 06:54:06PM +0800, Xiaoming Ni wrote:
On 2021/2/22 18:16, Greg KH wrote:
On Mon, Feb 22, 2021 at 03:03:28PM +0800, Xiaoming Ni wrote:
From: Thomas Gleixnertglx@linutronix.de
commit ac31c7ff8624409ba3c4901df9237a616c187a5d upstream.
This commit is already in the 4.9 tree. If the backport was incorrect, say that here, and describe what went wrong and why this commit fixes it.
Also state what commit this fixes as well, otherwise this changelog just looks like it is being applied again to the tree, which doesn't make much sense.
thanks,
greg k-h .
I wrote a cover for it. but forgot to adjust the title of the cover:
https://lore.kernel.org/lkml/20210222070328.102384-1-nixiaoming@huawei.com/
I found a dead code in the queue/4.9 branch of the stable-rc repository.
2021-02-03: commit c27f392040e2f6 ("futex: Provide distinct return value when owner is exiting") The function handle_exit_race does not exist. Therefore, the change in handle_exit_race() is ignored in the patch round.
2021-02-22: commit e55cb811e612 ("futex: Cure exit race") Define the handle_exit_race() function, but no branch in the function returns EBUSY. As a result, dead code occurs in the attach_to_pi_owner():
int ret = handle_exit_race(uaddr, uval, p); ... if (ret == -EBUSY) *exiting = p; /* dead code */
To fix the dead code, modify the commit e55cb811e612 ("futex: Cure exit race"), or install a patch to incorporate the changes in handle_exit_race().
I am unfamiliar with the processing of the stable-rc queue branch, and I cannot find the patch mail of the current branch in https://lore.kernel.org/lkml/?q=%22futex%3A+Cure+exit+race%22 Therefore, I re-integrated commit ac31c7ff8624 ("futex: Provide distinct return value when owner is exiting"). And wrote a cover (but forgot to adjust the title of the cover):
https://lore.kernel.org/lkml/20210222070328.102384-1-nixiaoming@huawei.com/
So this is a "fixup" patch, right?
Please clearly label it as such in your patch description and resend this as what is here I can not apply at all.
thanks,
greg k-h .
Thank you for your guidance. I have updated the patch description and resent the patch based on v4.9.258-rc1 https://lore.kernel.org/lkml/20210222125352.110124-1-nixiaoming@huawei.com/
Can you please try 4.9.258 and let me know if this is still needed or not?
thanks,
greg k-h
On 2021/2/23 21:00, Greg KH wrote:
On Mon, Feb 22, 2021 at 10:11:37PM +0800, Xiaoming Ni wrote:
On 2021/2/22 20:09, Greg KH wrote:
On Mon, Feb 22, 2021 at 06:54:06PM +0800, Xiaoming Ni wrote:
On 2021/2/22 18:16, Greg KH wrote:
On Mon, Feb 22, 2021 at 03:03:28PM +0800, Xiaoming Ni wrote:
From: Thomas Gleixnertglx@linutronix.de
commit ac31c7ff8624409ba3c4901df9237a616c187a5d upstream.
This commit is already in the 4.9 tree. If the backport was incorrect, say that here, and describe what went wrong and why this commit fixes it.
Also state what commit this fixes as well, otherwise this changelog just looks like it is being applied again to the tree, which doesn't make much sense.
thanks,
greg k-h .
I wrote a cover for it. but forgot to adjust the title of the cover:
https://lore.kernel.org/lkml/20210222070328.102384-1-nixiaoming@huawei.com/
I found a dead code in the queue/4.9 branch of the stable-rc repository.
2021-02-03: commit c27f392040e2f6 ("futex: Provide distinct return value when owner is exiting") The function handle_exit_race does not exist. Therefore, the change in handle_exit_race() is ignored in the patch round.
2021-02-22: commit e55cb811e612 ("futex: Cure exit race") Define the handle_exit_race() function, but no branch in the function returns EBUSY. As a result, dead code occurs in the attach_to_pi_owner():
int ret = handle_exit_race(uaddr, uval, p); ... if (ret == -EBUSY) *exiting = p; /* dead code */
To fix the dead code, modify the commit e55cb811e612 ("futex: Cure exit race"), or install a patch to incorporate the changes in handle_exit_race().
I am unfamiliar with the processing of the stable-rc queue branch, and I cannot find the patch mail of the current branch in https://lore.kernel.org/lkml/?q=%22futex%3A+Cure+exit+race%22 Therefore, I re-integrated commit ac31c7ff8624 ("futex: Provide distinct return value when owner is exiting"). And wrote a cover (but forgot to adjust the title of the cover):
https://lore.kernel.org/lkml/20210222070328.102384-1-nixiaoming@huawei.com/
So this is a "fixup" patch, right?
Please clearly label it as such in your patch description and resend this as what is here I can not apply at all.
thanks,
greg k-h .
Thank you for your guidance. I have updated the patch description and resent the patch based on v4.9.258-rc1 https://lore.kernel.org/lkml/20210222125352.110124-1-nixiaoming@huawei.com/
Can you please try 4.9.258 and let me know if this is still needed or not?
thanks,
greg k-h .
The dead code problem still exists in V4.9.258. No conflict occurs during my patch integration. Do I need to correct the version number marked in the cc table in the patch and resend the patch?
Thanks Xiaoming Ni
On Wed, Feb 24, 2021 at 09:41:01AM +0800, Xiaoming Ni wrote:
On 2021/2/23 21:00, Greg KH wrote:
On Mon, Feb 22, 2021 at 10:11:37PM +0800, Xiaoming Ni wrote:
On 2021/2/22 20:09, Greg KH wrote:
On Mon, Feb 22, 2021 at 06:54:06PM +0800, Xiaoming Ni wrote:
On 2021/2/22 18:16, Greg KH wrote:
On Mon, Feb 22, 2021 at 03:03:28PM +0800, Xiaoming Ni wrote: > From: Thomas Gleixnertglx@linutronix.de > > commit ac31c7ff8624409ba3c4901df9237a616c187a5d upstream. This commit is already in the 4.9 tree. If the backport was incorrect, say that here, and describe what went wrong and why this commit fixes it.
Also state what commit this fixes as well, otherwise this changelog just looks like it is being applied again to the tree, which doesn't make much sense.
thanks,
greg k-h .
I wrote a cover for it. but forgot to adjust the title of the cover:
https://lore.kernel.org/lkml/20210222070328.102384-1-nixiaoming@huawei.com/
I found a dead code in the queue/4.9 branch of the stable-rc repository.
2021-02-03: commit c27f392040e2f6 ("futex: Provide distinct return value when owner is exiting") The function handle_exit_race does not exist. Therefore, the change in handle_exit_race() is ignored in the patch round.
2021-02-22: commit e55cb811e612 ("futex: Cure exit race") Define the handle_exit_race() function, but no branch in the function returns EBUSY. As a result, dead code occurs in the attach_to_pi_owner():
int ret = handle_exit_race(uaddr, uval, p); ... if (ret == -EBUSY) *exiting = p; /* dead code */
To fix the dead code, modify the commit e55cb811e612 ("futex: Cure exit race"), or install a patch to incorporate the changes in handle_exit_race().
I am unfamiliar with the processing of the stable-rc queue branch, and I cannot find the patch mail of the current branch in https://lore.kernel.org/lkml/?q=%22futex%3A+Cure+exit+race%22 Therefore, I re-integrated commit ac31c7ff8624 ("futex: Provide distinct return value when owner is exiting"). And wrote a cover (but forgot to adjust the title of the cover):
https://lore.kernel.org/lkml/20210222070328.102384-1-nixiaoming@huawei.com/
So this is a "fixup" patch, right?
Please clearly label it as such in your patch description and resend this as what is here I can not apply at all.
thanks,
greg k-h .
Thank you for your guidance. I have updated the patch description and resent the patch based on v4.9.258-rc1 https://lore.kernel.org/lkml/20210222125352.110124-1-nixiaoming@huawei.com/
Can you please try 4.9.258 and let me know if this is still needed or not?
thanks,
greg k-h .
The dead code problem still exists in V4.9.258. No conflict occurs during my patch integration. Do I need to correct the version number marked in the cc table in the patch and resend the patch?
Please do.
thanks,
greg k-h
On 2021/2/24 15:47, Greg KH wrote:
On Wed, Feb 24, 2021 at 09:41:01AM +0800, Xiaoming Ni wrote:
On 2021/2/23 21:00, Greg KH wrote:
On Mon, Feb 22, 2021 at 10:11:37PM +0800, Xiaoming Ni wrote:
On 2021/2/22 20:09, Greg KH wrote:
On Mon, Feb 22, 2021 at 06:54:06PM +0800, Xiaoming Ni wrote:
On 2021/2/22 18:16, Greg KH wrote: > On Mon, Feb 22, 2021 at 03:03:28PM +0800, Xiaoming Ni wrote: >> From: Thomas Gleixnertglx@linutronix.de >> >> commit ac31c7ff8624409ba3c4901df9237a616c187a5d upstream. > This commit is already in the 4.9 tree. If the backport was incorrect, > say that here, and describe what went wrong and why this commit fixes > it. > > Also state what commit this fixes as well, otherwise this changelog just > looks like it is being applied again to the tree, which doesn't make > much sense. > > thanks, > > greg k-h > .
I wrote a cover for it. but forgot to adjust the title of the cover:
https://lore.kernel.org/lkml/20210222070328.102384-1-nixiaoming@huawei.com/
I found a dead code in the queue/4.9 branch of the stable-rc repository.
2021-02-03: commit c27f392040e2f6 ("futex: Provide distinct return value when owner is exiting") The function handle_exit_race does not exist. Therefore, the change in handle_exit_race() is ignored in the patch round.
2021-02-22: commit e55cb811e612 ("futex: Cure exit race") Define the handle_exit_race() function, but no branch in the function returns EBUSY. As a result, dead code occurs in the attach_to_pi_owner():
int ret = handle_exit_race(uaddr, uval, p); ... if (ret == -EBUSY) *exiting = p; /* dead code */
To fix the dead code, modify the commit e55cb811e612 ("futex: Cure exit race"), or install a patch to incorporate the changes in handle_exit_race().
I am unfamiliar with the processing of the stable-rc queue branch, and I cannot find the patch mail of the current branch in https://lore.kernel.org/lkml/?q=%22futex%3A+Cure+exit+race%22 Therefore, I re-integrated commit ac31c7ff8624 ("futex: Provide distinct return value when owner is exiting"). And wrote a cover (but forgot to adjust the title of the cover):
https://lore.kernel.org/lkml/20210222070328.102384-1-nixiaoming@huawei.com/
So this is a "fixup" patch, right?
Please clearly label it as such in your patch description and resend this as what is here I can not apply at all.
thanks,
greg k-h .
Thank you for your guidance. I have updated the patch description and resent the patch based on v4.9.258-rc1 https://lore.kernel.org/lkml/20210222125352.110124-1-nixiaoming@huawei.com/
Can you please try 4.9.258 and let me know if this is still needed or not?
thanks,
greg k-h .
The dead code problem still exists in V4.9.258. No conflict occurs during my patch integration. Do I need to correct the version number marked in the cc table in the patch and resend the patch?
Please do.
thanks,
greg k-h .
I have resend the patch based on v4.9.258. link: https://lore.kernel.org/lkml/20210224100923.51315-1-nixiaoming@huawei.com/
Thanks
Xiaoming Ni
linux-stable-mirror@lists.linaro.org