Merge "Revert "[RESTRICT AUTOMERGE]: CTS test for Android Security b/71909578 b/28760453"" into nyc-dev
diff --git a/hostsidetests/security/AndroidTest.xml b/hostsidetests/security/AndroidTest.xml
index b28339b..28699b9 100755
--- a/hostsidetests/security/AndroidTest.xml
+++ b/hostsidetests/security/AndroidTest.xml
@@ -54,7 +54,6 @@
         <!--__________________-->
         <!-- Bulletin 2016-09 -->
         <!-- Please add tests solely from this bulletin below to avoid merge conflict -->
-        <option name="push" value="CVE-2015-8839->/data/local/tmp/CVE-2015-8839" />
         <option name="push" value="CVE-2016-2471->/data/local/tmp/CVE-2016-2471" />
 
         <!--__________________-->
diff --git a/hostsidetests/security/securityPatch/CVE-2015-8839/Android.mk b/hostsidetests/security/securityPatch/CVE-2015-8839/Android.mk
deleted file mode 100755
index f1e31c7..0000000
--- a/hostsidetests/security/securityPatch/CVE-2015-8839/Android.mk
+++ /dev/null
@@ -1,36 +0,0 @@
-# Copyright (C) 2018 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-LOCAL_MODULE := CVE-2015-8839
-LOCAL_SRC_FILES := poc.c
-
-LOCAL_SHARED_LIBRARIES := libcutils \
-                          liblog
-
-LOCAL_MULTILIB := both
-LOCAL_MODULE_STEM_32 := $(LOCAL_MODULE)32
-LOCAL_MODULE_STEM_64 := $(LOCAL_MODULE)64
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts sts
-LOCAL_CTS_TEST_PACKAGE := android.security.cts
-
-LOCAL_ARM_MODE := arm
-LOCAL_CFLAGS += -Wall -Werror
-LOCAL_LDFLAGS += -fPIE -pie
-LOCAL_LDFLAGS += -rdynamic
-include $(BUILD_CTS_EXECUTABLE)
diff --git a/hostsidetests/security/securityPatch/CVE-2015-8839/poc.c b/hostsidetests/security/securityPatch/CVE-2015-8839/poc.c
deleted file mode 100755
index fb05773..0000000
--- a/hostsidetests/security/securityPatch/CVE-2015-8839/poc.c
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright (C) 2018 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#define _GNU_SOURCE
-#include <cutils/log.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <linux/falloc.h>
-#include <linux/magic.h>
-#include <stdint.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/utsname.h>
-#include <sys/vfs.h>
-#include <unistd.h>
-
-static int parse_kernel_release(long *const major, long *const minor) {
-  struct utsname buffer;
-  if (uname(&buffer) == -1) {
-    return -1;
-  }
-  return sscanf(buffer.release, "%ld.%ld", major, minor) == 2;
-}
-
-int main(void) {
-  long major = 0, minor = 0;
-  int fd = -1, result = -1;
-  char tmpFile[32];
-  struct statfs sfs;
-
-  memset(tmpFile, 0, sizeof(tmpFile));
-  strncpy(tmpFile, "/data/local/tmp/tmpFile", 24);
-
-  // check the kernel version
-  parse_kernel_release(&major, &minor);
-
-  // Kernels less than 4.1 are affected
-  if (major < 4 || (major == 4 && minor < 1)) {
-    fd = open(tmpFile, O_WRONLY | O_APPEND | O_CREAT, 0644);
-    if (fd < 0) {
-      ALOGE("Creation of tmp file is failed [%s]", strerror(errno));
-      return -1;
-    }
-
-    fstatfs(fd, &sfs);
-    if (sfs.f_type == EXT4_SUPER_MAGIC) {
-      result = fallocate(fd, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, 0, 1);
-      if (result < 0 && errno == EOPNOTSUPP) {
-        ALOGD("fallocate result [%s] errno [%d]", strerror(errno), errno);
-        ALOGE("fallocate result EOPNOTSUPP");
-      }
-    }
-    if (fd)
-      close(fd);
-  }
-  return 0;
-}
diff --git a/hostsidetests/security/src/android/security/cts/Poc16_09.java b/hostsidetests/security/src/android/security/cts/Poc16_09.java
index 676862f..7ab08ad 100644
--- a/hostsidetests/security/src/android/security/cts/Poc16_09.java
+++ b/hostsidetests/security/src/android/security/cts/Poc16_09.java
@@ -26,16 +26,4 @@
     public void testPocCVE_2016_2471() throws Exception {
         AdbUtils.runPoc("CVE-2016-2471", getDevice(), 60);
     }
-
-    /**
-     *  b/28760453
-     */
-    @SecurityTest
-    public void testPocCVE_2015_8839() throws Exception {
-        AdbUtils.runCommandLine("logcat -c" , getDevice());
-        AdbUtils.runPoc("CVE-2015-8839", getDevice(), 60);
-
-        String logcat =  AdbUtils.runCommandLine("logcat -d", getDevice());
-        assertMatches("[\\s\\n\\S]*fallocate result EOPNOTSUPP[\\s\\n\\S]*", logcat);
-    }
 }