summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPawan Wagh <waghpawan@google.com>2023-03-16 07:28:40 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2023-03-16 07:28:40 +0000
commitc1572fe8cff4fcb825724a2ebc264919163c9e5b (patch)
treef9f4b8bad91b9595687bb0d2ac69540d02e612bb
parent60c71b9950054b5fcaf792db415d2512fd059284 (diff)
parent25effc38ffb60a46024d65a3bb679bcd1dd4016c (diff)
downloadvold-c1572fe8cff4fcb825724a2ebc264919163c9e5b.tar.gz
Merge "Set sehandle in voldFuzzer"
-rw-r--r--tests/VoldFuzzer.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/VoldFuzzer.cpp b/tests/VoldFuzzer.cpp
index e91cce86..630a785e 100644
--- a/tests/VoldFuzzer.cpp
+++ b/tests/VoldFuzzer.cpp
@@ -14,15 +14,27 @@
* limitations under the License.
*/
+#include <android-base/logging.h>
#include <fuzzbinder/libbinder_driver.h>
#include "VoldNativeService.h"
+#include "sehandle.h"
using ::android::fuzzService;
using ::android::sp;
struct selabel_handle* sehandle;
+extern "C" int LLVMFuzzerInitialize(int argc, char argv) {
+ sehandle = selinux_android_file_context_handle();
+ if (!sehandle) {
+ LOG(ERROR) << "Failed to get SELinux file contexts handle in voldFuzzer!";
+ exit(1);
+ }
+ selinux_android_set_sehandle(sehandle);
+ return 0;
+}
+
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
auto voldService = sp<android::vold::VoldNativeService>::make();
fuzzService(voldService, FuzzedDataProvider(data, size));