Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce basic tests #2

Merged
merged 5 commits into from
Feb 9, 2024
Merged

Introduce basic tests #2

merged 5 commits into from
Feb 9, 2024

Conversation

d-tatianin
Copy link
Collaborator

No description provided.

@d-tatianin d-tatianin force-pushed the test-support branch 3 times, most recently from e3b9113 to 0aab716 Compare February 8, 2024 22:28
This makes len < 4096 no longer produce an error when attempting to
remap it.

Signed-off-by: Daniil Tatianin <[email protected]>
This runs a few basic read/write + randread/randwrite tests against
libvhost using blkio-bench.

Signed-off-by: Daniil Tatianin <[email protected]>
This is achieved by doing 'ninja test' or 'meson test' in the build
directory.

Signed-off-by: Daniil Tatianin <[email protected]>
@d-tatianin d-tatianin merged commit fa67ad3 into master Feb 9, 2024
5 checks passed
@d-tatianin d-tatianin deleted the test-support branch February 9, 2024 19:39
d-tatianin added a commit that referenced this pull request Feb 12, 2024
Since vhd_vdev_stop_server indirectly releases blockdev via the
bottom-half loop, we would touch the ->vblk.serial field of an already
released bdev struct.

First freed here from the bottom-half, invoked via vhd_unregister_blockdev:
    #0 0x29c9e90 in free /home/arigachnyy/arc/arcadia/contrib/libs/clang14-rt/lib/asan/asan_malloc_linux.cpp:52:3
    #1 0x66815c4 in vhd_free /home/arigachnyy/arc/arcadia/cloud/contrib/vhost/platform.h:169:5
    #2 0x668188f in vblk_free /home/arigachnyy/arc/arcadia/cloud/contrib/vhost/blockdev.c:63:5
    #3 0x666732b in vhd_vdev_release /home/arigachnyy/arc/arcadia/cloud/contrib/vhost/vdev.c:1630:5
    #4 0x6668761 in vdev_drained /home/arigachnyy/arc/arcadia/cloud/contrib/vhost/vdev.c:1816:9
    #5 0x6667e6f in vdev_maybe_finished /home/arigachnyy/arc/arcadia/cloud/contrib/vhost/vdev.c:235:9
    #6 0x6667766 in vdev_stop /home/arigachnyy/arc/arcadia/cloud/contrib/vhost/vdev.c:1994:5
    #7 0x666924f in vdev_work_fn /home/arigachnyy/arc/arcadia/cloud/contrib/vhost/vdev.c:1557:5
    #8 0x666463f in work_bh /home/arigachnyy/arc/arcadia/cloud/contrib/vhost/event.c:540:5
    #9 0x6664b4f in bh_call /home/arigachnyy/arc/arcadia/cloud/contrib/vhost/event.c:165:5
    #10 0x66624bb in bh_poll /home/arigachnyy/arc/arcadia/cloud/contrib/vhost/event.c:192:13
    #11 0x6661f30 in vhd_run_event_loop /home/arigachnyy/arc/arcadia/cloud/contrib/vhost/event.c:351:5
    #12 0x665ebbd in vhost_evloop_func /home/arigachnyy/arc/arcadia/cloud/contrib/vhost/server.c:26:15

bdev->vblk then accessed on the line below vhd_vdev_stop_server causing
a use-after-free:
    #0 0x668321d in virtio_blk_destroy_dev /home/arigachnyy/arc/arcadia/cloud/contrib/vhost/virtio/virtio_blk.c:346:19
    #1 0x668160c in vhd_unregister_blockdev /home/arigachnyy/arc/arcadia/cloud/contrib/vhost/blockdev.c:154:5

Signed-off-by: Daniil Tatianin <[email protected]>
d-tatianin added a commit that referenced this pull request Feb 12, 2024
This fixes a memory sanitizer error:
    ==138663==WARNING: MemorySanitizer: use-of-uninitialized-value

        #0 0x3eaf07e7 in vhd_dequeue_request /-S/cloud/contrib/vhost/server.c:216:9
        #1 0x3f2dc3ab in virtio_session_loop /-S/cloud/filestore/libs/fuse/vhost/fuse_virtio.c:411:16
        #2 0x3f2c9676 in fuse_session_loop /-S/contrib/libs/virtiofsd/fuse_lowlevel.c:2671:12
        #3 0x3f4ebe73 in NCloud::NFileStore::NFuse::(anonymous namespace)::TSessionThread::ThreadProc() /-S/cloud/filestore/libs/fuse/driver.cpp:415:9
        #4 0x107fe36f in void* (anonymous namespace)::ThreadProcWrapper<ISimpleThread>(void*) /-S/util/system/thread.cpp:383:45
        #5 0x10804e9d in (anonymous namespace)::TPosixThread::ThreadProxy(void*) /-S/util/system/thread.cpp:244:20
        #6 0x7faa26a94608 in start_thread /build/glibc-SzIz7B/glibc-2.31/nptl/pthread_create.c:477:8
        #7 0x7faa269b9132 in __clone /build/glibc-SzIz7B/glibc-2.31/misc/../sysdeps/unix/sysv/linux/x86_64/clone.S:95

    SUMMARY: MemorySanitizer: use-of-uninitialized-value /-S/cloud/contrib/vhost/server.c:216:9 in vhd_dequeue_request
    Exiting

Signed-off-by: Daniil Tatianin <[email protected]>
d-tatianin added a commit that referenced this pull request Feb 12, 2024
Since vhd_vdev_stop_server indirectly releases blockdev via the
bottom-half loop, we would touch the ->vblk.serial field of an already
released bdev struct.

First freed here from the bottom-half, invoked via vhd_unregister_blockdev:
    #0 0x29c9e90 in free /home/arigachnyy/arc/arcadia/contrib/libs/clang14-rt/lib/asan/asan_malloc_linux.cpp:52:3
    #1 0x66815c4 in vhd_free /home/arigachnyy/arc/arcadia/cloud/contrib/vhost/platform.h:169:5
    #2 0x668188f in vblk_free /home/arigachnyy/arc/arcadia/cloud/contrib/vhost/blockdev.c:63:5
    #3 0x666732b in vhd_vdev_release /home/arigachnyy/arc/arcadia/cloud/contrib/vhost/vdev.c:1630:5
    #4 0x6668761 in vdev_drained /home/arigachnyy/arc/arcadia/cloud/contrib/vhost/vdev.c:1816:9
    #5 0x6667e6f in vdev_maybe_finished /home/arigachnyy/arc/arcadia/cloud/contrib/vhost/vdev.c:235:9
    #6 0x6667766 in vdev_stop /home/arigachnyy/arc/arcadia/cloud/contrib/vhost/vdev.c:1994:5
    #7 0x666924f in vdev_work_fn /home/arigachnyy/arc/arcadia/cloud/contrib/vhost/vdev.c:1557:5
    #8 0x666463f in work_bh /home/arigachnyy/arc/arcadia/cloud/contrib/vhost/event.c:540:5
    #9 0x6664b4f in bh_call /home/arigachnyy/arc/arcadia/cloud/contrib/vhost/event.c:165:5
    #10 0x66624bb in bh_poll /home/arigachnyy/arc/arcadia/cloud/contrib/vhost/event.c:192:13
    #11 0x6661f30 in vhd_run_event_loop /home/arigachnyy/arc/arcadia/cloud/contrib/vhost/event.c:351:5
    #12 0x665ebbd in vhost_evloop_func /home/arigachnyy/arc/arcadia/cloud/contrib/vhost/server.c:26:15

bdev->vblk then accessed on the line below vhd_vdev_stop_server causing
a use-after-free:
    #0 0x668321d in virtio_blk_destroy_dev /home/arigachnyy/arc/arcadia/cloud/contrib/vhost/virtio/virtio_blk.c:346:19
    #1 0x668160c in vhd_unregister_blockdev /home/arigachnyy/arc/arcadia/cloud/contrib/vhost/blockdev.c:154:5

Signed-off-by: Daniil Tatianin <[email protected]>
d-tatianin added a commit that referenced this pull request Feb 12, 2024
This fixes a memory sanitizer error:
    ==138663==WARNING: MemorySanitizer: use-of-uninitialized-value

        #0 0x3eaf07e7 in vhd_dequeue_request /-S/cloud/contrib/vhost/server.c:216:9
        #1 0x3f2dc3ab in virtio_session_loop /-S/cloud/filestore/libs/fuse/vhost/fuse_virtio.c:411:16
        #2 0x3f2c9676 in fuse_session_loop /-S/contrib/libs/virtiofsd/fuse_lowlevel.c:2671:12
        #3 0x3f4ebe73 in NCloud::NFileStore::NFuse::(anonymous namespace)::TSessionThread::ThreadProc() /-S/cloud/filestore/libs/fuse/driver.cpp:415:9
        #4 0x107fe36f in void* (anonymous namespace)::ThreadProcWrapper<ISimpleThread>(void*) /-S/util/system/thread.cpp:383:45
        #5 0x10804e9d in (anonymous namespace)::TPosixThread::ThreadProxy(void*) /-S/util/system/thread.cpp:244:20
        #6 0x7faa26a94608 in start_thread /build/glibc-SzIz7B/glibc-2.31/nptl/pthread_create.c:477:8
        #7 0x7faa269b9132 in __clone /build/glibc-SzIz7B/glibc-2.31/misc/../sysdeps/unix/sysv/linux/x86_64/clone.S:95

    SUMMARY: MemorySanitizer: use-of-uninitialized-value /-S/cloud/contrib/vhost/server.c:216:9 in vhd_dequeue_request
    Exiting

Signed-off-by: Daniil Tatianin <[email protected]>
d-tatianin added a commit that referenced this pull request Feb 12, 2024
Since vhd_vdev_stop_server indirectly releases blockdev via the
bottom-half loop, we would touch the ->vblk.serial field of an already
released bdev struct.

First freed here from the bottom-half, invoked via vhd_unregister_blockdev:
    #0 0x29c9e90 in free /home/arigachnyy/arc/arcadia/contrib/libs/clang14-rt/lib/asan/asan_malloc_linux.cpp:52:3
    #1 0x66815c4 in vhd_free /home/arigachnyy/arc/arcadia/cloud/contrib/vhost/platform.h:169:5
    #2 0x668188f in vblk_free /home/arigachnyy/arc/arcadia/cloud/contrib/vhost/blockdev.c:63:5
    #3 0x666732b in vhd_vdev_release /home/arigachnyy/arc/arcadia/cloud/contrib/vhost/vdev.c:1630:5
    #4 0x6668761 in vdev_drained /home/arigachnyy/arc/arcadia/cloud/contrib/vhost/vdev.c:1816:9
    #5 0x6667e6f in vdev_maybe_finished /home/arigachnyy/arc/arcadia/cloud/contrib/vhost/vdev.c:235:9
    #6 0x6667766 in vdev_stop /home/arigachnyy/arc/arcadia/cloud/contrib/vhost/vdev.c:1994:5
    #7 0x666924f in vdev_work_fn /home/arigachnyy/arc/arcadia/cloud/contrib/vhost/vdev.c:1557:5
    #8 0x666463f in work_bh /home/arigachnyy/arc/arcadia/cloud/contrib/vhost/event.c:540:5
    #9 0x6664b4f in bh_call /home/arigachnyy/arc/arcadia/cloud/contrib/vhost/event.c:165:5
    #10 0x66624bb in bh_poll /home/arigachnyy/arc/arcadia/cloud/contrib/vhost/event.c:192:13
    #11 0x6661f30 in vhd_run_event_loop /home/arigachnyy/arc/arcadia/cloud/contrib/vhost/event.c:351:5
    #12 0x665ebbd in vhost_evloop_func /home/arigachnyy/arc/arcadia/cloud/contrib/vhost/server.c:26:15

bdev->vblk then accessed on the line below vhd_vdev_stop_server causing
a use-after-free:
    #0 0x668321d in virtio_blk_destroy_dev /home/arigachnyy/arc/arcadia/cloud/contrib/vhost/virtio/virtio_blk.c:346:19
    #1 0x668160c in vhd_unregister_blockdev /home/arigachnyy/arc/arcadia/cloud/contrib/vhost/blockdev.c:154:5

Signed-off-by: Daniil Tatianin <[email protected]>
d-tatianin added a commit that referenced this pull request Feb 12, 2024
This fixes a memory sanitizer error:
    ==138663==WARNING: MemorySanitizer: use-of-uninitialized-value

        #0 0x3eaf07e7 in vhd_dequeue_request /-S/cloud/contrib/vhost/server.c:216:9
        #1 0x3f2dc3ab in virtio_session_loop /-S/cloud/filestore/libs/fuse/vhost/fuse_virtio.c:411:16
        #2 0x3f2c9676 in fuse_session_loop /-S/contrib/libs/virtiofsd/fuse_lowlevel.c:2671:12
        #3 0x3f4ebe73 in NCloud::NFileStore::NFuse::(anonymous namespace)::TSessionThread::ThreadProc() /-S/cloud/filestore/libs/fuse/driver.cpp:415:9
        #4 0x107fe36f in void* (anonymous namespace)::ThreadProcWrapper<ISimpleThread>(void*) /-S/util/system/thread.cpp:383:45
        #5 0x10804e9d in (anonymous namespace)::TPosixThread::ThreadProxy(void*) /-S/util/system/thread.cpp:244:20
        #6 0x7faa26a94608 in start_thread /build/glibc-SzIz7B/glibc-2.31/nptl/pthread_create.c:477:8
        #7 0x7faa269b9132 in __clone /build/glibc-SzIz7B/glibc-2.31/misc/../sysdeps/unix/sysv/linux/x86_64/clone.S:95

    SUMMARY: MemorySanitizer: use-of-uninitialized-value /-S/cloud/contrib/vhost/server.c:216:9 in vhd_dequeue_request
    Exiting

Signed-off-by: Daniil Tatianin <[email protected]>
d-tatianin added a commit that referenced this pull request Feb 16, 2024
Since vhd_vdev_stop_server indirectly releases blockdev via the
bottom-half loop, we would touch the ->vblk.serial field of an already
released bdev struct.

First freed here from the bottom-half, invoked via vhd_unregister_blockdev:
    #0 0x29c9e90 in free /home/arigachnyy/arc/arcadia/contrib/libs/clang14-rt/lib/asan/asan_malloc_linux.cpp:52:3
    #1 0x66815c4 in vhd_free /home/arigachnyy/arc/arcadia/cloud/contrib/vhost/platform.h:169:5
    #2 0x668188f in vblk_free /home/arigachnyy/arc/arcadia/cloud/contrib/vhost/blockdev.c:63:5
    #3 0x666732b in vhd_vdev_release /home/arigachnyy/arc/arcadia/cloud/contrib/vhost/vdev.c:1630:5
    #4 0x6668761 in vdev_drained /home/arigachnyy/arc/arcadia/cloud/contrib/vhost/vdev.c:1816:9
    #5 0x6667e6f in vdev_maybe_finished /home/arigachnyy/arc/arcadia/cloud/contrib/vhost/vdev.c:235:9
    #6 0x6667766 in vdev_stop /home/arigachnyy/arc/arcadia/cloud/contrib/vhost/vdev.c:1994:5
    #7 0x666924f in vdev_work_fn /home/arigachnyy/arc/arcadia/cloud/contrib/vhost/vdev.c:1557:5
    #8 0x666463f in work_bh /home/arigachnyy/arc/arcadia/cloud/contrib/vhost/event.c:540:5
    #9 0x6664b4f in bh_call /home/arigachnyy/arc/arcadia/cloud/contrib/vhost/event.c:165:5
    #10 0x66624bb in bh_poll /home/arigachnyy/arc/arcadia/cloud/contrib/vhost/event.c:192:13
    #11 0x6661f30 in vhd_run_event_loop /home/arigachnyy/arc/arcadia/cloud/contrib/vhost/event.c:351:5
    #12 0x665ebbd in vhost_evloop_func /home/arigachnyy/arc/arcadia/cloud/contrib/vhost/server.c:26:15

bdev->vblk then accessed on the line below vhd_vdev_stop_server causing
a use-after-free:
    #0 0x668321d in virtio_blk_destroy_dev /home/arigachnyy/arc/arcadia/cloud/contrib/vhost/virtio/virtio_blk.c:346:19
    #1 0x668160c in vhd_unregister_blockdev /home/arigachnyy/arc/arcadia/cloud/contrib/vhost/blockdev.c:154:5

Signed-off-by: Daniil Tatianin <[email protected]>
d-tatianin added a commit that referenced this pull request Feb 16, 2024
This fixes a memory sanitizer error:
    ==138663==WARNING: MemorySanitizer: use-of-uninitialized-value

        #0 0x3eaf07e7 in vhd_dequeue_request /-S/cloud/contrib/vhost/server.c:216:9
        #1 0x3f2dc3ab in virtio_session_loop /-S/cloud/filestore/libs/fuse/vhost/fuse_virtio.c:411:16
        #2 0x3f2c9676 in fuse_session_loop /-S/contrib/libs/virtiofsd/fuse_lowlevel.c:2671:12
        #3 0x3f4ebe73 in NCloud::NFileStore::NFuse::(anonymous namespace)::TSessionThread::ThreadProc() /-S/cloud/filestore/libs/fuse/driver.cpp:415:9
        #4 0x107fe36f in void* (anonymous namespace)::ThreadProcWrapper<ISimpleThread>(void*) /-S/util/system/thread.cpp:383:45
        #5 0x10804e9d in (anonymous namespace)::TPosixThread::ThreadProxy(void*) /-S/util/system/thread.cpp:244:20
        #6 0x7faa26a94608 in start_thread /build/glibc-SzIz7B/glibc-2.31/nptl/pthread_create.c:477:8
        #7 0x7faa269b9132 in __clone /build/glibc-SzIz7B/glibc-2.31/misc/../sysdeps/unix/sysv/linux/x86_64/clone.S:95

    SUMMARY: MemorySanitizer: use-of-uninitialized-value /-S/cloud/contrib/vhost/server.c:216:9 in vhd_dequeue_request
    Exiting

Signed-off-by: Daniil Tatianin <[email protected]>
d-tatianin added a commit that referenced this pull request Feb 28, 2024
Since vhd_vdev_stop_server indirectly releases blockdev via the
bottom-half loop, we would touch the ->vblk.serial field of an already
released bdev struct.

First freed here from the bottom-half, invoked via vhd_unregister_blockdev:
    #0 0x29c9e90 in free /home/arigachnyy/arc/arcadia/contrib/libs/clang14-rt/lib/asan/asan_malloc_linux.cpp:52:3
    #1 0x66815c4 in vhd_free /home/arigachnyy/arc/arcadia/cloud/contrib/vhost/platform.h:169:5
    #2 0x668188f in vblk_free /home/arigachnyy/arc/arcadia/cloud/contrib/vhost/blockdev.c:63:5
    #3 0x666732b in vhd_vdev_release /home/arigachnyy/arc/arcadia/cloud/contrib/vhost/vdev.c:1630:5
    #4 0x6668761 in vdev_drained /home/arigachnyy/arc/arcadia/cloud/contrib/vhost/vdev.c:1816:9
    #5 0x6667e6f in vdev_maybe_finished /home/arigachnyy/arc/arcadia/cloud/contrib/vhost/vdev.c:235:9
    #6 0x6667766 in vdev_stop /home/arigachnyy/arc/arcadia/cloud/contrib/vhost/vdev.c:1994:5
    #7 0x666924f in vdev_work_fn /home/arigachnyy/arc/arcadia/cloud/contrib/vhost/vdev.c:1557:5
    #8 0x666463f in work_bh /home/arigachnyy/arc/arcadia/cloud/contrib/vhost/event.c:540:5
    #9 0x6664b4f in bh_call /home/arigachnyy/arc/arcadia/cloud/contrib/vhost/event.c:165:5
    #10 0x66624bb in bh_poll /home/arigachnyy/arc/arcadia/cloud/contrib/vhost/event.c:192:13
    #11 0x6661f30 in vhd_run_event_loop /home/arigachnyy/arc/arcadia/cloud/contrib/vhost/event.c:351:5
    #12 0x665ebbd in vhost_evloop_func /home/arigachnyy/arc/arcadia/cloud/contrib/vhost/server.c:26:15

bdev->vblk then accessed on the line below vhd_vdev_stop_server causing
a use-after-free:
    #0 0x668321d in virtio_blk_destroy_dev /home/arigachnyy/arc/arcadia/cloud/contrib/vhost/virtio/virtio_blk.c:346:19
    #1 0x668160c in vhd_unregister_blockdev /home/arigachnyy/arc/arcadia/cloud/contrib/vhost/blockdev.c:154:5

Signed-off-by: Daniil Tatianin <[email protected]>
d-tatianin added a commit that referenced this pull request Feb 28, 2024
This fixes a memory sanitizer error:
    ==138663==WARNING: MemorySanitizer: use-of-uninitialized-value

        #0 0x3eaf07e7 in vhd_dequeue_request /-S/cloud/contrib/vhost/server.c:216:9
        #1 0x3f2dc3ab in virtio_session_loop /-S/cloud/filestore/libs/fuse/vhost/fuse_virtio.c:411:16
        #2 0x3f2c9676 in fuse_session_loop /-S/contrib/libs/virtiofsd/fuse_lowlevel.c:2671:12
        #3 0x3f4ebe73 in NCloud::NFileStore::NFuse::(anonymous namespace)::TSessionThread::ThreadProc() /-S/cloud/filestore/libs/fuse/driver.cpp:415:9
        #4 0x107fe36f in void* (anonymous namespace)::ThreadProcWrapper<ISimpleThread>(void*) /-S/util/system/thread.cpp:383:45
        #5 0x10804e9d in (anonymous namespace)::TPosixThread::ThreadProxy(void*) /-S/util/system/thread.cpp:244:20
        #6 0x7faa26a94608 in start_thread /build/glibc-SzIz7B/glibc-2.31/nptl/pthread_create.c:477:8
        #7 0x7faa269b9132 in __clone /build/glibc-SzIz7B/glibc-2.31/misc/../sysdeps/unix/sysv/linux/x86_64/clone.S:95

    SUMMARY: MemorySanitizer: use-of-uninitialized-value /-S/cloud/contrib/vhost/server.c:216:9 in vhd_dequeue_request
    Exiting

Signed-off-by: Daniil Tatianin <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant