hc
2023-12-09 b22da3d8526a935aa31e086e63f60ff3246cb61c
kernel/tools/testing/selftests/x86/ioperm.c
....@@ -131,6 +131,17 @@
131131 printf("[RUN]\tchild: check that we inherited permissions\n");
132132 expect_ok(0x80);
133133 expect_gp(0xed);
134
+ printf("[RUN]\tchild: Extend permissions to 0x81\n");
135
+ if (ioperm(0x81, 1, 1) != 0) {
136
+ printf("[FAIL]\tioperm(0x81, 1, 1) failed (%d)", errno);
137
+ return 1;
138
+ }
139
+ printf("[RUN]\tchild: Drop permissions to 0x80\n");
140
+ if (ioperm(0x80, 1, 0) != 0) {
141
+ printf("[FAIL]\tioperm(0x80, 1, 0) failed (%d)", errno);
142
+ return 1;
143
+ }
144
+ expect_gp(0x80);
134145 return 0;
135146 } else {
136147 int status;
....@@ -146,8 +157,11 @@
146157 }
147158 }
148159
149
- /* Test the capability checks. */
160
+ /* Verify that the child dropping 0x80 did not affect the parent */
161
+ printf("\tVerify that unsharing the bitmap worked\n");
162
+ expect_ok(0x80);
150163
164
+ /* Test the capability checks. */
151165 printf("\tDrop privileges\n");
152166 if (setresuid(1, 1, 1) != 0) {
153167 printf("[WARN]\tDropping privileges failed\n");