ia64/xen-unstable

view xen/xsm/dummy.c @ 18896:f7f8f44b9292

tools: Fix a few error-path memory leaks.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Tue Dec 09 12:53:19 2008 +0000 (2008-12-09)
parents e5766aea2907
children 2737293c761e
line source
1 /*
2 * This work is based on the LSM implementation in Linux 2.6.13.4.
3 *
4 * Author: George Coker, <gscoker@alpha.ncsc.mil>
5 *
6 * Contributors: Michael LeMay, <mdlemay@epoch.ncsc.mil>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2,
10 * as published by the Free Software Foundation.
11 */
13 #include <xen/sched.h>
14 #include <xsm/xsm.h>
16 static void dummy_security_domaininfo(struct domain *d,
17 struct xen_domctl_getdomaininfo *info)
18 {
19 return;
20 }
22 static int dummy_setvcpucontext(struct domain *d)
23 {
24 return 0;
25 }
27 static int dummy_pausedomain (struct domain *d)
28 {
29 return 0;
30 }
32 static int dummy_unpausedomain (struct domain *d)
33 {
34 return 0;
35 }
37 static int dummy_resumedomain (struct domain *d)
38 {
39 return 0;
40 }
42 static int dummy_domain_create(struct domain *d, u32 ssidref)
43 {
44 return 0;
45 }
47 static int dummy_max_vcpus(struct domain *d)
48 {
49 return 0;
50 }
52 static int dummy_destroydomain (struct domain *d)
53 {
54 return 0;
55 }
57 static int dummy_vcpuaffinity (int cmd, struct domain *d)
58 {
59 return 0;
60 }
62 static int dummy_scheduler (struct domain *d)
63 {
64 return 0;
65 }
67 static int dummy_getdomaininfo (struct domain *d)
68 {
69 return 0;
70 }
72 static int dummy_getvcpucontext (struct domain *d)
73 {
74 return 0;
75 }
77 static int dummy_getvcpuinfo (struct domain *d)
78 {
79 return 0;
80 }
82 static int dummy_domain_settime (struct domain *d)
83 {
84 return 0;
85 }
87 static int dummy_set_target (struct domain *d, struct domain *e)
88 {
89 return 0;
90 }
92 static int dummy_tbufcontrol (void)
93 {
94 return 0;
95 }
97 static int dummy_readconsole (uint32_t clear)
98 {
99 return 0;
100 }
102 static int dummy_sched_id (void)
103 {
104 return 0;
105 }
107 static int dummy_setdomainmaxmem (struct domain *d)
108 {
109 return 0;
110 }
112 static int dummy_setdomainhandle (struct domain *d)
113 {
114 return 0;
115 }
117 static int dummy_setdebugging (struct domain *d)
118 {
119 return 0;
120 }
122 static int dummy_perfcontrol (void)
123 {
124 return 0;
125 }
127 static int dummy_debug_keys (void)
128 {
129 return 0;
130 }
132 static int dummy_getcpuinfo (void)
133 {
134 return 0;
135 }
137 static int dummy_availheap (void)
138 {
139 return 0;
140 }
142 static int dummy_alloc_security_domain (struct domain *d)
143 {
144 return 0;
145 }
147 static void dummy_free_security_domain (struct domain *d)
148 {
149 return;
150 }
152 static int dummy_grant_mapref (struct domain *d1, struct domain *d2,
153 uint32_t flags)
154 {
155 return 0;
156 }
158 static int dummy_grant_unmapref (struct domain *d1, struct domain *d2)
159 {
160 return 0;
161 }
163 static int dummy_grant_setup (struct domain *d1, struct domain *d2)
164 {
165 return 0;
166 }
168 static int dummy_grant_transfer (struct domain *d1, struct domain *d2)
169 {
170 return 0;
171 }
173 static int dummy_grant_copy (struct domain *d1, struct domain *d2)
174 {
175 return 0;
176 }
178 static int dummy_grant_query_size (struct domain *d1, struct domain *d2)
179 {
180 return 0;
181 }
183 static int dummy_translate_gpfn_list (struct domain *d, unsigned long mfn)
184 {
185 return 0;
186 }
188 static int dummy_memory_adjust_reservation (struct domain *d1,
189 struct domain *d2)
190 {
191 return 0;
192 }
194 static int dummy_memory_stat_reservation (struct domain *d1, struct domain *d2)
195 {
196 return 0;
197 }
199 static int dummy_console_io (struct domain *d, int cmd)
200 {
201 return 0;
202 }
204 static int dummy_profile (struct domain *d, int op)
205 {
206 return 0;
207 }
209 static int dummy_kexec (void)
210 {
211 return 0;
212 }
214 static int dummy_schedop_shutdown (struct domain *d1, struct domain *d2)
215 {
216 return 0;
217 }
219 static int dummy_memory_pin_page(struct domain *d, struct page_info *page)
220 {
221 return 0;
222 }
224 static int dummy_evtchn_unbound (struct domain *d, struct evtchn *chn,
225 domid_t id2)
226 {
227 return 0;
228 }
230 static int dummy_evtchn_interdomain (struct domain *d1, struct evtchn
231 *chan1, struct domain *d2, struct evtchn *chan2)
232 {
233 return 0;
234 }
236 static void dummy_evtchn_close_post (struct evtchn *chn)
237 {
238 return;
239 }
241 static int dummy_evtchn_send (struct domain *d, struct evtchn *chn)
242 {
243 return 0;
244 }
246 static int dummy_evtchn_status (struct domain *d, struct evtchn *chn)
247 {
248 return 0;
249 }
251 static int dummy_evtchn_reset (struct domain *d1, struct domain *d2)
252 {
253 return 0;
254 }
256 static int dummy_alloc_security_evtchn (struct evtchn *chn)
257 {
258 return 0;
259 }
261 static void dummy_free_security_evtchn (struct evtchn *chn)
262 {
263 return;
264 }
266 static long dummy___do_xsm_op(XEN_GUEST_HANDLE(xsm_op_t) op)
267 {
268 return -ENOSYS;
269 }
271 static int dummy_add_range (struct domain *d, char *name, unsigned long s, unsigned long e)
272 {
273 return 0;
274 }
276 static int dummy_remove_range (struct domain *d, char *name, unsigned long s,
277 unsigned long e)
278 {
279 return 0;
280 }
282 #ifdef CONFIG_X86
283 static int dummy_shadow_control (struct domain *d, uint32_t op)
284 {
285 return 0;
286 }
288 static int dummy_getpageframeinfo (struct page_info *page)
289 {
290 return 0;
291 }
293 static int dummy_getmemlist (struct domain *d)
294 {
295 return 0;
296 }
298 static int dummy_hypercall_init (struct domain *d)
299 {
300 return 0;
301 }
303 static int dummy_hvmcontext (struct domain *d, uint32_t cmd)
304 {
305 return 0;
306 }
308 static int dummy_address_size (struct domain *d, uint32_t cmd)
309 {
310 return 0;
311 }
313 static int dummy_machine_address_size (struct domain *d, uint32_t cmd)
314 {
315 return 0;
316 }
318 static int dummy_hvm_param (struct domain *d, unsigned long op)
319 {
320 return 0;
321 }
323 static int dummy_hvm_set_pci_intx_level (struct domain *d)
324 {
325 return 0;
326 }
328 static int dummy_hvm_set_isa_irq_level (struct domain *d)
329 {
330 return 0;
331 }
333 static int dummy_hvm_set_pci_link_route (struct domain *d)
334 {
335 return 0;
336 }
338 static int dummy_apic (struct domain *d, int cmd)
339 {
340 return 0;
341 }
343 static int dummy_assign_vector (struct domain *d, uint32_t pirq)
344 {
345 return 0;
346 }
348 static int dummy_xen_settime (void)
349 {
350 return 0;
351 }
353 static int dummy_memtype (uint32_t access)
354 {
355 return 0;
356 }
358 static int dummy_microcode (void)
359 {
360 return 0;
361 }
363 static int dummy_physinfo (void)
364 {
365 return 0;
366 }
368 static int dummy_platform_quirk (uint32_t quirk)
369 {
370 return 0;
371 }
373 static int dummy_firmware_info (void)
374 {
375 return 0;
376 }
378 static int dummy_acpi_sleep (void)
379 {
380 return 0;
381 }
383 static int dummy_change_freq (void)
384 {
385 return 0;
386 }
388 static int dummy_getidletime (void)
389 {
390 return 0;
391 }
393 static int dummy_machine_memory_map (void)
394 {
395 return 0;
396 }
398 static int dummy_domain_memory_map (struct domain *d)
399 {
400 return 0;
401 }
403 static int dummy_mmu_normal_update (struct domain *d, struct domain *f,
404 intpte_t fpte)
405 {
406 return 0;
407 }
409 static int dummy_mmu_machphys_update (struct domain *d, unsigned long mfn)
410 {
411 return 0;
412 }
414 static int dummy_update_va_mapping (struct domain *d, struct domain *f,
415 l1_pgentry_t pte)
416 {
417 return 0;
418 }
420 static int dummy_add_to_physmap (struct domain *d1, struct domain *d2)
421 {
422 return 0;
423 }
425 static int dummy_sendtrigger (struct domain *d)
426 {
427 return 0;
428 }
430 static int dummy_test_assign_device (uint32_t machine_bdf)
431 {
432 return 0;
433 }
435 static int dummy_assign_device (struct domain *d, uint32_t machine_bdf)
436 {
437 return 0;
438 }
440 static int dummy_deassign_device (struct domain *d, uint32_t machine_bdf)
441 {
442 return 0;
443 }
445 static int dummy_bind_pt_irq (struct domain *d, struct xen_domctl_bind_pt_irq *bind)
446 {
447 return 0;
448 }
450 static int dummy_pin_mem_cacheattr (struct domain *d)
451 {
452 return 0;
453 }
455 static int dummy_ext_vcpucontext (struct domain *d, uint32_t cmd)
456 {
457 return 0;
458 }
460 static int dummy_remove_from_physmap (struct domain *d1, struct domain *d2)
461 {
462 return 0;
463 }
464 #endif
466 struct xsm_operations dummy_xsm_ops;
468 #define set_to_dummy_if_null(ops, function) \
469 do { \
470 if ( !ops->function ) \
471 { \
472 ops->function = dummy_##function; \
473 dprintk(XENLOG_DEBUG, "Had to override the " #function \
474 " security operation with the dummy one.\n"); \
475 } \
476 } while (0)
478 void xsm_fixup_ops (struct xsm_operations *ops)
479 {
480 set_to_dummy_if_null(ops, security_domaininfo);
481 set_to_dummy_if_null(ops, setvcpucontext);
482 set_to_dummy_if_null(ops, pausedomain);
483 set_to_dummy_if_null(ops, unpausedomain);
484 set_to_dummy_if_null(ops, resumedomain);
485 set_to_dummy_if_null(ops, domain_create);
486 set_to_dummy_if_null(ops, max_vcpus);
487 set_to_dummy_if_null(ops, destroydomain);
488 set_to_dummy_if_null(ops, vcpuaffinity);
489 set_to_dummy_if_null(ops, scheduler);
490 set_to_dummy_if_null(ops, getdomaininfo);
491 set_to_dummy_if_null(ops, getvcpucontext);
492 set_to_dummy_if_null(ops, getvcpuinfo);
493 set_to_dummy_if_null(ops, domain_settime);
494 set_to_dummy_if_null(ops, set_target);
495 set_to_dummy_if_null(ops, tbufcontrol);
496 set_to_dummy_if_null(ops, readconsole);
497 set_to_dummy_if_null(ops, sched_id);
498 set_to_dummy_if_null(ops, setdomainmaxmem);
499 set_to_dummy_if_null(ops, setdomainhandle);
500 set_to_dummy_if_null(ops, setdebugging);
501 set_to_dummy_if_null(ops, perfcontrol);
502 set_to_dummy_if_null(ops, debug_keys);
503 set_to_dummy_if_null(ops, getcpuinfo);
504 set_to_dummy_if_null(ops, availheap);
506 set_to_dummy_if_null(ops, evtchn_unbound);
507 set_to_dummy_if_null(ops, evtchn_interdomain);
508 set_to_dummy_if_null(ops, evtchn_close_post);
509 set_to_dummy_if_null(ops, evtchn_send);
510 set_to_dummy_if_null(ops, evtchn_status);
511 set_to_dummy_if_null(ops, evtchn_reset);
513 set_to_dummy_if_null(ops, grant_mapref);
514 set_to_dummy_if_null(ops, grant_unmapref);
515 set_to_dummy_if_null(ops, grant_setup);
516 set_to_dummy_if_null(ops, grant_transfer);
517 set_to_dummy_if_null(ops, grant_copy);
518 set_to_dummy_if_null(ops, grant_query_size);
520 set_to_dummy_if_null(ops, alloc_security_domain);
521 set_to_dummy_if_null(ops, free_security_domain);
522 set_to_dummy_if_null(ops, alloc_security_evtchn);
523 set_to_dummy_if_null(ops, free_security_evtchn);
525 set_to_dummy_if_null(ops, translate_gpfn_list);
526 set_to_dummy_if_null(ops, memory_adjust_reservation);
527 set_to_dummy_if_null(ops, memory_stat_reservation);
528 set_to_dummy_if_null(ops, memory_pin_page);
530 set_to_dummy_if_null(ops, console_io);
532 set_to_dummy_if_null(ops, profile);
534 set_to_dummy_if_null(ops, kexec);
535 set_to_dummy_if_null(ops, schedop_shutdown);
537 set_to_dummy_if_null(ops, add_range);
538 set_to_dummy_if_null(ops, remove_range);
540 set_to_dummy_if_null(ops, __do_xsm_op);
542 #ifdef CONFIG_X86
543 set_to_dummy_if_null(ops, shadow_control);
544 set_to_dummy_if_null(ops, getpageframeinfo);
545 set_to_dummy_if_null(ops, getmemlist);
546 set_to_dummy_if_null(ops, hypercall_init);
547 set_to_dummy_if_null(ops, hvmcontext);
548 set_to_dummy_if_null(ops, address_size);
549 set_to_dummy_if_null(ops, machine_address_size);
550 set_to_dummy_if_null(ops, hvm_param);
551 set_to_dummy_if_null(ops, hvm_set_pci_intx_level);
552 set_to_dummy_if_null(ops, hvm_set_isa_irq_level);
553 set_to_dummy_if_null(ops, hvm_set_pci_link_route);
554 set_to_dummy_if_null(ops, apic);
555 set_to_dummy_if_null(ops, assign_vector);
556 set_to_dummy_if_null(ops, xen_settime);
557 set_to_dummy_if_null(ops, memtype);
558 set_to_dummy_if_null(ops, microcode);
559 set_to_dummy_if_null(ops, physinfo);
560 set_to_dummy_if_null(ops, platform_quirk);
561 set_to_dummy_if_null(ops, firmware_info);
562 set_to_dummy_if_null(ops, acpi_sleep);
563 set_to_dummy_if_null(ops, change_freq);
564 set_to_dummy_if_null(ops, getidletime);
565 set_to_dummy_if_null(ops, machine_memory_map);
566 set_to_dummy_if_null(ops, domain_memory_map);
567 set_to_dummy_if_null(ops, mmu_normal_update);
568 set_to_dummy_if_null(ops, mmu_machphys_update);
569 set_to_dummy_if_null(ops, update_va_mapping);
570 set_to_dummy_if_null(ops, add_to_physmap);
571 set_to_dummy_if_null(ops, remove_from_physmap);
572 set_to_dummy_if_null(ops, sendtrigger);
573 set_to_dummy_if_null(ops, test_assign_device);
574 set_to_dummy_if_null(ops, assign_device);
575 set_to_dummy_if_null(ops, deassign_device);
576 set_to_dummy_if_null(ops, bind_pt_irq);
577 set_to_dummy_if_null(ops, pin_mem_cacheattr);
578 set_to_dummy_if_null(ops, ext_vcpucontext);
579 #endif
580 }