Home | History | Annotate | Download | only in cts
      1 /**
      2  * Copyright (C) 2017 The Android Open Source 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 package android.security.cts;
     18 
     19 import android.platform.test.annotations.SecurityTest;
     20 
     21 public class Poc17_03 extends SecurityTestCase {
     22 
     23     /**
     24      *  b/31824853
     25      */
     26     @SecurityTest
     27     public void testPocCVE_2016_8479() throws Exception {
     28         if (containsDriver(getDevice(), "/dev/kgsl-3d0")) {
     29             AdbUtils.runPocNoOutput("CVE-2016-8479", getDevice(), 180);
     30             // CTS begins the next test before device finishes rebooting,
     31             // sleep to allow time for device to reboot.
     32             Thread.sleep(30000);
     33         }
     34     }
     35 
     36     /**
     37      *  b/33940449
     38      */
     39     @SecurityTest
     40     public void testPocCVE_2017_0508() throws Exception {
     41         if (containsDriver(getDevice(), "/dev/ion") &&
     42             containsDriver(getDevice(), "/dev/dri/renderD129")) {
     43             AdbUtils.runPocNoOutput("CVE-2017-0508", getDevice(), 30);
     44             // CTS begins the next test before device finishes rebooting,
     45             // sleep to allow time for device to reboot.
     46             Thread.sleep(60000);
     47         }
     48     }
     49 
     50     /**
     51      *  b/33899363
     52      */
     53     @SecurityTest
     54     public void testPocCVE_2017_0333() throws Exception {
     55         if (containsDriver(getDevice(), "/dev/dri/renderD128")) {
     56             AdbUtils.runPocNoOutput("CVE-2017-0333", getDevice(), 30);
     57             // Device takes up to 30 seconds to crash after ioctl call
     58             Thread.sleep(30000);
     59         }
     60     }
     61 
     62     /**
     63      *  b/33245849
     64      */
     65     @SecurityTest
     66     public void testPocCVE_2017_0334() throws Exception {
     67         if (containsDriver(getDevice(), "/dev/dri/renderD129")) {
     68            String out = AdbUtils.runPoc("CVE-2017-0334", getDevice());
     69            assertNotMatchesMultiLine(".*Leaked ptr is (0x[fF]{6}[cC]0[a-fA-F0-9]{8}"
     70                +"|0x[c-fC-F][a-fA-F0-9]{7}).*",out);
     71         }
     72     }
     73 
     74 }
     75