Lines Matching +full:self +full:-
1 // SPDX-License-Identifier: GPL-2.0
40 self->uv_fd = open(UV_PATH, O_ACCMODE); in FIXTURE_SETUP()
42 self->uvio_ioctl.argument_addr = (__u64)self->buffer; in FIXTURE_SETUP()
43 self->uvio_ioctl.argument_len = variant->arg_size; in FIXTURE_SETUP()
44 self->fault_page = in FIXTURE_SETUP()
45 (__u64)mmap(NULL, (size_t)getpagesize(), PROT_NONE, MAP_ANONYMOUS, -1, 0); in FIXTURE_SETUP()
50 if (self->uv_fd) in FIXTURE_TEARDOWN()
51 close(self->uv_fd); in FIXTURE_TEARDOWN()
52 munmap((void *)self->fault_page, (size_t)getpagesize()); in FIXTURE_TEARDOWN()
59 rc = ioctl(self->uv_fd, variant->ioctl_cmd, NULL); in TEST_F()
61 ASSERT_EQ(rc, -1); in TEST_F()
64 rc = ioctl(self->uv_fd, variant->ioctl_cmd, self->fault_page); in TEST_F()
66 ASSERT_EQ(rc, -1); in TEST_F()
74 self->uvio_ioctl.argument_addr = 0; in TEST_F()
75 rc = ioctl(self->uv_fd, variant->ioctl_cmd, &self->uvio_ioctl); in TEST_F()
77 ASSERT_EQ(rc, -1); in TEST_F()
80 self->uvio_ioctl.argument_addr = self->fault_page; in TEST_F()
81 rc = ioctl(self->uv_fd, variant->ioctl_cmd, &self->uvio_ioctl); in TEST_F()
83 ASSERT_EQ(rc, -1); in TEST_F()
95 self->uvio_ioctl.argument_len = 0; in TEST_F()
96 rc = ioctl(self->uv_fd, variant->ioctl_cmd, &self->uvio_ioctl); in TEST_F()
98 ASSERT_EQ(rc, -1); in TEST_F()
101 self->uvio_ioctl.argument_len = (uint32_t)-1; in TEST_F()
102 rc = ioctl(self->uv_fd, variant->ioctl_cmd, &self->uvio_ioctl); in TEST_F()
104 ASSERT_EQ(rc, -1); in TEST_F()
106 self->uvio_ioctl.argument_len = variant->arg_size; in TEST_F()
108 self->uvio_ioctl.flags = (uint32_t)-1; in TEST_F()
109 rc = ioctl(self->uv_fd, variant->ioctl_cmd, &self->uvio_ioctl); in TEST_F()
111 ASSERT_EQ(rc, -1); in TEST_F()
113 self->uvio_ioctl.flags = 0; in TEST_F()
115 memset(self->uvio_ioctl.reserved14, 0xff, sizeof(self->uvio_ioctl.reserved14)); in TEST_F()
116 rc = ioctl(self->uv_fd, variant->ioctl_cmd, &self->uvio_ioctl); in TEST_F()
118 ASSERT_EQ(rc, -1); in TEST_F()
121 memset(&self->uvio_ioctl, 0x11, sizeof(self->uvio_ioctl)); in TEST_F()
122 rc = ioctl(self->uv_fd, variant->ioctl_cmd, &self->uvio_ioctl); in TEST_F()
123 ASSERT_EQ(rc, -1); in TEST_F()
129 uint8_t nr = _IOC_NR(variant->ioctl_cmd); in TEST_F()
139 rc = ioctl(self->uv_fd, cmds[i], &self->uvio_ioctl); in TEST_F()
141 ASSERT_EQ(rc, -1); in TEST_F()
162 self->uv_fd = open(UV_PATH, O_ACCMODE); in FIXTURE_SETUP()
164 self->uvio_ioctl.argument_addr = (__u64)&self->uvio_attest; in FIXTURE_SETUP()
165 self->uvio_ioctl.argument_len = sizeof(self->uvio_attest); in FIXTURE_SETUP()
167 self->uvio_attest.arcb_addr = (__u64)&self->attest_buffer.arcb; in FIXTURE_SETUP()
168 self->uvio_attest.arcb_len = sizeof(self->attest_buffer.arcb); in FIXTURE_SETUP()
170 self->uvio_attest.meas_addr = (__u64)&self->attest_buffer.meas; in FIXTURE_SETUP()
171 self->uvio_attest.meas_len = sizeof(self->attest_buffer.meas); in FIXTURE_SETUP()
173 self->uvio_attest.add_data_addr = (__u64)&self->attest_buffer.add; in FIXTURE_SETUP()
174 self->uvio_attest.add_data_len = sizeof(self->attest_buffer.add); in FIXTURE_SETUP()
175 self->fault_page = in FIXTURE_SETUP()
176 (__u64)mmap(NULL, (size_t)getpagesize(), PROT_NONE, MAP_ANONYMOUS, -1, 0); in FIXTURE_SETUP()
181 if (self->uv_fd) in FIXTURE_TEARDOWN()
182 close(self->uv_fd); in FIXTURE_TEARDOWN()
183 munmap((void *)self->fault_page, (size_t)getpagesize()); in FIXTURE_TEARDOWN()
188 FIXTURE_DATA(attest_fixture) *self) in att_inval_sizes_test()
195 rc = ioctl(self->uv_fd, UVIO_IOCTL_ATT, &self->uvio_ioctl); in att_inval_sizes_test()
197 ASSERT_EQ(rc, -1); in att_inval_sizes_test()
201 rc = ioctl(self->uv_fd, UVIO_IOCTL_ATT, &self->uvio_ioctl); in att_inval_sizes_test()
203 ASSERT_EQ(rc, -1); in att_inval_sizes_test()
216 att_inval_sizes_test(&self->uvio_attest.add_data_len, UVIO_ATT_ADDITIONAL_MAX_LEN, in TEST_F()
217 false, _metadata, self); in TEST_F()
218 att_inval_sizes_test(&self->uvio_attest.meas_len, UVIO_ATT_MEASUREMENT_MAX_LEN, in TEST_F()
219 true, _metadata, self); in TEST_F()
220 att_inval_sizes_test(&self->uvio_attest.arcb_len, UVIO_ATT_ARCB_MAX_LEN, in TEST_F()
221 true, _metadata, self); in TEST_F()
223 self->uvio_attest.reserved136 = (uint16_t)-1; in TEST_F()
224 rc = ioctl(self->uv_fd, UVIO_IOCTL_ATT, &self->uvio_ioctl); in TEST_F()
226 ASSERT_EQ(rc, -1); in TEST_F()
229 memset(&self->uvio_attest, 0x11, sizeof(self->uvio_attest)); in TEST_F()
230 rc = ioctl(self->uv_fd, UVIO_IOCTL_ATT, &self->uvio_ioctl); in TEST_F()
231 ASSERT_EQ(rc, -1); in TEST_F()
235 FIXTURE_DATA(attest_fixture) *self) in att_inval_addr_test()
241 rc = ioctl(self->uv_fd, UVIO_IOCTL_ATT, &self->uvio_ioctl); in att_inval_addr_test()
243 ASSERT_EQ(rc, -1); in att_inval_addr_test()
245 *addr = self->fault_page; in att_inval_addr_test()
246 rc = ioctl(self->uv_fd, UVIO_IOCTL_ATT, &self->uvio_ioctl); in att_inval_addr_test()
248 ASSERT_EQ(rc, -1); in att_inval_addr_test()
255 att_inval_addr_test(&self->uvio_attest.arcb_addr, _metadata, self); in TEST_F()
256 att_inval_addr_test(&self->uvio_attest.add_data_addr, _metadata, self); in TEST_F()
257 att_inval_addr_test(&self->uvio_attest.meas_addr, _metadata, self); in TEST_F()
265 ksft_exit_skip("No uv-device or cannot access " UV_PATH "\n" in main()