https://bugs.kde.org/show_bug.cgi?id=471222

Alexandra Hajkova <ahajk...@redhat.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
 Attachment #166151|0                           |1
        is obsolete|                            |

--- Comment #11 from Alexandra Hajkova <ahajk...@redhat.com> ---
Created attachment 166427
  --> https://bugs.kde.org/attachment.cgi?id=166427&action=edit
patch

A new version with more test cases added and more explanatory commit message:

syswrap-generic.c: Warn when file descriptor

    is closed the second time.

    We moved the record_fd_close call from POST to PRE sys_close handler,
    because the POST handler is only called on success. Even if the close
    syscall fails the file descriptor is still really closed/invalid.
    In the PRE handler the file descriptor is about to be closed, but hasn't
    been yet so we can capture also the description.

    This patch add new field fd_closed to OpenFd structure to record if
    the file descriptor was already closed.

    We now capture a backtrace when closing file descriptors to be able to
    print it in a case of a double close.  Always add '<' brackets '>' around
    "unbound" in the description for consistency.

    getsockdetails now takes and returns a buffer describing the socket
    because we want to record it, not just print it.

    Note that close_range is handled similar to closing each descriptor
    individually. But the case when the close_range is called with an
    infinite endis treated special. Add a new record_fd_close_range
    function which handles close_range with an infinite end so double
    close by close_range isn't an error because we don't want to loop
    over such a wide range.

    Add a new test cases:
     - none/tests/socket_close.vgtest - tests double closing a socket
     - none/tests/double_close_range.vgtest - uses close_range to double close
the file descriptors
     - none/tests/file_dclose.vgtest - double closing regular file with regular
close syscall

    https://bugs.kde.org/show_bug.cgi?id=471222

    Co-Authored-By: Mark Wielaard <m...@klomp.org>

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to