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: <efeee548-fb6f-4670-880b-f0837614b5cb@redhat.com>
Date: Mon, 26 Aug 2024 08:48:59 +0200
From: David Hildenbrand <david@...hat.com>
To: Hugh Dickins <hughd@...gle.com>, Andrew Morton <akpm@...ux-foundation.org>
Cc: "Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>,
 Baolin Wang <baolin.wang@...ux.alibaba.com>, linux-kernel@...r.kernel.org,
 linux-mm@...ck.org
Subject: Re: [PATCH] mm: shmem: fix minor off-by-one in shrinkable calculation

On 26.08.24 00:42, Hugh Dickins wrote:
> There has been a long-standing and very minor off-by-one, where
> shmem_get_folio_gfp() decides if a large folio extends beyond i_size
> far enough to leave a page or more for freeing later under pressure.
> 
> This is not something needed for stable: but it will be proportionately
> more significant as support for smaller large folios is added, and is
> best fixed before duplicating the check in other places.
> 
> Fixes: 779750d20b93 ("shmem: split huge pages beyond i_size under memory pressure")
> Signed-off-by: Hugh Dickins <hughd@...gle.com>
> ---
>   mm/shmem.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/mm/shmem.c b/mm/shmem.c
> index 85e3bd3e709e..37c300f69baf 100644
> --- a/mm/shmem.c
> +++ b/mm/shmem.c
> @@ -2326,7 +2326,7 @@ static int shmem_get_folio_gfp(struct inode *inode, pgoff_t index,
>   	alloced = true;
>   	if (folio_test_large(folio) &&
>   	    DIV_ROUND_UP(i_size_read(inode), PAGE_SIZE) <
> -					folio_next_index(folio) - 1) {
> +					folio_next_index(folio)) {
>   		struct shmem_sb_info *sbinfo = SHMEM_SB(inode->i_sb);
>   		struct shmem_inode_info *info = SHMEM_I(inode);
>   		/*

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

-- 
Cheers,

David / dhildenb


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ