@@ -29,7 +29,8 @@ static int parse_vm_area(char *buf, struct vm_area *vma)
29
29
return -1 ;
30
30
}
31
31
32
- static int find_blobs (pid_t pid , struct vm_area * vdso , struct vm_area * vvar )
32
+ static int find_blobs (pid_t pid , struct vm_area * vdso ,
33
+ struct vm_area * vvar , struct vm_area * vvar_vclock )
33
34
{
34
35
char buf [BUF_SZ ];
35
36
int ret = -1 ;
@@ -39,6 +40,8 @@ static int find_blobs(pid_t pid, struct vm_area *vdso, struct vm_area *vvar)
39
40
vdso -> end = VDSO_BAD_ADDR ;
40
41
vvar -> start = VVAR_BAD_ADDR ;
41
42
vvar -> end = VVAR_BAD_ADDR ;
43
+ vvar_vclock -> start = VVAR_BAD_ADDR ;
44
+ vvar_vclock -> end = VVAR_BAD_ADDR ;
42
45
43
46
if (snprintf (buf , BUF_SZ , "/proc/%d/maps" , pid ) < 0 ) {
44
47
pr_perror ("snprintf() failure for path" );
@@ -57,12 +60,18 @@ static int find_blobs(pid_t pid, struct vm_area *vdso, struct vm_area *vvar)
57
60
58
61
if (strstr (buf , "[vvar]" ) && parse_vm_area (buf , vvar ))
59
62
goto err ;
63
+ if (strstr (buf , "[vvar_vclock]" ) &&
64
+ parse_vm_area (buf , vvar_vclock ))
65
+ goto err ;
60
66
}
61
67
62
68
if (vdso -> start != VDSO_BAD_ADDR )
63
69
test_msg ("[vdso] %lx-%lx\n" , vdso -> start , vdso -> end );
64
70
if (vvar -> start != VVAR_BAD_ADDR )
65
71
test_msg ("[vvar] %lx-%lx\n" , vvar -> start , vvar -> end );
72
+ if (vvar_vclock -> start != VVAR_BAD_ADDR )
73
+ test_msg ("[vvar_vclock] %lx-%lx\n" ,
74
+ vvar_vclock -> start , vvar_vclock -> end );
66
75
ret = 0 ;
67
76
err :
68
77
fclose (maps );
@@ -143,10 +152,10 @@ void sys_exit(int status)
143
152
144
153
static int unmap_blobs (void )
145
154
{
146
- struct vm_area vdso , vvar ;
155
+ struct vm_area vdso , vvar , vvar_vclock ;
147
156
int ret ;
148
157
149
- if (find_blobs (getpid (), & vdso , & vvar ))
158
+ if (find_blobs (getpid (), & vdso , & vvar , & vvar_vclock ))
150
159
return -1 ;
151
160
152
161
if (vdso .start != VDSO_BAD_ADDR ) {
@@ -159,13 +168,19 @@ static int unmap_blobs(void)
159
168
if (ret )
160
169
return ret ;
161
170
}
171
+ if (vvar_vclock .start != VVAR_BAD_ADDR ) {
172
+ ret = sys_munmap ((void * )vvar_vclock .start ,
173
+ vvar_vclock .end - vvar_vclock .start );
174
+ if (ret )
175
+ return ret ;
176
+ }
162
177
163
178
return 0 ;
164
179
}
165
180
166
181
int main (int argc , char * argv [])
167
182
{
168
- struct vm_area vdso , vvar ;
183
+ struct vm_area vdso , vvar , vvar_vclock ;
169
184
pid_t child ;
170
185
int status , ret = -1 ;
171
186
@@ -201,17 +216,19 @@ int main(int argc, char *argv[])
201
216
goto out_kill ;
202
217
}
203
218
204
- if (find_blobs (child , & vdso , & vvar ))
219
+ if (find_blobs (child , & vdso , & vvar , & vvar_vclock ))
205
220
goto out_kill ;
206
- if (vdso .start != VDSO_BAD_ADDR || vvar .start != VVAR_BAD_ADDR ) {
221
+ if (vdso .start != VDSO_BAD_ADDR ||
222
+ vvar .start != VVAR_BAD_ADDR ||
223
+ vvar_vclock .start != VVAR_BAD_ADDR ) {
207
224
pr_err ("Found vvar or vdso blob(s) in child, which should have unmapped them\n" );
208
225
goto out_kill ;
209
226
}
210
227
211
228
test_daemon ();
212
229
test_waitsig ();
213
230
214
- if (find_blobs (child , & vdso , & vvar ))
231
+ if (find_blobs (child , & vdso , & vvar , & vvar_vclock ))
215
232
goto out_kill ;
216
233
if (vdso .start != VDSO_BAD_ADDR || vvar .start != VVAR_BAD_ADDR ) {
217
234
pr_err ("Child without vdso got it after C/R\n" );
0 commit comments