Skip to content

Commit 7a9c884

Browse files
luca020400Gerrit Code Review
authored andcommitted
zygote: Allow device to append extra whitelisted paths
Change-Id: Ic5b056d7ead520da8648db9be28e16a81ec27c73
1 parent fe0a5ee commit 7a9c884

File tree

2 files changed

+35
-1
lines changed

2 files changed

+35
-1
lines changed

core/jni/fd_utils-inl-extra.h

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*
2+
* Copyright (C) 2016 The CyanogenMod Project
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
/*
18+
#define PATH_WHITELIST_EXTRA_H \
19+
"/proc/apid", \
20+
"/proc/aprf",
21+
*/
22+
23+
// Overload this file in your device specific config if you need
24+
// to add extra whitelisted paths.
25+
// WARNING: Only use this if necessary. Custom inits should be
26+
// checked for leaked file descriptors before even considering
27+
// this.
28+
// In order to add your files, copy the whole file (don't forget the copyright notice!),
29+
// uncomment the #define above and change the paths inside to match your requirements

core/jni/fd_utils-inl.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@
3535
#include "JNIHelp.h"
3636
#include "ScopedPrimitiveArray.h"
3737

38+
#include <fd_utils-inl-extra.h>
39+
3840
// Whitelist of open paths that the zygote is allowed to keep open.
3941
//
4042
// In addition to the paths listed here, all files ending with
@@ -58,7 +60,10 @@ static const char* kPathWhitelist[] = {
5860
"/dev/ion",
5961
"@netlink@",
6062
"/system/framework/org.cyanogenmod.platform-res.apk",
61-
"/proc/ged"
63+
"/proc/ged",
64+
#ifdef PATH_WHITELIST_EXTRA_H
65+
PATH_WHITELIST_EXTRA_H
66+
#endif
6267
};
6368

6469
static const char* kFdPath = "/proc/self/fd";

0 commit comments

Comments
 (0)