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

munmap_chunk(): invalid pointer #191

Closed
Nikratio opened this issue Jul 17, 2022 · 2 comments
Closed

munmap_chunk(): invalid pointer #191

Nikratio opened this issue Jul 17, 2022 · 2 comments

Comments

@Nikratio
Copy link
Contributor

Hi,

This is with s3backer compiled from commit 52b36f7:

# nbdkit --unix /tmp/tmpfmhnbd9z/nbd_socket_sb2 --foreground --filter=exitlast --filter=stats --threads 16 --filter=retry s3backer size=50G bucket=nikratio-backup/sb2 region=eu-west-2 statsfile=/home/nikratio/tmp/buckets/nikratio-backup_sb2_stats.txt statsappend=true retries=100 retry-readonly=false retry-delay=30 retry-exponential=no blockSize=32K &
nbdkit: auto-detecting block size and total file size...
nbdkit: auto-detection failed; using configured block size 32k and file size 50g
2022-07-17 12:37:32 INFO: established new mount token 0x1b65667f
2022-07-17 12:37:32 INFO: mounting nikratio-backup

# nbd-client -unix /tmp/tmpfmhnbd9z/nbd_socket_sb2 --timeout 604800 /dev/nbd0
Warning: the oldstyle protocol is no longer supported.
This method now uses the newstyle protocol with a default export
Negotiation: ..size = 51200MB
Connected /dev/nbd0

# mkfs.ext4 /dev/nbd0
mke2fs 1.46.2 (28-Feb-2021)
munmap_chunk(): invalid pointer
[ hanging process ]
@Nikratio
Copy link
Contributor Author

With Valgrind:

valgrind -- nbdkit --unix /tmp/tmpuv5vkhvu/nbd_socket_sb2 --foreground --filter=exitlast --filter=stats --threads 1 --filter=retry s3backer size=50G bucket=nikratio-backup/sb2 region=eu-west-2 statsfile=/home/nikratio/tmp/buckets/nikratio-backup_sb2_stats.txt statsappend=true s3b_force=true retries=100 retry-readonly=false retry-delay=30 retry-exponential=no blockSize=32K
==248534== Memcheck, a memory error detector
==248534== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==248534== Using Valgrind-3.18.1 and LibVEX; rerun with -h for copyright info
==248534== Command: nbdkit --unix /tmp/tmpuv5vkhvu/nbd_socket_sb2 --foreground --filter=exitlast --filter=stats --threads 1 --filter=retry s3backer size=50G bucket=nikratio-backup/sb2 region=eu-west-2 statsfile=/home/nikratio/tmp/buckets/nikratio-backup_sb2_stats.txt statsappend=true s3b_force=true retries=100 retry-readonly=false retry-delay=30 retry-exponential=no blockSize=32K
==248534== 
nbdkit: auto-detecting block size and total file size...
nbdkit: auto-detection failed; using configured block size 32k and file size 50g
nbdkit: warning: filesystem appears already mounted but you said `--force'
 so I'll proceed anyway even though your data may get corrupted.

2022-07-17 12:50:20 INFO: established new mount token 0x035adf99
2022-07-17 12:50:20 INFO: mounting nikratio-backup

==248534== Thread 22:
==248534== Invalid free() / delete / delete[] / realloc()
==248534==    at 0xC9650FB: free (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==248534==    by 0xD05A5B1: zero_cache_bulk_zero (zero_cache.c:540)
==248534==    by 0xD054405: s3b_nbd_plugin_trim (nbdkit.c:426)
==248534==    by 0x11506D: plugin_trim (plugins.c:737)
==248534==    by 0x10F41A: backend_trim (backend.c:699)
==248534==    by 0xC9758D0: retry_trim (retry.c:333)
==248534==    by 0x10F41A: backend_trim (backend.c:699)
==248534==    by 0xC97D72F: stats_trim(nbdkit_next_ops*, void*, unsigned int, unsigned long, unsigned int, int*) (stats.cpp:526)
==248534==    by 0x10F41A: backend_trim (backend.c:699)
==248534==    by 0x10F41A: backend_trim (backend.c:699)
==248534==    by 0x1162B3: handle_request (protocol.c:262)
==248534==    by 0x1162B3: protocol_recv_request_send_reply (protocol.c:716)
==248534==    by 0x1112A1: handle_single_connection (connections.c:181)
==248534==  Address 0x19935084 is 2,004 bytes inside a block of size 2,048 alloc'd
==248534==    at 0xC9627B5: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==248534==    by 0xD05A519: zero_cache_bulk_zero (zero_cache.c:504)
==248534==    by 0xD054405: s3b_nbd_plugin_trim (nbdkit.c:426)
==248534==    by 0x11506D: plugin_trim (plugins.c:737)
==248534==    by 0x10F41A: backend_trim (backend.c:699)
==248534==    by 0xC9758D0: retry_trim (retry.c:333)
==248534==    by 0x10F41A: backend_trim (backend.c:699)
==248534==    by 0xC97D72F: stats_trim(nbdkit_next_ops*, void*, unsigned int, unsigned long, unsigned int, int*) (stats.cpp:526)
==248534==    by 0x10F41A: backend_trim (backend.c:699)
==248534==    by 0x10F41A: backend_trim (backend.c:699)
==248534==    by 0x1162B3: handle_request (protocol.c:262)
==248534==    by 0x1162B3: protocol_recv_request_send_reply (protocol.c:716)
==248534==    by 0x1112A1: handle_single_connection (connections.c:181)
==248534== 

@archiecobbs
Copy link
Owner

Argh, stupid bug on my part. Thanks for the valgrind info which made this easy to fix.

Should be fixed by d6fb1d4.

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

No branches or pull requests

2 participants