linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: "Jason A. Donenfeld" <Jason@zx2c4.com>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	Theodore Ts'o <tytso@mit.edu>
Subject: Re: [PATCH] random: move randomize_page() into mm where it belongs
Date: Mon, 16 May 2022 14:28:00 -0700	[thread overview]
Message-ID: <20220516142800.4730a41ec1498d5e3d7863c0@linux-foundation.org> (raw)
In-Reply-To: <20220514120556.363559-1-Jason@zx2c4.com>

On Sat, 14 May 2022 14:05:56 +0200 "Jason A. Donenfeld" <Jason@zx2c4.com> wrote:

> randomize_page is an mm function. It is documented like one. It contains
> the history of one. It has the naming convention of one. It looks
> just like another very similar function in mm, randomize_stack_top().
> And it has always been maintained and updated by mm people. There is no
> need for it to be in random.c. In the "which shape does not look like
> the other ones" test, pointing to randomize_page() is correct.
> 
> So move randomize_page() into mm/util.c, right next to the similar
> randomize_stack_top() function.
> 
> This commit contains no actual code changes.

hm, does it make sense?

Probably randomize_page() (which used to be called randomize_range())
should have been called randomize_address().  Is it an MM function
then?  Not really - it's simply an application of the random number
generator.  So I think it's more a random thing than an MM thing.

> --- a/mm/util.c
> +++ b/mm/util.c
> @@ -343,6 +343,38 @@ unsigned long randomize_stack_top(unsigned long stack_top)
>  #endif
>  }
>  
> +/**
> + * randomize_page - Generate a random, page aligned address

The patch assumes that drivers/char/random.o is always built into
vmlinux, which appears to be the case.  If some space-conscious person
goes and makes random.o build-time optional then they'll need to make
the appropriate adjustments in util.c.  I see no problems with this.



  reply	other threads:[~2022-05-16 21:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-14 12:05 Jason A. Donenfeld
2022-05-16 21:28 ` Andrew Morton [this message]
2022-05-16 22:07   ` Jason A. Donenfeld

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=20220516142800.4730a41ec1498d5e3d7863c0@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=Jason@zx2c4.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=tytso@mit.edu \
    /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