Re: [PATCH] 2.6.16.16 Parameter-controlled mmap/stack randomization

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Oh, some of my stuff is 4096 hard-coded instead of PAGE_SIZE.  I fixed
this in mmap() randomization here, but there's iffiness coming up for
the stack.

The stack is page aligned and randomized in the VMA; then randomized to
16 byte intervals.  This is fine, PAGE_SIZE is 4096, our intervals are
16, 256 positions, we randomize 2^(stack_random_bits - 8) VMA and 2^8
inside; unless we have less than 8 bits, then we randomize
2^stack_random_bits and align to PAGE_SIZE / (2^stack_random_bits).

Easy enough.  Now what if PAGE_SIZE isn't 4096?

That's an easy problem too.  This can easily be calculated straight
forward with the number ... 8.  In fact that's how I did it.  2^8 is
4096 / 16.  Thus, the solution is log_base_2(PAGE_SIZE/16) instead of 8!

Now.  How do I find the base 2 log of a number in the kernel?

John Richard Moser wrote:
> Any comments on this one?
> 
> I'm trying to control the stack and heap randomization via command-line
> parameters.  I wrote this in a 2.6.15 Ubuntu Dapper kernel and then
> patched it into a 2.6.16.16 tree and cleaned it up.  It does a few
> simple things:
> 

[SNIP]

- --
All content of all messages exchanged herein are left in the
Public Domain, unless otherwise explicitly stated.

    Creative brains are a valuable, limited resource. They shouldn't be
    wasted on re-inventing the wheel when there are so many fascinating
    new problems waiting out there.
                                                 -- Eric Steven Raymond

    We will enslave their women, eat their children and rape their
    cattle!
                  -- Bosc, Evil alien overlord from the fifth dimension
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iQIVAwUBRG6OsAs1xW0HCTEFAQLV4A/7BduRbAsWgvCy8ZMMRVYze33nkjGaK+o7
jd7EN7r+pcwr5EDKG4NdryTj+MdoSQJuAjy8eclaRFxJtu9jugE6e/q/wNlxRe9y
7q2mx4imNcrhVJ0TXKi6HL139lqON2kp4T4MlARLmwqy0zmtSjRGYUOAkxsYoXbp
5XvYe550O12caqGJvpWjPsv7hDMBSVmuo0i98SHCY9piafZtLl0rqgiVfRKicukq
ErmQd8UEhwjCwwqA34+6g9cR8107T6qvWucBqK4z9MDl65VrlnBQvzgdWb+Y6hDw
wUdX54E+si/1dsvUu9+cA9zZuHUeNOEaTPZB0Kirtdmkv5XRiorZ8PMjCLgFrhEW
05Vn2CmrJL7a+1bkOYBYal1eZbg2xgEKIeqE4SeMkkRdnmmr7BJwGh5h9LcMAVra
QCiMf7T4yV6qPLlYiuad/SUshel0YauTC63EcG4qO37Gx93amKgGyzCef2bVWc4T
iPOSG3YVIorrZIy1ZWOSQSfcmSappLx52vagbHYQOHKHtlBazz0elI730LDRQxCr
H4CfByfmf4GsoCWg7+aZ5awruh0Q8qXjLXRRunhhCBiz5Y3h+6uzh786Vuv13+Be
TuvVJ/ZYQrVKbpGvRXHYN6GC4Wx2Tl5HiMDLCvU0lVYMv+uH3c0b2eOfi7VpE5SZ
rimyC8GoqyA=
=jOSA
-----END PGP SIGNATURE-----
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux