The commit is pushed to "branch-rh10-6.12.0-211.16.1.12.x.vz10-ovz" and will 
appear at [email protected]:openvz/vzkernel.git
after rh10-6.12.0-211.16.1.12.5.vz10
------>
commit 7f409e84ccc38ad62a0ad6f8f8d8ae39e609215c
Author: Eva Kurchatova <[email protected]>
Date:   Thu Jun 25 01:42:45 2026 +0300

    selftests/filelock: zero-initialize struct flock
    
    The ofdlocks test installs an OFD read lock at offset 5..7 and then
    issues two F_OFD_GETLK queries (one starting at offset 5 with length 1,
    one starting at offset 0 with length 0) expecting them to report the
    same lock. It then compares the two struct flock results with memcmp().
    
    Because 'fl' and 'fl2' live on the stack and are only partially
    initialized by the caller (l_type, l_whence, l_start, l_len, l_pid),
    the implicit padding bytes that 'struct flock' has on x86_64 are left
    with whatever happens to be on the stack. The kernel does not touch
    those padding bytes on the F_OFD_GETLK return path, so memcmp() of the
    full sizeof(struct flock) compares uninitialized padding from two
    different stack frames and intermittently reports them as different:
    
      [SUCCESS] F_UNLCK test returns: locked, type 0 pid -1 len 3
      [FAIL]    F_UNLCK test returns: locked, type 0 pid -1 len 3
    
    i.e. the printed fields are identical but memcmp() still fails.
    
    Zero-initialize both structs at declaration so the padding is
    deterministic and the comparison is meaningful.
    
    https://virtuozzo.atlassian.net/browse/VSTOR-134203
    Reviewed-by: Pavel Tikhomirov <[email protected]>
    Signed-off-by: Eva Kurchatova <[email protected]>
    Feature: fix selftests
---
 tools/testing/selftests/filelock/ofdlocks.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/filelock/ofdlocks.c 
b/tools/testing/selftests/filelock/ofdlocks.c
index a55b79810ab20..101bbe10df240 100644
--- a/tools/testing/selftests/filelock/ofdlocks.c
+++ b/tools/testing/selftests/filelock/ofdlocks.c
@@ -35,7 +35,7 @@ static int lock_get(int fd, struct flock *fl)
 int main(void)
 {
        int rc;
-       struct flock fl, fl2;
+       struct flock fl = {0}, fl2 = {0};
        int fd = open("/tmp/aa", O_RDWR | O_CREAT | O_EXCL, 0600);
        int fd2 = open("/tmp/aa", O_RDONLY);
 
_______________________________________________
Devel mailing list
[email protected]
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to