Re: CVS commit: src/sys/arch/x86

2018-12-07 Thread Maxime Villard

Le 07/12/2018 à 17:29, Jaromír Doleček a écrit :

Maybe I missed something earlier - does KASLR being enabled by default
mean that x86 now doesn't any more use the direct map to copy memory
pages?


No. The direct map is still there and still used, the only thing is that
its location is randomized.

You are probably confusing with KASAN, which indeed doesn't have a
direct map, for specific reasons.

In all cases, GENERIC stays with a direct map.


Re: CVS commit: src/sys/arch/x86

2018-12-07 Thread Jaromír Doleček
Maybe I missed something earlier - does KASLR being enabled by default
mean that x86 now doesn't any more use the direct map to copy memory
pages?

Jaromir
Le ven. 7 déc. 2018 à 16:47, Maxime Villard  a écrit :
>
> Module Name:src
> Committed By:   maxv
> Date:   Fri Dec  7 15:47:11 UTC 2018
>
> Modified Files:
> src/sys/arch/x86/conf: files.x86
> src/sys/arch/x86/x86: pmap.c
>
> Log Message:
> Add an option to have a static kernel memory layout. This option is
> disabled by default - that is to say, KASLR remains enabled by default.
>
>
> To generate a diff of this commit:
> cvs rdiff -u -r1.103 -r1.104 src/sys/arch/x86/conf/files.x86
> cvs rdiff -u -r1.312 -r1.313 src/sys/arch/x86/x86/pmap.c
>
> Please note that diffs are not public domain; they are subject to the
> copyright notices on the relevant files.
>


Re: CVS commit: src/sys/kern

2018-12-07 Thread Maxime Villard

Le 07/12/2018 à 12:33, Manuel Bouyer a écrit :

On Thu, Dec 06, 2018 at 06:43:52PM +0100, Maxime Villard wrote:

Le 06/12/2018 à 11:06, Manuel Bouyer a écrit :

as I understand KASLR (but I didn't look at the code), addresses are choosen
at random. So I guess there's a random number generator in the process.
Maybe it would be as simple as making the random number generator return
a constant value ?


Yes, change the two calls to cpu_earlyrng() in x86/pmap.c::slotspace_rand()
to return zero, and you're back with a static layout.


This looks like an easy option to add


Yes, it's easier than in my initial implementation, and I've committed
the option.


Re: CVS commit: src/sys/kern

2018-12-07 Thread Manuel Bouyer
On Thu, Dec 06, 2018 at 06:43:52PM +0100, Maxime Villard wrote:
> Le 06/12/2018 à 11:06, Manuel Bouyer a écrit :
> > as I understand KASLR (but I didn't look at the code), addresses are choosen
> > at random. So I guess there's a random number generator in the process.
> > Maybe it would be as simple as making the random number generator return
> > a constant value ?
> 
> Yes, change the two calls to cpu_earlyrng() in x86/pmap.c::slotspace_rand()
> to return zero, and you're back with a static layout.

This looks like an easy option to add

-- 
Manuel Bouyer 
 NetBSD: 26 ans d'experience feront toujours la difference
--