You are not logged in.

#1 2024-04-12 21:47:28

coolreader18
Member
Registered: 2021-04-12
Posts: 4

exfat write() fails with EFAULT when the write size is zero

I have a drive mounted in /media with the options `rw,sync,noatime,noauto,user,exec`. Writing to any file in that filesystem with an empty buffer fails with "bad address":

>>> open("foo", "wb", buffering=0).write(b"")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
OSError: [Errno 14] Bad address

Is anyone else experiencing this? Or can reproduce? I figure this is probably a kernel bug but I don't know what would even be causing it, based on a very cursory glance at the fs-exfat source code.

Offline

#2 2024-04-14 19:54:16

O239
Member
Registered: 2024-03-01
Posts: 7

Re: exfat write() fails with EFAULT when the write size is zero

I can reproduce this on my exfat-formatted flash drive.

Offline

#3 2024-12-12 23:24:06

notpeter
Member
Registered: 2024-12-12
Posts: 2

Re: exfat write() fails with EFAULT when the write size is zero

I am also able to reproduce this on Ubuntu Linux with an exFAT volume mounted from a file (no usb stick required).

mkdir /tmp/exfat
cd $_
fallocate -l 512M exfat.img
mkfs.exfat exfat.img
sudo mkdir -p /fatimagedir/
sudo mount -o umask=0022,gid=$(id -g),uid=$(id -u) /tmp/exfat/exfat.img /fatimagedir/
cd /fatimagedir
python3 -c 'open("foo", "wb", buffering=0).write(b"")'

Thanks for the simple repro steps @coolreader18.

I very much appreciate it.
See also: https://github.com/zed-industries/zed/issues/21595

Offline

#4 2024-12-13 10:12:17

xerxes_
Member
Registered: 2018-04-29
Posts: 1,055

Re: exfat write() fails with EFAULT when the write size is zero

What kernel version do you use?

Offline

#5 2024-12-13 18:42:54

notpeter
Member
Registered: 2024-12-12
Posts: 2

Re: exfat write() fails with EFAULT when the write size is zero

Stock Ubuntu 24.04

6.8.0-48-generic on x86_64

Last edited by notpeter (2024-12-13 18:43:26)

Offline

#6 2024-12-13 21:16:54

xerxes_
Member
Registered: 2018-04-29
Posts: 1,055

Re: exfat write() fails with EFAULT when the write size is zero

That kernel is old, from Ubuntu and probably unsupported on Arch. Try current kernel on current Arch Linux!

Offline

#7 2024-12-14 09:38:21

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 75,153

Re: exfat write() fails with EFAULT when the write size is zero

Tbf, this is also an older thread wink

Has anyone filed a bug at https://github.com/relan/exfat/issues ?
Doesn't seem to affect ntfs-3g, so probably not a fusermount thing.

Offline

Board footer

Powered by FluxBB