From ae7f052328d6c2c06f6e9335a6cd4bb7efdced2b Mon Sep 17 00:00:00 2001 From: Joel Fernandes Date: Thu, 31 Jan 2019 19:27:23 -0500 Subject: [PATCH] init: set the sys.use_memfd property to false The sys.use_memfd property is set by default to false in Android to temporarily disable memfd, till vendor and apps are ready for it. The main issue: either apps or vendor processes can directly make ashmem IOCTLs on FDs they receive by assuming they are ashmem, without going through libcutils. Such fds could have very well be originally created with libcutils hence they could be memfd. Thus the IOCTLs will break. Set default value of sys.use_memfd property to true once the issue is resolved, so that the code can then self-detect if kernel support is present on the device. The property can also set to true from adb shell, for debugging. Bug: 113362644 Change-Id: I0f572ef36cac2a58fe308ddb90bbeffbecdaed3b Signed-off-by: Joel Fernandes --- rootdir/init.rc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/rootdir/init.rc b/rootdir/init.rc index 59ed47ae7..370bc1c89 100644 --- a/rootdir/init.rc +++ b/rootdir/init.rc @@ -593,6 +593,11 @@ on post-fs-data # Set indication (checked by vold) that we have finished this action #setprop vold.post_fs_data_done 1 + # sys.memfd_use set to false by default, which keeps it disabled + # until it is confirmed that apps and vendor processes don't make + # IOCTLs on ashmem fds any more. + setprop sys.use_memfd false + # It is recommended to put unnecessary data/ initialization from post-fs-data # to start-zygote in device's init.rc to unblock zygote start. on zygote-start && property:ro.crypto.state=unencrypted