ecryptfs returns EINVAL rather than EISDIR on read() on directory
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
eCryptfs |
Fix Released
|
Undecided
|
Tyler Hicks | ||
linux (Ubuntu) |
Fix Released
|
Low
|
Andy Whitcroft | ||
Lucid |
Fix Released
|
Low
|
Colin Ian King |
Bug Description
Binary package hint: linux-generic
When using ecryptfs (the filesystem used for encrypted home directories on Ubuntu by default), attempts to read(2)/read(3) from an open()ed directory return EINVAL, rather than EISDIR. This causes, for example, grep to spit out errors.
Test case:
(on an ecryptfs mount, broken)
$ mkdir foo
$ grep blah foo
grep: foo: Invalid argument
$ strace -fe open,read grep blah foo
[clip]
open("foo", O_RDONLY) = 3
read(3, 0x7fe000, 32768) = -1 EINVAL (Invalid argument)
[clip]
(on ext4, working correctly)
$ mkdir foo
$ grep blah foo
$ strace -fe open,read grep blah foo
[clip]
open("foo", O_RDONLY) = 3
read(3, 0x890000, 32768) = -1 EISDIR (Is a directory)
According to SUSv2, the ecryptfs behavior is indeed incorrect:
[EINVAL]
[OB XSR] [Option Start] The STREAM or multiplexer referenced by fildes is linked (directly or indirectly) downstream from a multiplexer. [Option End]
[EISDIR]
[XSI] [Option Start] The fildes argument refers to a directory and the implementation does not allow the directory to be read using read() or pread(). The readdir() function should be used instead. [Option End]
description: | updated |
affects: | linux-meta (Ubuntu) → linux (Ubuntu) |
Changed in linux (Ubuntu): | |
status: | New → Triaged |
Changed in linux (Ubuntu): | |
assignee: | nobody → Andy Whitcroft (apw) |
status: | Triaged → In Progress |
Changed in linux (Ubuntu Lucid): | |
status: | New → Fix Committed |
Confirmed that this behaviour is present. Seems that ecryptfs is not using the common directory read. Looks to be simple to fix, will spin a patch for testing.