Skip to content
  • Denis V. Lunev's avatar
    e5b815b0
    qemu-nbd: regression with arguments passing into nbd_client_thread() · e5b815b0
    Denis V. Lunev authored
    
    
    Unfortunately
        commit 03b67621
        Author: Denis V. Lunev <den@openvz.org>
        Date:   Mon Jul 17 16:55:40 2023 +0200
        qemu-nbd: pass structure into nbd_client_thread instead of plain char*
    has introduced a regression. struct NbdClientOpts resides on stack inside
    'if' block. This specifically means that this stack space could be reused
    once the execution will leave that block of the code.
    
    This means that parameters passed into nbd_client_thread could be
    overwritten at any moment.
    
    The patch moves the data to the namespace of main() function effectively
    preserving it for the whole process lifetime.
    
    Signed-off-by: default avatarDenis V. Lunev <den@openvz.org>
    CC: Eric Blake <eblake@redhat.com>
    CC: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
    CC: <qemu-stable@nongnu.org>
    Reviewed-by: default avatarEric Blake <eblake@redhat.com>
    Message-ID: <20230727105828.324314-1-den@openvz.org>
    Signed-off-by: default avatarEric Blake <eblake@redhat.com>
    e5b815b0
    qemu-nbd: regression with arguments passing into nbd_client_thread()
    Denis V. Lunev authored
    
    
    Unfortunately
        commit 03b67621
        Author: Denis V. Lunev <den@openvz.org>
        Date:   Mon Jul 17 16:55:40 2023 +0200
        qemu-nbd: pass structure into nbd_client_thread instead of plain char*
    has introduced a regression. struct NbdClientOpts resides on stack inside
    'if' block. This specifically means that this stack space could be reused
    once the execution will leave that block of the code.
    
    This means that parameters passed into nbd_client_thread could be
    overwritten at any moment.
    
    The patch moves the data to the namespace of main() function effectively
    preserving it for the whole process lifetime.
    
    Signed-off-by: default avatarDenis V. Lunev <den@openvz.org>
    CC: Eric Blake <eblake@redhat.com>
    CC: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
    CC: <qemu-stable@nongnu.org>
    Reviewed-by: default avatarEric Blake <eblake@redhat.com>
    Message-ID: <20230727105828.324314-1-den@openvz.org>
    Signed-off-by: default avatarEric Blake <eblake@redhat.com>
Loading