https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=252488

            Bug ID: 252488
           Summary: bsdtar fails to work with 128k blocksize
           Product: Base System
           Version: 11.4-STABLE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: bin
          Assignee: b...@freebsd.org
          Reporter: m...@fbsd2.e4m.org

Prerequisites: tape written with 128k block size, mt blocksize 131072

bsdtar -tf /dev/sa0 -b 256

gives

sa0: request ptr 0x2888ed80 is not on a page boundary; cannot split request
bsdtar: Error opening archive: Error reading '/dev/sa0'

This seems to be an alignment problem. The problem goes away after aligning
the buffer in archive_read_open_filename.c:

--- archive_read_open_filename.c.ORI   2020-03-13 08:22:53.000000000 +0100
+++ archive_read_open_filename.c       2021-01-06 10:37:34.176333000 +0100
@@ -359,12 +359,17 @@
                        new_block_size *= 2;
                mine->block_size = new_block_size;
        }
+#if 0
        buffer = malloc(mine->block_size);
+#else
+       buffer = malloc(mine->block_size + 4096);
+#endif
        if (buffer == NULL) {
                archive_set_error(a, ENOMEM, "No memory");
                goto fail;
        }
        mine->buffer = buffer;
+       mine->buffer = (void*)(((u_int32_t)buffer + 4096) & ~4095);
        mine->fd = fd;
        /* Remember mode so close can decide whether to flush. */
        mine->st_mode = st.st_mode;


This is NO patch to fix the issue -- it's just to show the origin of the
problem . A proper patch will probably use PAGESIZE and distinguish between
malloc start and aligned buffer (so it can bee free()ed).

-- 
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
freebsd-bugs@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-bugs
To unsubscribe, send any mail to "freebsd-bugs-unsubscr...@freebsd.org"

Reply via email to