public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Petr Vorel <pvorel@suse.cz>
To: Ben Copeland <ben.copeland@linaro.org>
Cc: arnd@arndb.de, lkft-triage@lists.linaro.org, ltp@lists.linux.it,
	dan.carpenter@linaro.org
Subject: Re: [LTP] [PATCH] oom03: use size_t for memory length to fix 32-bit overflow
Date: Fri, 17 Oct 2025 18:20:13 +0200	[thread overview]
Message-ID: <20251017162013.GA351168@pevik> (raw)
In-Reply-To: <20251016140303.1645478-1-ben.copeland@linaro.org>

Hi all,

> The alloc_mem() function is supposed to test out of memory conditions.
> How it works is it calls mmap() on a giant chunk of memory.
> It's either LENGTH (2GB) or "TESTMEM * 2 + TST_MB" (3GB) bytes.
> This mmap() is generally supposed to succeed.  Then at the bottom of
> the alloc_mem() function when we actually try to use all the memory,
> the thread is supposed to die with a SIGKILL.

> The problem is that length is signed so on a 32-bit system it will be
> negative. That means that at the bottom of the function when we loop
> through the memory, the for loop is a no-op and there is no SIGKILL.
> Fix this by changing the type to size_t which is unsigned.

I dared to change subject to oom.h and merged.
Thanks!

Kind regards,
Petr

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

      parent reply	other threads:[~2025-10-17 16:20 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-16 14:03 [LTP] [PATCH] oom03: use size_t for memory length to fix 32-bit overflow Ben Copeland
2025-10-17  9:38 ` Li Wang via ltp
2025-10-17 16:20 ` Petr Vorel [this message]

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=20251017162013.GA351168@pevik \
    --to=pvorel@suse.cz \
    --cc=arnd@arndb.de \
    --cc=ben.copeland@linaro.org \
    --cc=dan.carpenter@linaro.org \
    --cc=lkft-triage@lists.linaro.org \
    --cc=ltp@lists.linux.it \
    /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