Re: [Qemu-devel] [PATCH] block/file-posix: ignore fail on unlock bytes
27.03.2019 15:49, Vladimir Sementsov-Ogievskiy wrote: > bdrv_replace_child() calls bdrv_check_perm() with error_abort on > loosening permissions. However file-locking operations may fail even > in this case, for example on NFS. And this leads to Qemu crash. > > Let's ignore such errors, as we do already on permission update commit > and abort. > > Signed-off-by: Vladimir Sementsov-Ogievskiy > --- > block/file-posix.c | 14 ++ > 1 file changed, 14 insertions(+) > > diff --git a/block/file-posix.c b/block/file-posix.c > index db4cccbe51..403e67fe90 100644 > --- a/block/file-posix.c > +++ b/block/file-posix.c > @@ -815,6 +815,20 @@ static int raw_handle_perm_lock(BlockDriverState *bs, > > switch (op) { > case RAW_PL_PREPARE: > +if ((s->perm | new_perm) == s->perm && > +(~s->shared_perm | ~new_perm) == ~s->shared_perm) I was thinking about, resend or not, when I noticed that in second line there is much more funny mistake: s/new_perm/new_shared : So, decided to resend. > +{ > +/* > + * We are going to unlock bytes, it should not fail. If fail, > + * just report it and ignore, like we do for ABORT and COMMIT > + * anyway. > + */ > +ret = raw_check_lock_bytes(s->fd, new_perm, new_shared, > &local_err); > +if (local_err) { > +error_report_err(local_err); > +} > +return 0; > +} > ret = raw_apply_lock_bytes(s, s->fd, s->perm | new_perm, > ~s->shared_perm | ~new_shared, > false, errp); > -- Best regards, Vladimir
Re: [Qemu-devel] [PATCH] block/file-posix: ignore fail on unlock bytes
On Wed, 03/27 15:49, Vladimir Sementsov-Ogievskiy wrote: > bdrv_replace_child() calls bdrv_check_perm() with error_abort on > loosening permissions. However file-locking operations may fail even > in this case, for example on NFS. And this leads to Qemu crash. > > Let's ignore such errors, as we do already on permission update commit > and abort. > > Signed-off-by: Vladimir Sementsov-Ogievskiy > --- > block/file-posix.c | 14 ++ > 1 file changed, 14 insertions(+) > > diff --git a/block/file-posix.c b/block/file-posix.c > index db4cccbe51..403e67fe90 100644 > --- a/block/file-posix.c > +++ b/block/file-posix.c > @@ -815,6 +815,20 @@ static int raw_handle_perm_lock(BlockDriverState *bs, > > switch (op) { > case RAW_PL_PREPARE: > +if ((s->perm | new_perm) == s->perm && > +(~s->shared_perm | ~new_perm) == ~s->shared_perm) > +{ > +/* > + * We are going to unlock bytes, it should not fail. If fail, > + * just report it and ignore, like we do for ABORT and COMMIT > + * anyway. > + */ > +ret = raw_check_lock_bytes(s->fd, new_perm, new_shared, > &local_err); > +if (local_err) { > +error_report_err(local_err); > +} > +return 0; > +} > ret = raw_apply_lock_bytes(s, s->fd, s->perm | new_perm, > ~s->shared_perm | ~new_shared, > false, errp); > -- > 2.18.0 > > Reviewed-by: Fam Zheng
Re: [Qemu-devel] [PATCH] block/file-posix: ignore fail on unlock bytes
Patchew URL: https://patchew.org/QEMU/20190327124915.22265-1-vsement...@virtuozzo.com/ Hi, This series failed the asan build test. Please find the testing commands and their output below. If you have Docker installed, you can probably reproduce it locally. === TEST SCRIPT BEGIN === #!/bin/bash time make docker-test-debug@fedora TARGET_LIST=x86_64-softmmu J=14 NETWORK=1 === TEST SCRIPT END === PASS 1 fdc-test /x86_64/fdc/cmos PASS 2 fdc-test /x86_64/fdc/no_media_on_start PASS 3 fdc-test /x86_64/fdc/read_without_media ==7509==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 4 fdc-test /x86_64/fdc/media_change PASS 5 fdc-test /x86_64/fdc/sense_interrupt PASS 6 fdc-test /x86_64/fdc/relative_seek --- PASS 33 test-opts-visitor /visitor/opts/dict/unvisited PASS 11 fdc-test /x86_64/fdc/read_no_dma_18 MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(( ${RANDOM:-0} % 255 + 1))} tests/test-coroutine -m=quick -k --tap < /dev/null | ./scripts/tap-driver.pl --test-name="test-coroutine" ==7572==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! ==7572==WARNING: ASan is ignoring requested __asan_handle_no_return: stack top: 0x7ffd9579e000; bottom 0x7efe3dbf8000; size: 0x00ff57ba6000 (1096688492544) False positive error reports may follow For details see https://github.com/google/sanitizers/issues/189 PASS 1 test-coroutine /basic/no-dangling-access --- PASS 13 test-aio /aio/event/wait/no-flush-cb PASS 12 fdc-test /x86_64/fdc/read_no_dma_19 PASS 14 test-aio /aio/timer/schedule ==7587==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 15 test-aio /aio/coroutine/queue-chaining PASS 16 test-aio /aio-gsource/flush PASS 17 test-aio /aio-gsource/bh/schedule --- PASS 27 test-aio /aio-gsource/event/wait/no-flush-cb PASS 13 fdc-test /x86_64/fdc/fuzz-registers MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(( ${RANDOM:-0} % 255 + 1))} QTEST_QEMU_BINARY=x86_64-softmmu/qemu-system-x86_64 QTEST_QEMU_IMG=qemu-img tests/ide-test -m=quick -k --tap < /dev/null | ./scripts/tap-driver.pl --test-name="ide-test" ==7596==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 28 test-aio /aio-gsource/timer/schedule PASS 1 ide-test /x86_64/ide/identify MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(( ${RANDOM:-0} % 255 + 1))} tests/test-aio-multithread -m=quick -k --tap < /dev/null | ./scripts/tap-driver.pl --test-name="test-aio-multithread" ==7605==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 1 test-aio-multithread /aio/multi/lifecycle ==7603==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 2 ide-test /x86_64/ide/flush PASS 2 test-aio-multithread /aio/multi/schedule ==7623==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 3 ide-test /x86_64/ide/bmdma/setup PASS 4 ide-test /x86_64/ide/bmdma/simple_rw PASS 5 ide-test /x86_64/ide/bmdma/trim PASS 6 ide-test /x86_64/ide/bmdma/short_prdt PASS 7 ide-test /x86_64/ide/bmdma/one_sector_short_prdt PASS 8 ide-test /x86_64/ide/bmdma/long_prdt ==7623==WARNING: ASan is ignoring requested __asan_handle_no_return: stack top: 0x7ffc541df000; bottom 0x7f7cd28f9000; size: 0x007f818e6000 (547634438144) False positive error reports may follow For details see https://github.com/google/sanitizers/issues/189 PASS 9 ide-test /x86_64/ide/bmdma/no_busmaster PASS 10 ide-test /x86_64/ide/bmdma/teardown PASS 3 test-aio-multithread /aio/multi/mutex/contended PASS 11 ide-test /x86_64/ide/flush/nodev ==7644==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 12 ide-test /x86_64/ide/flush/empty_drive ==7649==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 13 ide-test /x86_64/ide/flush/retry_pci PASS 4 test-aio-multithread /aio/multi/mutex/handoff ==7655==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 14 ide-test /x86_64/ide/flush/retry_isa PASS 5 test-aio-multithread /aio/multi/mutex/mcs ==7666==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 15 ide-test /x86_64/ide/cdrom/pio PASS 6 test-aio-multithread /aio/multi/mutex/pthread MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(( ${RANDOM:-0} % 255 + 1))} tests/test-throttle -m=quick -k --tap < /dev/null | ./scripts/tap-driver.pl --test-name="test-throttle" ==7677==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! ==7683==WARNING: ASan doesn't