diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2007-10-21 21:03:35 -0400 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2007-10-23 01:49:53 -0400 |
commit | c18acd73ffc209def08003a1927473096f66c5ad (patch) | |
tree | dd8e292ac8ca90b061b7e37ad6947231ced566e3 /drivers/lguest/core.c | |
parent | ee3db0f2b6053b65f3b70253f5f810d9a3d67b28 (diff) |
Allow guest to specify syscall vector to use.
(Based on Ron Minnich's LGUEST_PLAN9_SYSCALL patch).
This patch allows Guests to specify what system call vector they want,
and we try to reserve it. We only allow one non-Linux system call
vector, to try to avoid DoS on the Host.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'drivers/lguest/core.c')
-rw-r--r-- | drivers/lguest/core.c | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/drivers/lguest/core.c b/drivers/lguest/core.c index 02556bae9e9..41b26e592d3 100644 --- a/drivers/lguest/core.c +++ b/drivers/lguest/core.c | |||
@@ -281,37 +281,47 @@ static int __init init(void) | |||
281 | /* First we put the Switcher up in very high virtual memory. */ | 281 | /* First we put the Switcher up in very high virtual memory. */ |
282 | err = map_switcher(); | 282 | err = map_switcher(); |
283 | if (err) | 283 | if (err) |
284 | return err; | 284 | goto out; |
285 | 285 | ||
286 | /* Now we set up the pagetable implementation for the Guests. */ | 286 | /* Now we set up the pagetable implementation for the Guests. */ |
287 | err = init_pagetables(switcher_page, SHARED_SWITCHER_PAGES); | 287 | err = init_pagetables(switcher_page, SHARED_SWITCHER_PAGES); |
288 | if (err) { | 288 | if (err) |
289 | unmap_switcher(); | 289 | goto unmap; |
290 | return err; | ||
291 | } | ||
292 | 290 | ||
293 | /* The I/O subsystem needs some things initialized. */ | 291 | /* The I/O subsystem needs some things initialized. */ |
294 | lguest_io_init(); | 292 | lguest_io_init(); |
295 | 293 | ||
294 | /* We might need to reserve an interrupt vector. */ | ||
295 | err = init_interrupts(); | ||
296 | if (err) | ||
297 | goto free_pgtables; | ||
298 | |||
296 | /* /dev/lguest needs to be registered. */ | 299 | /* /dev/lguest needs to be registered. */ |
297 | err = lguest_device_init(); | 300 | err = lguest_device_init(); |
298 | if (err) { | 301 | if (err) |
299 | free_pagetables(); | 302 | goto free_interrupts; |
300 | unmap_switcher(); | ||
301 | return err; | ||
302 | } | ||
303 | 303 | ||
304 | /* Finally we do some architecture-specific setup. */ | 304 | /* Finally we do some architecture-specific setup. */ |
305 | lguest_arch_host_init(); | 305 | lguest_arch_host_init(); |
306 | 306 | ||
307 | /* All good! */ | 307 | /* All good! */ |
308 | return 0; | 308 | return 0; |
309 | |||
310 | free_interrupts: | ||
311 | free_interrupts(); | ||
312 | free_pgtables: | ||
313 | free_pagetables(); | ||
314 | unmap: | ||
315 | unmap_switcher(); | ||
316 | out: | ||
317 | return err; | ||
309 | } | 318 | } |
310 | 319 | ||
311 | /* Cleaning up is just the same code, backwards. With a little French. */ | 320 | /* Cleaning up is just the same code, backwards. With a little French. */ |
312 | static void __exit fini(void) | 321 | static void __exit fini(void) |
313 | { | 322 | { |
314 | lguest_device_remove(); | 323 | lguest_device_remove(); |
324 | free_interrupts(); | ||
315 | free_pagetables(); | 325 | free_pagetables(); |
316 | unmap_switcher(); | 326 | unmap_switcher(); |
317 | 327 | ||