Linux Test Project
 help / color / mirror / Atom feed
From: "Ricardo B. Marlière via ltp" <ltp@lists.linux.it>
To: "Petr Vorel" <pvorel@suse.cz>, <ltp@lists.linux.it>
Cc: "Andrea Cervesato" <andrea.cervesato@mailbox.org>,
	"Ricardo B . Marlière" <rbm@suse.com>
Subject: Re: [LTP] [PATCH 1/1] munmap04: Fix 'base' overflow
Date: Thu, 31 Jul 2025 11:44:56 -0300	[thread overview]
Message-ID: <DBQBKKVD3C5A.2N3VLH1BY0W8P@suse.com> (raw)
In-Reply-To: <20250731143550.777289-1-pvorel@suse.cz>

On Thu Jul 31, 2025 at 11:35 AM -03, Petr Vorel wrote:
> Lower down a base to fix overflow on 32 bit:
>
> munmap04.c:18:25: warning: conversion from ‘long long unsigned int’ to
> ‘uintptr_t’ {aka ‘unsigned int’} changes value from ‘4294967296’ to ‘0’ [-Woverflow]
>    18 | static uintptr_t base = 0x100000000UL;
>       |                         ^~~~~~~~~~~~~
>
> Fixes: 1e2c98e3af ("Add munmap04 to check ENOMEM")
> Signed-off-by: Petr Vorel <pvorel@suse.cz>
> ---
> Hi,
>
> I'm not sure how this influences recent fixes. And how the base address
> was actually chosen (just random memory location?).

Random, yes!

>
> Kind regards,
> Petr
>
>  testcases/kernel/syscalls/munmap/munmap04.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/testcases/kernel/syscalls/munmap/munmap04.c b/testcases/kernel/syscalls/munmap/munmap04.c
> index 987a7c7e7a..e1b67aeee3 100644
> --- a/testcases/kernel/syscalls/munmap/munmap04.c
> +++ b/testcases/kernel/syscalls/munmap/munmap04.c
> @@ -15,7 +15,7 @@
>  #define MEMSIZE 3
>  #define MAP_MAX_COUNT 65530
>  
> -static uintptr_t base = 0x100000000UL;
> +static uintptr_t base = 0x10000000UL;

Thank you,

Reviewed-by: Ricardo B. Marlière <rbm@suse.com>

>  static size_t page_sz;
>  static unsigned long vma_size;
>  static int map_count;


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

  reply	other threads:[~2025-07-31 14:45 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-31 14:35 [LTP] [PATCH 1/1] munmap04: Fix 'base' overflow Petr Vorel
2025-07-31 14:44 ` Ricardo B. Marlière via ltp [this message]
2025-07-31 17:16 ` Andrea Cervesato via ltp
2025-08-01 13:01 ` Petr Vorel

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=DBQBKKVD3C5A.2N3VLH1BY0W8P@suse.com \
    --to=ltp@lists.linux.it \
    --cc=andrea.cervesato@mailbox.org \
    --cc=pvorel@suse.cz \
    --cc=rbm@suse.com \
    /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