From: Linus Torvalds <email@example.com>
To: "Jason A. Donenfeld" <Jason@zx2c4.com>
Cc: firstname.lastname@example.org, email@example.com
Subject: Re: Random arrays on kernel stack..
Date: Fri, 29 Jul 2022 10:56:32 -0700 [thread overview]
Message-ID: <CAHk-=wheoU5mkht1xk_4Tyw78oa-8iGvGE9nBdUmGqCykgo1xw@mail.gmail.com> (raw)
On Fri, Jul 29, 2022 at 10:12 AM Jason A. Donenfeld <Jason@zx2c4.com> wrote:
> That's a good point. Though note that the current WARN_ON is also
> dependent on DEBUG being set.
Sure. And I think that's ok.
> > (a) that constant should be a bit lower, so that we *can* use a 1kB
> > stack frame warning on 64-bit architectures
> That's not so much possible. This needs to do a DFS traversal of the
> trie, which means it can be 128 nodes deep since IPv6 addresses have
> 128 bits.
Ahh. Ok. That at least explains where the constant comes from. That
would be a good thing to have somewhere in that definition of the
And I agree that malloc() isn't a great choice.
I don't really worry about the stack frame warning (I just raised it
to the same 2k limit I have on my x86-64 box), so doing that 1k
allocation is fine.
And with that constant 128 explained, I don't think it's wrong to not
even test for overflow. We don't test for things that can't happen.
But *if* you test for it for debug purposes, then at that point I
think you need to just do the "warn and don't corrupt stack".
prev parent reply other threads:[~2022-07-29 17:57 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-28 23:51 Linus Torvalds
2022-07-29 17:12 ` Jason A. Donenfeld
2022-07-29 17:56 ` Linus Torvalds [this message]
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:
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
* 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;
as well as URLs for NNTP newsgroup(s).