Merge "init: don't touch mmap_rnd_compat_bits on 64-bit only builds"
This commit is contained in:
commit
2d79c6c096
3 changed files with 9 additions and 2 deletions
|
|
@ -15,6 +15,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "security.h"
|
#include "security.h"
|
||||||
|
#include "util.h"
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
|
@ -106,12 +107,12 @@ Result<void> SetMmapRndBitsAction(const BuiltinArguments&) {
|
||||||
return {};
|
return {};
|
||||||
#elif defined(__aarch64__)
|
#elif defined(__aarch64__)
|
||||||
// arm64 supports 18 - 33 bits depending on pagesize and VA_SIZE
|
// arm64 supports 18 - 33 bits depending on pagesize and VA_SIZE
|
||||||
if (SetMmapRndBitsMin(33, 24, false) && SetMmapRndBitsMin(16, 16, true)) {
|
if (SetMmapRndBitsMin(33, 24, false) && (!Has32BitAbi() || SetMmapRndBitsMin(16, 16, true))) {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
#elif defined(__x86_64__)
|
#elif defined(__x86_64__)
|
||||||
// x86_64 supports 28 - 32 bits
|
// x86_64 supports 28 - 32 bits
|
||||||
if (SetMmapRndBitsMin(32, 32, false) && SetMmapRndBitsMin(16, 16, true)) {
|
if (SetMmapRndBitsMin(32, 32, false) && (!Has32BitAbi() || SetMmapRndBitsMin(16, 16, true))) {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
#elif defined(__arm__) || defined(__i386__)
|
#elif defined(__arm__) || defined(__i386__)
|
||||||
|
|
|
||||||
|
|
@ -733,5 +733,10 @@ bool IsMicrodroid() {
|
||||||
return is_microdroid;
|
return is_microdroid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Has32BitAbi() {
|
||||||
|
static bool has = !android::base::GetProperty("ro.product.cpu.abilist32", "").empty();
|
||||||
|
return has;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace init
|
} // namespace init
|
||||||
} // namespace android
|
} // namespace android
|
||||||
|
|
|
||||||
|
|
@ -106,5 +106,6 @@ bool IsDefaultMountNamespaceReady();
|
||||||
void SetDefaultMountNamespaceReady();
|
void SetDefaultMountNamespaceReady();
|
||||||
|
|
||||||
bool IsMicrodroid();
|
bool IsMicrodroid();
|
||||||
|
bool Has32BitAbi();
|
||||||
} // namespace init
|
} // namespace init
|
||||||
} // namespace android
|
} // namespace android
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue