public inbox for ntfs3@lists.linux.dev
 help / color / mirror / Atom feed
* mi_pack_runs() can memmove() too much
@ 2024-01-31 18:42 rtm
  0 siblings, 0 replies; only message in thread
From: rtm @ 2024-01-31 18:42 UTC (permalink / raw)
  To: almaz.alexandrovich; +Cc: ntfs3

[-- Attachment #1: Type: text/plain, Size: 1409 bytes --]

The attached ntfs image causes a Redzone violation when creating a new
file. The problem is that tail is 5 bytes too large in mi_pack_runs():

        u32 tail = used - aoff - asize;
        ...;
        memmove(next + new_run_size - run_size, next + dsize, tail);

Perhaps tail should be adjusted after new_run_size is computed:

        tail -= (new_run_size - run_size);

# uname -a
Linux ubuntu66 6.8.0-rc2-00047-g1bbb19b6eb1b #6 SMP PREEMPT_DYNAMIC Wed Jan 31 13:13:25 EST 2024 x86_64 x86_64 x86_64 GNU/Linux
# while :
> do
> gunzip -c < ntfs11c.img.gz > junk
> mount -t ntfs3 -o loop,rw junk /mnt
> echo z > /mnt/z
> rm /mnt/z
> umount /mnt
> done
...
ntfs3: loop0: ino=0, attr_set_size
ntfs3: loop0: MFT: r=4, expect seq=4 instead of 0!
ntfs3: loop0: Failed to load $AttrDef (-22)
=============================================================================
BUG kmalloc-1k (Not tainted): Right Redzone overwritten
-----------------------------------------------------------------------------

0xffff888120728800-0xffff888120728804 @offset=2048. First byte 0x0 instead of 0xcc
Allocated in mi_init+0x7c/0x110 age=51447 cpu=10 pid=1422
Freed in qlist_free_all+0x56/0x170 age=86843 cpu=2 pid=1
Slab 0xffffea000481ca00 objects=10 used=10 fp=0x0000000000000000 flags=0x2000000
00000840(slab|head|node=0|zone=2)
Object 0xffff888120728400 @offset=1024 fp=0xffff888120729c00

Robert Morris
rtm@csail.mit.edu


[-- Attachment #2: ntfs11c.img.gz --]
[-- Type: application/octet-stream, Size: 124379 bytes --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-01-31 18:42 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-31 18:42 mi_pack_runs() can memmove() too much rtm

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox