mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Willy Tarreau <w@1wt.eu>
To: "Thomas Weißschuh" <linux@weissschuh.net>
Cc: Danish Khateeb <danishkhateeb03@gmail.com>,
	Shuah Khan <shuah@kernel.org>,
	linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 1/2] tools/nolibc: stop rounding malloc() sizes up to 4096 bytes
Date: Sat, 26 Sep 2026 19:14:20 +0200	[thread overview]
Message-ID: <arf9bClKfvuztamr@1wt.eu> (raw)
In-Reply-To: <d64fa7c0-e853-42ba-be3d-11a236c5182b@t-8ch.de>

On Sat, Sep 26, 2026 at 05:50:28PM +0200, Thomas Weißschuh wrote:
> On 2026-09-26 10:24:13-0500, Danish Khateeb wrote:
> > malloc() rounds the size of each mapping up to a multiple of 4096,
> > presumably to align it to a page boundary. But the page size is not 4096
> > on all architectures, and mmap() and munmap() round the length up to the
> > page size themselves.
> > 
> > Drop the rounding. As heap->len is no longer rounded up, growing a block
> > with realloc() now always creates a new mapping.
> 
> The series looks good to me, but I want to hear from Willy before
> applying it.

Fine by me as well. I remembered there was something for mmap() that had
to be rounded to PAGE_SIZE but it's not len, it's the offset, so we're
fine here.

Also I've checked when __builtin_add_overflow() was added, and it's gcc 5
so we're fine here as well.

> > Assisted-by: LLM
> > Signed-off-by: Danish Khateeb <danishkhateeb03@gmail.com>
> 
> I'll add a Suggested-by here when applying.

For the series:
  Reviewed-by: Willy Tarreau <w@1wt.eu>

Thanks!
Willy

  reply	other threads:[~2026-09-26 17:23 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-26 15:24 [PATCH v2 0/2] tools/nolibc: check for overflow in malloc() Danish Khateeb
2026-09-26 15:24 ` [PATCH v2 1/2] tools/nolibc: stop rounding malloc() sizes up to 4096 bytes Danish Khateeb
2026-09-26 15:50   ` Thomas Weißschuh
2026-09-26 17:14     ` Willy Tarreau [this message]
2026-09-26 15:24 ` [PATCH v2 2/2] tools/nolibc: check for overflow in malloc() Danish Khateeb

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=arf9bClKfvuztamr@1wt.eu \
    --to=w@1wt.eu \
    --cc=danishkhateeb03@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux@weissschuh.net \
    --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

all inboxes | Powered by JetHome®