1 /**
2  * Copyright (C) 2020 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.AsbSecurityTest;
20 import org.junit.Test;
21 import org.junit.runner.RunWith;
22 import com.android.tradefed.testtype.DeviceJUnit4ClassRunner;
23 
24 import static org.junit.Assert.*;
25 
26 @RunWith(DeviceJUnit4ClassRunner.class)
27 public class Poc16_11 extends SecurityTestCase {
28 
29     /**
30      *  b/29149404
31      */
32     @Test
33     @AsbSecurityTest(cveBugId = 72498387)
testPocCVE_2012_6702()34     public void testPocCVE_2012_6702() throws Exception {
35         AdbUtils.runCommandLine("logcat -c", getDevice());
36         AdbUtils.runPoc("CVE-2012-6702", getDevice(), 60);
37         String logcat = AdbUtils.runCommandLine("logcat -d", getDevice());
38         assertNotMatchesMultiLine("fail: encountered same random values!", logcat);
39     }
40 
41     /**
42      *  b/30904789
43      */
44     @Test
45     @AsbSecurityTest(cveBugId = 30904789)
testPocCVE_2016_6730()46     public void testPocCVE_2016_6730() throws Exception {
47         if(containsDriver(getDevice(), "/dev/dri/renderD129")) {
48             AdbUtils.runPoc("CVE-2016-6730", getDevice(), 60);
49         }
50     }
51 
52     /**
53      *  b/30906023
54      */
55     @Test
56     @AsbSecurityTest(cveBugId = 30906023)
testPocCVE_2016_6731()57     public void testPocCVE_2016_6731() throws Exception {
58         if(containsDriver(getDevice(), "/dev/dri/renderD129")) {
59             AdbUtils.runPoc("CVE-2016-6731", getDevice(), 60);
60         }
61     }
62 
63     /**
64      *  b/30906599
65      */
66     @Test
67     @AsbSecurityTest(cveBugId = 30906599)
testPocCVE_2016_6732()68     public void testPocCVE_2016_6732() throws Exception {
69         if(containsDriver(getDevice(), "/dev/dri/renderD129")) {
70             AdbUtils.runPoc("CVE-2016-6732", getDevice(), 60);
71         }
72     }
73 
74     /**
75      *  b/30906694
76      */
77     @Test
78     @AsbSecurityTest(cveBugId = 30906694)
testPocCVE_2016_6733()79     public void testPocCVE_2016_6733() throws Exception {
80         if(containsDriver(getDevice(), "/dev/dri/renderD129")) {
81             AdbUtils.runPoc("CVE-2016-6733", getDevice(), 60);
82         }
83     }
84 
85     /**
86      *  b/30907120
87      */
88     @Test
89     @AsbSecurityTest(cveBugId = 30907120)
testPocCVE_2016_6734()90     public void testPocCVE_2016_6734() throws Exception {
91         if(containsDriver(getDevice(), "/dev/dri/renderD129")) {
92             AdbUtils.runPoc("CVE-2016-6734", getDevice(), 60);
93         }
94     }
95 
96     /**
97      *  b/30907701
98      */
99     @Test
100     @AsbSecurityTest(cveBugId = 30907701)
testPocCVE_2016_6735()101     public void testPocCVE_2016_6735() throws Exception {
102         if(containsDriver(getDevice(), "/dev/dri/renderD129")) {
103             AdbUtils.runPoc("CVE-2016-6735", getDevice(), 60);
104         }
105     }
106 
107     /**
108      *  b/30953284
109      */
110     @Test
111     @AsbSecurityTest(cveBugId = 30953284)
testPocCVE_2016_6736()112     public void testPocCVE_2016_6736() throws Exception {
113         if(containsDriver(getDevice(), "/dev/dri/renderD129")) {
114             AdbUtils.runPoc("CVE-2016-6736", getDevice(), 60);
115         }
116     }
117 }
118