tinycc-devel
[Top][All Lists]
Advanced

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

Re: [Tinycc-devel] enforced immutability - proposed research project


From: Bruno Haible
Subject: Re: [Tinycc-devel] enforced immutability - proposed research project
Date: Tue, 19 Jan 2021 01:19:41 +0100
User-agent: KMail/5.1.3 (Linux/4.4.0-197-generic; KDE/5.18.0; x86_64; ; )

Elijah Stone wrote:
> You have to set up a shadow memory space; it's a distinct address space, 
> but mapped to the same physical pages.  But it has readonly permissions 
> where the primary memory space has rw.  To turn a regular reference into a 
> const one, you add to it the offset between the regular memory space and 
> the shadow space.

Yes, that's the trick to get it done with good performance.

> The only problem is actually convincing the OS to map those addresses. On 
> linux at least, MAP_FIXED seems to be mutually exclusive with MAP_SHARED. 

MAP_FIXED is a portability nightmare nowadays, where most OSes implement
address space randomization and put the shared libraries at arbitrary and
random locations in the address space. You better stay away from it.

The implementation I pointed to therefore doesn't use MAP_FIXED, just plain
MAP_SHARED.

Bruno




reply via email to

[Prev in Thread] Current Thread [Next in Thread]