lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a81cd48e-6e02-4366-b88e-4ba31d4a3c5d@redhat.com>
Date: Mon, 2 Jun 2025 21:58:29 +0200
From: David Hildenbrand <david@...hat.com>
To: SeongJae Park <sj@...nel.org>, Andrew Morton <akpm@...ux-foundation.org>
Cc: "Liam R. Howlett" <Liam.Howlett@...cle.com>, Jann Horn
 <jannh@...gle.com>, Lorenzo Stoakes <lorenzo.stoakes@...cle.com>,
 Shakeel Butt <shakeel.butt@...ux.dev>, Vlastimil Babka <vbabka@...e.cz>,
 linux-kernel@...r.kernel.org, linux-mm@...ck.org, stable@...nel.org,
 Barry Song <21cnbao@...il.com>
Subject: Re: [PATCH] mm/madvise: handle madvise_lock() failure during race
 unwinding

On 02.06.25 19:49, SeongJae Park wrote:
> When unwinding race on -ERESTARTNOINTR handling of process_madvise(),
> madvise_lock() failure is ignored.  Check the failure and abort
> remaining works in the case.
> 
> Fixes: 4000e3d0a367 ("mm/madvise: remove redundant mmap_lock operations from process_madvise()")
> Cc: stable@...nel.org
> Reported-by: Barry Song <21cnbao@...il.com>
> Closes: https://lore.kernel.org/CAGsJ_4xJXXO0G+4BizhohSZ4yDteziPw43_uF8nPXPWxUVChzw@mail.gmail.com
> Signed-off-by: SeongJae Park <sj@...nel.org>
> ---
>   mm/madvise.c | 5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/mm/madvise.c b/mm/madvise.c
> index 8433ac9b27e0..5f7a66a1617e 100644
> --- a/mm/madvise.c
> +++ b/mm/madvise.c
> @@ -1881,7 +1881,9 @@ static ssize_t vector_madvise(struct mm_struct *mm, struct iov_iter *iter,
>   			/* Drop and reacquire lock to unwind race. */
>   			madvise_finish_tlb(&madv_behavior);
>   			madvise_unlock(mm, behavior);
> -			madvise_lock(mm, behavior);
> +			ret = madvise_lock(mm, behavior);
> +			if (ret)
> +				goto out;
>   			madvise_init_tlb(&madv_behavior, mm);
>   			continue;
>   		}
> @@ -1892,6 +1894,7 @@ static ssize_t vector_madvise(struct mm_struct *mm, struct iov_iter *iter,
>   	madvise_finish_tlb(&madv_behavior);
>   	madvise_unlock(mm, behavior);
>   
> +out:
>   	ret = (total_len - iov_iter_count(iter)) ? : ret;

Acked-by: David Hildenbrand <david@...hat.com>

-- 
Cheers,

David / dhildenb


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ