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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <f9155f8d-022c-4341-85da-5b08d6a3aee9@redhat.com>
Date: Tue, 10 Jun 2025 12:31:31 +0200
From: David Hildenbrand <david@...hat.com>
To: Arnd Bergmann <arnd@...nel.org>, Andrew Morton
 <akpm@...ux-foundation.org>, Jérôme Glisse
 <jglisse@...hat.com>
Cc: Arnd Bergmann <arnd@...db.de>, Alistair Popple <apopple@...dia.com>,
 Jason Gunthorpe <jgg@...pe.ca>, Thorsten Blum <thorsten.blum@...ux.dev>,
 Jeff Johnson <jeff.johnson@....qualcomm.com>, linux-mm@...ck.org,
 linux-kernel@...r.kernel.org
Subject: Re: [PATCH] lib/test_hmm: reduce stack usage

On 10.06.25 11:21, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@...db.de>
> 
> The various test ioctl handlers use arrays of 64 integers that add up to 1KiB
> of stack data, which in turn leads to exceeding the warning limit in some
> configurations:
> 
> lib/test_hmm.c:935:12: error: stack frame size (1408) exceeds limit (1280) in 'dmirror_migrate_to_device' [-Werror,-Wframe-larger-than]
> 
> Use half the size for these arrays, in order to stay under the warning limits.
> The code can already deal with arbitrary lengths, but this may be a little less
> efficient.
> 
> Signed-off-by: Arnd Bergmann <arnd@...db.de>
> ---
>   lib/test_hmm.c | 14 +++++++-------
>   1 file changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/lib/test_hmm.c b/lib/test_hmm.c
> index 5b144bc5c4ec..761725bc713c 100644
> --- a/lib/test_hmm.c
> +++ b/lib/test_hmm.c
> @@ -330,7 +330,7 @@ static int dmirror_fault(struct dmirror *dmirror, unsigned long start,
>   {
>   	struct mm_struct *mm = dmirror->notifier.mm;
>   	unsigned long addr;
> -	unsigned long pfns[64];
> +	unsigned long pfns[32];
>   	struct hmm_range range = {
>   		.notifier = &dmirror->notifier,
>   		.hmm_pfns = pfns,
> @@ -879,8 +879,8 @@ static int dmirror_migrate_to_system(struct dmirror *dmirror,
>   	unsigned long size = cmd->npages << PAGE_SHIFT;
>   	struct mm_struct *mm = dmirror->notifier.mm;
>   	struct vm_area_struct *vma;
> -	unsigned long src_pfns[64] = { 0 };
> -	unsigned long dst_pfns[64] = { 0 };
> +	unsigned long src_pfns[32] = { 0 };
> +	unsigned long dst_pfns[32] = { 0 };
>   	struct migrate_vma args = { 0 };
>   	unsigned long next;
>   	int ret;
> @@ -939,8 +939,8 @@ static int dmirror_migrate_to_device(struct dmirror *dmirror,
>   	unsigned long size = cmd->npages << PAGE_SHIFT;
>   	struct mm_struct *mm = dmirror->notifier.mm;
>   	struct vm_area_struct *vma;
> -	unsigned long src_pfns[64] = { 0 };
> -	unsigned long dst_pfns[64] = { 0 };
> +	unsigned long src_pfns[32] = { 0 };
> +	unsigned long dst_pfns[32] = { 0 };
>   	struct dmirror_bounce bounce;
>   	struct migrate_vma args = { 0 };
>   	unsigned long next;
> @@ -1144,8 +1144,8 @@ static int dmirror_snapshot(struct dmirror *dmirror,
>   	unsigned long size = cmd->npages << PAGE_SHIFT;
>   	unsigned long addr;
>   	unsigned long next;
> -	unsigned long pfns[64];
> -	unsigned char perm[64];
> +	unsigned long pfns[32];
> +	unsigned char perm[32];
>   	char __user *uptr;
>   	struct hmm_range range = {
>   		.hmm_pfns = pfns,

Should we just add a define for the common value (now 32)?

TEST_HMM_NR_PFN or sth like that.

-- 
Cheers,

David / dhildenb


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ