Files
xen/.gitignore
T
Ian Jackson 2862bf5b6c libxl: enforce prohibitions of internal callers
libxl_internal.h says:

 * Functions using LIBXL__INIT_EGC may *not* generally be called from
 * within libxl, because libxl__egc_cleanup may call back into the
 * application. ...

and

 *                    ...  [Functions which take an ao_how] MAY NOT
 * be called from inside libxl, because they can cause reentrancy
 * callbacks.

However, this was not enforced.  Particularly the latter restriction
is easy to overlook, especially since during the transition period to
the new event system we have bent this rule a couple of times, and the
bad pattern simply involves passing 0 or NULL for the ao_how.

So use the compiler to enforce this property, as follows:

 - Mark all functions which take a libxl_asyncop_how, or which
   use EGC_INIT or LIBXL__INIT_EGC, with a new annotation
   LIBXL_EXTERNAL_CALLERS_ONLY in the public header.

 - Change the documentation comment for asynch operations and egcs to
   say that this should always be done.

 - Arrange that if libxl.h is included via libxl_internal.h,
   LIBXL_EXTERNAL_CALLERS_ONLY expands to __attribute__((warning(...))),
   which generates a message like this:
      libxl.c:1772: warning: call to 'libxl_device_disk_remove'
             declared with attribute warning:
             may not be called from within libxl
   Otherwise, the annotation expands to nothing, so external
   callers are unaffected.

 - Forbid inclusion of both libxl.h and libxl_internal.h unless
   libxl_internal.h came first, so that the above check doesn't have
   any loopholes.  Files which include libxl_internal.h should not
   include libxl.h as well.

   This is enforced explicitly using #error.  However, in practice
   with the current tree it just changes the error message when this
   mistake is made; otherwise we would carry on to immediately
   following #define which would cause the compiler to complain that
   LIBXL_EXTERNAL_CALLERS_ONLY was redefined.  Then the developer
   might be tempted to add a #ifndef which would be wrong - it would
   leave the affected translation unit unprotected by the new
   enforcement regime.  So let's be explicit.

 - Fix the one source of files which violate the above principle, the
   output from the idl compiler, by removing the redundant inclusion
   of libxl.h from the output.

Also introduce a new script "check-libxl-api-rules" which contains
some ad-hoc regexps to spot and complain when libxl.h contains
functions which mention libxl_asyncop_how but not
LIBXL_EXTERNAL_CALLERS_ONLY.  This isn't a full C parser but is likely
to get the common cases right and err on the side of complaining.

While we are here, the invocation of perl for the bsd queue.h seddery
to $(PERL).

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Roger Pau Monne <roger.pau@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
2012-08-01 12:46:52 +01:00

394 lines
9.3 KiB
Plaintext

.hg
*.orig
*.rej
*~
*.o
*.d
*.opic
*.a
*.so
*.so.[0-9]*
*.bin
*.bak
*.tmp
*.spot
*.spit
TAGS
cscope.files
cscope.in.out
cscope.out
cscope.po.out
.config
dist
stubdom/*.tar.gz
build-*
dist/*
docs/*.aux
docs/*.dvi
docs/*.log
docs/*.pdf
docs/*.ps
docs/*.toc
docs/api/*
docs/figs/xenserver.eps
docs/html/*
docs/interface/WARNINGS
docs/interface/images.pl
docs/interface/images.tex
docs/interface/img1.png
docs/interface/index.html
docs/interface/interface.css
docs/interface/interface.html
docs/interface/labels.pl
docs/man1/
docs/man5/
docs/pdf/*
docs/ps/*
docs/user/WARNINGS
docs/user/images.pl
docs/user/images.tex
docs/user/img1.png
docs/user/img2.png
docs/user/img3.png
docs/user/index.html
docs/user/internals.pl
docs/user/labels.pl
docs/user/user.css
docs/user/user.html
docs/xen-api/vm_lifecycle.eps
docs/xen-api/xenapi-datamodel-graph.eps
docs/xen-api/xenapi.out
docs/xen-api/xenapi.dvi
docs/xen-api/xenapi.pdf
docs/xen-api/xenapi.ps
docs/xen-api/xenapi.toc
extras/mini-os/arch/ia64/gen_off.s
extras/mini-os/include/mini-os
extras/mini-os/include/ia64/mini-os
extras/mini-os/include/ia64/offsets.h
extras/mini-os/include/x86/mini-os
extras/mini-os/include/xen
extras/mini-os/include/list.h
extras/mini-os/mini-os*
install/*
linux-[^/]*-paravirt/*
linux-2.6[^/]*/*
linux-[^/]*-rc/*
linux-[^/]*-tip/*
linux-[^/]*-git/*
linux-[^/]*.patch
mkddbxen
netbsd-[^/]*-tools/*
netbsd-[^/]*-xen0/*
netbsd-[^/]*-xenU/*
netbsd-[^/]*.patch
patches/*/.makedep
patches/ebtables-brnf-5_vs_2.4.25.diff
patches/ebtables.diff
patches/tmp/*
pristine-*
ref-*
tmp-*
stubdom/binutils-*
stubdom/cross-root-*
stubdom/gcc-*
stubdom/include
stubdom/ioemu
stubdom/xenstore
stubdom/libxc-*
stubdom/lwip-*
stubdom/mini-os-*
stubdom/mk-headers-*
stubdom/newlib-1.*
stubdom/newlib-x86*
stubdom/pciutils-*
stubdom/zlib-*
stubdom/grub-*
stubdom/ocaml-*
stubdom/lwip/
stubdom/ioemu/
stubdom/stubdompath.sh
tools/*/build/lib*/*.py
tools/autom4te.cache
tools/config.h
tools/config.log
tools/config.status
tools/config.cache
config/Tools.mk
tools/blktap2/daemon/blktapctrl
tools/blktap2/drivers/img2qcow
tools/blktap2/drivers/lock-util
tools/blktap2/drivers/qcow-create
tools/blktap2/drivers/qcow2raw
tools/blktap2/drivers/tapdisk
tools/blktap2/drivers/tapdisk-client
tools/blktap2/drivers/tapdisk-diff
tools/blktap2/drivers/tapdisk-stream
tools/blktap2/drivers/tapdisk2
tools/blktap2/drivers/td-util
tools/blktap2/vhd/vhd-update
tools/blktap2/vhd/vhd-util
tools/blktap/drivers/blktapctrl
tools/blktap/drivers/img2qcow
tools/blktap/drivers/qcow-create
tools/blktap/drivers/qcow2raw
tools/blktap/drivers/tapdisk
tools/check/.*
tools/console/xenconsole
tools/console/xenconsoled
tools/debugger/gdb/gdb-6.2.1-linux-i386-xen/*
tools/debugger/gdb/gdb-6.2.1/*
tools/debugger/gdb/gdb-6.2.1.tar.bz2
tools/debugger/gdbsx/gdbsx
tools/debugger/xenitp/xenitp
tools/firmware/*/biossums
tools/firmware/*.bin
tools/firmware/*.sym
tools/firmware/*bios/*bios*.txt
tools/firmware/etherboot/gpxe/*
tools/firmware/extboot/extboot.img
tools/firmware/extboot/signrom
tools/firmware/hvmloader/acpi/mk_dsdt
tools/firmware/hvmloader/acpi/dsdt*.c
tools/firmware/hvmloader/acpi/dsdt*.asl
tools/firmware/hvmloader/acpi/ssdt_*.h
tools/firmware/hvmloader/hvmloader
tools/firmware/hvmloader/roms.h
tools/firmware/hvmloader/roms.inc
tools/firmware/rombios/BIOS-bochs-[^/]*
tools/firmware/rombios/_rombios[^/]*_.c
tools/firmware/rombios/rombios[^/]*.s
tools/firmware/rombios/32bit/32bitbios_flat.h
tools/firmware/vgabios/vbetables-gen
tools/firmware/vgabios/vbetables.h
tools/flask/utils/flask-getenforce
tools/flask/utils/flask-get-bool
tools/flask/utils/flask-loadpolicy
tools/flask/utils/flask-setenforce
tools/flask/utils/flask-set-bool
tools/flask/utils/flask-label-pci
tools/fs-back/fs-backend
tools/hotplug/common/hotplugpath.sh
tools/include/xen/*
tools/include/xen-foreign/*.(c|h|size)
tools/include/xen-foreign/checker
tools/libxc/ia64/asm/*.h
tools/libxc/ia64/acpi/*.h
tools/libxc/ia64/acpi/platform/*.h
tools/libxc/ia64/dom_fw_asm.S
tools/libxc/ia64/dom_fw_common.c
tools/libxc/ia64/dom_fw_domu.c
tools/libxc/ia64/xen/*.h
tools/libxen/libxenapi-
tools/libxen/test/test_bindings
tools/libxen/test/test_event_handling
tools/libxl/libxlu_cfg_y.output
tools/libxl/xl
tools/libxl/testenum
tools/libxl/testenum.c
tools/libxl/tmp.*
tools/libxl/libxl.api-for-check
tools/libaio/src/*.ol
tools/libaio/src/*.os
tools/misc/cpuperf/cpuperf-perfcntr
tools/misc/cpuperf/cpuperf-xen
tools/misc/lomount/lomount
tools/misc/mbootpack/bin2c
tools/misc/mbootpack/bootsect
tools/misc/mbootpack/bzimage_header.c
tools/misc/mbootpack/mbootpack
tools/misc/mbootpack/setup
tools/misc/miniterm/miniterm
tools/misc/xc_shadow
tools/misc/xen_cpuperf
tools/misc/xen-detect
tools/misc/xen-tmem-list-parse
tools/misc/xenperf
tools/misc/xenpm
tools/misc/xen-hvmctx
tools/misc/gtraceview
tools/misc/gtracestat
tools/misc/xenlockprof
tools/misc/lowmemd
tools/pygrub/build/*
tools/python/build/*
tools/python/xen/util/path.py
tools/remus/imqebt/imqebt
tools/remus/kmod/*(.cmd|.mod|.ko|.mod.c|.symvers|.xen)
tools/security/secpol_tool
tools/security/xen/*
tools/security/xensec_tool
tools/tests/blowfish.bin
tools/tests/blowfish.h
tools/tests/test_x86_emulator
tools/tests/x86_emulate
tools/tests/regression/installed/*
tools/tests/regression/build/*
tools/tests/regression/downloads/*
tools/tests/mem-sharing/memshrtool
tools/tests/mce-test/tools/xen-mceinj
tools/vnet/Make.local
tools/vnet/build/*
tools/vnet/gc
tools/vnet/gc*/*
tools/vnet/vnet-module/*.ko
tools/vnet/vnet-module/.*.cmd
tools/vnet/vnet-module/.tmp_versions/*
tools/vnet/vnet-module/vnet_module.mod.*
tools/vnet/vnetd/vnetd
tools/vtpm/tpm_emulator-*.tar.gz
tools/vtpm/tpm_emulator/*
tools/vtpm/vtpm/*
tools/vtpm_manager/manager/vtpm_managerd
tools/xcutils/lsevtchn
tools/xcutils/xc_restore
tools/xcutils/xc_save
tools/xcutils/readnotes
tools/xenfb/sdlfb
tools/xenfb/vncfb
tools/xenmon/xentrace_setmask
tools/xenmon/xenbaked
tools/xenpaging/xenpaging
tools/xenpmd/xenpmd
tools/xenstat/xentop/xentop
tools/xenstore/testsuite/tmp/*
tools/xenstore/init-xenstore-domain
tools/xenstore/xen
tools/xenstore/xenstore
tools/xenstore/xenstore-chmod
tools/xenstore/xenstore-exists
tools/xenstore/xenstore-list
tools/xenstore/xenstore-read
tools/xenstore/xenstore-rm
tools/xenstore/xenstore-write
tools/xenstore/xenstore-control
tools/xenstore/xenstore-ls
tools/xenstore/xenstored
tools/xenstore/xenstored_test
tools/xenstore/xs_crashme
tools/xenstore/xs_random
tools/xenstore/xs_stress
tools/xenstore/xs_tdb_dump
tools/xenstore/xs_test
tools/xenstore/xs_watch_stress
tools/xentrace/xentrace_setsize
tools/xentrace/tbctl
tools/xentrace/xenctx
tools/xentrace/xentrace
tools/xm-test/ramdisk/buildroot
tools/xm-test/aclocal.m4
tools/xm-test/autom4te
tools/xm-test/install-sh
tools/xm-test/mkinstalldirs
tools/xm-test/missing
tools/xm-test/config(ure|.log|.status|.guess|.sub)
tools/xm-test/Makefile(.in)*
tools/xm-test/*/Makefile(.in)*
tools/xm-test/lib/XmTestLib/config.py
tools/xm-test/lib/XmTestReport/xmtest.py
tools/xm-test/tests/*.test
tools/ocaml-xenstored*
xen/.banner*
xen/BLOG
xen/System.map
xen/arch/arm/asm-offsets.s
xen/arch/arm/xen.lds
xen/arch/x86/asm-offsets.s
xen/arch/x86/boot/mkelf32
xen/arch/x86/xen.lds
xen/arch/x86/boot/reloc.S
xen/arch/x86/boot/reloc.bin
xen/arch/x86/boot/reloc.lnk
xen/arch/x86/efi.lds
xen/arch/x86/efi/disabled
xen/arch/x86/efi/mkreloc
xen/ddb/*
xen/include/headers.chk
xen/include/asm
xen/include/asm-*/asm-offsets.h
xen/include/asm-ia64/asm-xsi-offsets.h
xen/include/asm-ia64/.offsets.h.stamp
xen/include/asm-ia64/xen
xen/include/compat/*
xen/include/hypervisor-ifs/arch
xen/include/linux
xen/include/public/public
xen/include/xen/*.new
xen/include/xen/acm_policy.h
xen/include/xen/banner.h
xen/include/xen/compile.h
xen/tools/figlet/figlet
xen/tools/symbols
xen/xen
xen/xen-syms
xen/xen.*
xen/arch/ia64/asm-offsets.s
xen/arch/ia64/asm-xsi-offsets.s
xen/arch/ia64/map.out
xen/arch/ia64/xen.lds.s
unmodified_drivers/linux-2.6/.tmp_versions
unmodified_drivers/linux-2.6/*.cmd
unmodified_drivers/linux-2.6/*.ko
unmodified_drivers/linux-2.6/*.mod.c
LibVNCServer*
tools/qemu-xen-dir-remote
tools/qemu-xen-dir
tools/qemu-xen-traditional-dir-remote
tools/qemu-xen-traditional-dir
tools/firmware/seabios-dir-remote
tools/firmware/seabios-dir
tools/firmware/rombios/_rombios_.c
tools/firmware/rombios/rombios.s
tools/firmware/rombios/rombios.sym
tools/include/xen-foreign/checker.c
tools/include/xen-foreign/ia64.h
tools/include/xen-foreign/structs.pyc
tools/include/xen-foreign/x86_32.h
tools/include/xen-foreign/x86_64.h
.git
tools/misc/xen-hptool
tools/libxl/_*.[ch]
tools/libxl/testidl
tools/libxl/testidl.c
tools/libxl/*.pyc
tools/libxl/libxl-save-helper
tools/blktap2/control/tap-ctl
tools/firmware/etherboot/eb-roms.h
tools/firmware/etherboot/gpxe-git-snapshot.tar.gz
tools/misc/xenwatchdogd
tools/misc/xen-hvmcrash
tools/misc/xen-lowmemd
tools/libvchan/vchan-node[12]
tools/ocaml/*/.ocamldep.make
tools/ocaml/*/*.cm[ixao]
tools/ocaml/*/*.cmxa
tools/ocaml/*/*.annot
tools/ocaml/*/*/.ocamldep.make
tools/ocaml/*/*/*.cm[ixao]
tools/ocaml/*/*/*.cmxa
tools/ocaml/*/*/*.annot
tools/ocaml/*/*/META
tools/ocaml/libs/xl/_libxl_types.inc
tools/ocaml/libs/xl/_libxl_types.ml.in
tools/ocaml/libs/xl/_libxl_types.mli.in
tools/ocaml/libs/xl/xenlight.ml
tools/ocaml/libs/xl/xenlight.mli
tools/ocaml/xenstored/oxenstored
tools/debugger/kdd/kdd
tools/firmware/etherboot/ipxe.tar.gz
tools/firmware/etherboot/ipxe/
tools/python/xen/lowlevel/xl/_pyxl_types.c
tools/python/xen/lowlevel/xl/_pyxl_types.h
tools/xenstore/xenstore-watch
docs/txt/misc/*.txt
docs/txt/man/*.txt