| Summary: | extattr(2) doesn't allow attribute names of length EXTATTR_MAXNAMELEN | ||
|---|---|---|---|
| Product: | Base System | Reporter: | Alan Somers <asomers> |
| Component: | kern | Assignee: | Conrad Meyer <cem> |
| Status: | Closed FIXED | ||
| Severity: | Affects Many People | CC: | amd64, ngie |
| Priority: | --- | Keywords: | patch |
| Version: | CURRENT | ||
| Hardware: | Any | ||
| OS: | Any | ||
|
Description
Alan Somers
2016-04-21 22:21:20 UTC
(related to https://reviews.freebsd.org/D5889). I believe this is due to copyinstr(), which works with NUL-terminated strings (and lengths), while the stack buffer in sys_extattr_set_fd(), etc, are only sized to EXTATTR_MAXNAMELEN. To fix this I think we just need to size the buffers one larger to allow for the trailing NUL copyinstr expects. FWIW, UFS_EXTATTR only disables the crummy extattrs in UFS1. UFS2 extattrs are not controlled by that knob. https://reviews.freebsd.org/D24584 is a proposed patch; it compiles but I have not tested it. A commit references this bug: Author: cem Date: Thu May 14 03:01:24 UTC 2020 New revision: 361021 URL: https://svnweb.freebsd.org/changeset/base/361021 Log: vfs_extattr: Allow extattr names up to the full max Extattr names are allowed to be 255 bytes -- not 254 bytes plus trailing NUL. Provide a 256 buffer so that copyinstr() has room for the trailing NUL. Re-enable test for maximal name lengths. PR: 208965 Reported by: asomers Reviewed by: asomers Differential Revision: https://reviews.freebsd.org/D24584 Changes: head/sys/kern/vfs_extattr.c head/usr.sbin/extattr/tests/extattr_test.sh |