qemu-e2k/include
Eric Blake 262a69f428 osdep.h: Prohibit disabling assert() in supported builds
We already have several files that knowingly require assert()
to work, sometimes because refactoring the code for proper
error handling has not been tackled yet; there are probably
other files that have a similar situation but with no comments
documenting the same.  In fact, we have places in migration
that handle untrusted input with assertions, where disabling
the assertions risks a worse security hole than the current
behavior of losing the guest to SIGABRT when migration fails
because of the assertion.  Promote our current per-file
safety-valve to instead be project-wide, and expand it to also
cover glib's g_assert().

Note that we do NOT want to encourage 'assert(side-effects);'
(that is a bad practice that prevents copy-and-paste of code to
other projects that CAN disable assertions; plus it costs
unnecessary reviewer mental cycles to remember whether a project
special-cases the crippling of asserts); and we would LIKE to
fix migration to not rely on asserts (but that takes a big code
audit).  But in the meantime, we DO want to send a message
that anyone that disables assertions has to tweak code in order
to compile, making it obvious that they are taking on additional
risk that we are not going to support.  At the same time, leave
comments mentioning NDEBUG in files that we know still need to
be scrubbed, so there is at least something to grep for.

It would be possible to come up with some other mechanism for
doing runtime checking by default, but which does not abort
the program on failure, while leaving side effects in place
(unlike how crippling assert() avoids even the side effects),
perhaps under the name q_verify(); but it was not deemed worth
the effort (developers should not have to learn a replacement
when the standard C macro works just fine, and it would be a lot
of churn for little gain).  The patch specifically uses #error
rather than #warn so that a user is forced to tweak the header
to acknowledge the issue, even when not using a -Werror
compilation.

Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Thomas Huth <thuth@redhat.com>

Message-Id: <20170911211320.25385-1-eblake@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2017-09-19 16:20:49 +02:00
..
block scsi: move block/scsi.h to include/scsi/constants.h 2017-09-19 14:09:31 +02:00
chardev char: don't exit on hmp 'chardev-add help' 2017-08-01 17:27:33 +02:00
crypto crypto: hmac: add hmac driver framework 2017-07-19 10:11:05 +01:00
disas Fix Thumb-1 BE32 execution and disassembly. 2017-02-07 18:29:59 +00:00
exec tcg: Move USE_DIRECT_JUMP discriminator to tcg/cpu/tcg-target.h 2017-09-07 11:57:34 -07:00
fpu configure: Drop ancient Solaris 9 and earlier support 2017-07-21 15:04:05 +01:00
hw i386/cpu/hyperv: support over 64 vcpus for windows guests 2017-09-19 16:20:49 +02:00
io io: Add new qio_channel_read{, v}_all_eof functions 2017-09-06 10:11:54 -05:00
libdecnumber Clean up ill-advised or unusual header guards 2016-07-12 16:20:46 +02:00
migration migration: remove check against colo support 2017-07-18 17:36:24 +02:00
monitor block: rip out all traces of password prompting 2017-07-11 17:44:56 +02:00
net net/net.c: Add vnet_hdr support in SocketReadState 2017-07-17 20:02:11 +08:00
qapi qapi: Change data type of the FOO_lookup generated for enum FOO 2017-09-04 13:09:13 +02:00
qemu osdep.h: Prohibit disabling assert() in supported builds 2017-09-19 16:20:49 +02:00
qom boards.h: Define new flag ignore_memory_transaction_failures 2017-09-07 13:54:54 +01:00
scsi scsi: move block/scsi.h to include/scsi/constants.h 2017-09-19 14:09:31 +02:00
standard-headers linux-headers: update to 4.13-rc0 2017-07-14 12:29:10 +02:00
sysemu seccomp: add resourcecontrol argument to command line 2017-09-15 10:15:06 +02:00
ui console: use DIV_ROUND_UP 2017-08-31 12:29:07 +02:00
elf.h tcg/s390: Use constant pool for movi 2017-09-07 11:57:35 -07:00
glib-compat.h qga: Add 'guest-get-users' command 2017-04-26 23:57:45 -05:00
qemu-common.h maint: Include bug-reporting info in --help output 2017-08-08 17:28:53 +02:00
qemu-io.h hmp: Request permissions in qemu-io 2017-02-28 20:47:50 +01:00
trace-tcg.h trace: get rid of generated-events.h/generated-events.c 2016-10-12 09:54:52 +02:00