From 30046acdb2cc11f63461a7d19ac16c0df9fe53e2 Mon Sep 17 00:00:00 2001 From: Nick Kralevich Date: Mon, 9 Oct 2017 13:19:36 -0700 Subject: [PATCH] set O_CLOEXEC on /dev/ashmem Ensure FDs don't leak across exec() boundaries. Test: builds and boots. No obvious issues. Change-Id: I00347b489ddb146b9d33442626f0e89a6cf26551 --- libcutils/ashmem-dev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libcutils/ashmem-dev.c b/libcutils/ashmem-dev.c index b4abb79d8..95f2259ec 100644 --- a/libcutils/ashmem-dev.c +++ b/libcutils/ashmem-dev.c @@ -51,7 +51,7 @@ static int __ashmem_open_locked() int ret; struct stat st; - int fd = TEMP_FAILURE_RETRY(open(ASHMEM_DEVICE, O_RDWR)); + int fd = TEMP_FAILURE_RETRY(open(ASHMEM_DEVICE, O_RDWR | O_CLOEXEC)); if (fd < 0) { return fd; }