qemu-patch-raspberry4/docs/devel
Paolo Bonzini 447b0d0b9e memory: avoid "resurrection" of dead FlatViews
It's possible for address_space_get_flatview() as it currently stands
to cause a use-after-free for the returned FlatView, if the reference
count is incremented after the FlatView has been replaced by a writer:

   thread 1             thread 2             RCU thread
  -------------------------------------------------------------
   rcu_read_lock
   read as->current_map
                        set as->current_map
                        flatview_unref
                           '--> call_rcu
   flatview_ref
     [ref=1]
   rcu_read_unlock
                                             flatview_destroy
   <badness>

Since FlatViews are not updated very often, we can just detect the
situation using a new atomic op atomic_fetch_inc_nonzero, similar to
Linux's atomic_inc_not_zero, which performs the refcount increment only if
it hasn't already hit zero.  This is similar to Linux commit de09a9771a53
("CRED: Fix get_task_cred() and task_state() to not resurrect dead
credentials", 2010-07-29).

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2017-09-21 23:19:37 +02:00
..
atomics.txt memory: avoid "resurrection" of dead FlatViews 2017-09-21 23:19:37 +02:00
blkdebug.txt docs: create config/, devel/ and spin/ subdirectories 2017-06-07 18:22:03 +02:00
blkverify.txt docs: create config/, devel/ and spin/ subdirectories 2017-06-07 18:22:03 +02:00
build-system.txt Makefile: Remove libqemustub.a 2017-09-19 16:20:31 +02:00
lockcnt.txt docs: fix broken paths to docs/devel/atomics.txt 2017-07-31 13:12:47 +03:00
memory.txt docs/devel/memory.txt: Add section about RAM migration 2017-07-14 17:59:42 +01:00
migration.txt docs: create config/, devel/ and spin/ subdirectories 2017-06-07 18:22:03 +02:00
multi-thread-tcg.txt docs: create config/, devel/ and spin/ subdirectories 2017-06-07 18:22:03 +02:00
multiple-iothreads.txt docs: create config/, devel/ and spin/ subdirectories 2017-06-07 18:22:03 +02:00
qapi-code-gen.txt qapi: Generate FOO_str() macro for QAPI enum FOO 2017-09-04 13:09:13 +02:00
rcu.txt docs: create config/, devel/ and spin/ subdirectories 2017-06-07 18:22:03 +02:00
tracing.txt trace: add trace_event_get_state_backends() 2017-08-01 12:13:07 +01:00
virtio-migration.txt docs: create config/, devel/ and spin/ subdirectories 2017-06-07 18:22:03 +02:00
writing-qmp-commands.txt docs: fix broken paths to docs/devel/qapi-code-gen.txt 2017-07-31 13:12:41 +03:00