linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "David Hildenbrand (Red Hat)" <david@kernel.org>
To: Li Wang <liwang@redhat.com>,
	akpm@linux-foundation.org, linux-kselftest@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org
Cc: Mark Brown <broonie@kernel.org>, Shuah Khan <shuah@kernel.org>,
	Waiman Long <longman@redhat.com>
Subject: Re: [PATCH v2 1/3] selftests/mm/write_to_hugetlbfs: parse -s as size_t
Date: Sun, 21 Dec 2025 10:01:03 +0100	[thread overview]
Message-ID: <60b8a0da-7f82-41dc-9746-657d89e88b69@kernel.org> (raw)
In-Reply-To: <20251221085810.3163919-2-liwang@redhat.com>

On 12/21/25 09:58, Li Wang wrote:
> write_to_hugetlbfs currently parses the -s size argument with atoi()
> into an int. This silently accepts malformed input, cannot report overflow,
> and can truncate large sizes.
> 
> --- Error log ---
>   # uname -r
>   6.12.0-xxx.el10.aarch64+64k
> 
>   # ls /sys/kernel/mm/hugepages/hugepages-*
>   hugepages-16777216kB/  hugepages-2048kB/  hugepages-524288kB/
> 
>   #./charge_reserved_hugetlb.sh -cgroup-v2
>   # -----------------------------------------
>   ...
>   # nr hugepages = 10
>   # writing cgroup limit: 5368709120
>   # writing reseravation limit: 5368709120
>   ...
>   # Writing to this path: /mnt/huge/test
>   # Writing this size: -1610612736        <--------


I mean, whoever does that should not expect anything reasonable to 
happen with these selftests ... so I don't think Fixes: should be added.

Acked-by: David Hildenbrand (Red Hat) <david@kernel.org>

-- 
Cheers

David


  reply	other threads:[~2025-12-21  9:01 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-21  8:58 [PATCH v2 0/3] selftests/mm: hugetlb cgroup charging: robustness fixes Li Wang
2025-12-21  8:58 ` [PATCH v2 1/3] selftests/mm/write_to_hugetlbfs: parse -s as size_t Li Wang
2025-12-21  9:01   ` David Hildenbrand (Red Hat) [this message]
2025-12-21  8:58 ` [PATCH v2 2/3] selftests/mm/charge_reserved_hugetlb.sh: add waits with timeout helper Li Wang
2025-12-21  9:15   ` David Hildenbrand (Red Hat)
2025-12-21  9:35     ` Li Wang
2025-12-21  9:52       ` David Hildenbrand (Red Hat)
2025-12-21 10:08         ` Li Wang
2025-12-21  8:58 ` [PATCH v2 3/3] selftests/mm/charge_reserved_hugetlb: fix hugetlbfs mount size for large hugepages Li Wang
2025-12-21  9:17   ` David Hildenbrand (Red Hat)
2025-12-21  9:44     ` Li Wang
2025-12-21  9:49       ` David Hildenbrand (Red Hat)
2025-12-21 11:56         ` Li Wang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=60b8a0da-7f82-41dc-9746-657d89e88b69@kernel.org \
    --to=david@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=broonie@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=liwang@redhat.com \
    --cc=longman@redhat.com \
    --cc=shuah@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox