Skip to content

linuxulator: improve getxattr() error handling#2263

Open
ilovegrape wants to merge 1 commit into
freebsd:mainfrom
ilovegrape:getxattr-fix
Open

linuxulator: improve getxattr() error handling#2263
ilovegrape wants to merge 1 commit into
freebsd:mainfrom
ilovegrape:getxattr-fix

Conversation

@ilovegrape

Copy link
Copy Markdown
Contributor
  • Return ERANGE for short getxattr buffers: when the caller provides a buffer smaller than the xattr value, linux_getxattr() and linux_lgetxattr() should set the return value to the full size of the attribute and return ERANGE, matching Linux behavior. This fixes the LTP getxattr01 test.
  • Return ENODATA for getxattr on unsupported file types: for file types that do not support extended attributes (fifo, char device, block device, UNIX domain socket), the FreeBSD VFS layer returns EOPNOTSUPP via vop_eopnotsupp(). Map this to ENOATTR so that the Linux errno translation produces ENODATA (61), matching Linux behavior. This fixes the LTP getxattr02 test.

- Return ERANGE for short getxattr buffers: when the caller provides
  a buffer smaller than the xattr value, linux_getxattr() and
  linux_lgetxattr() should set the return value to the full size of
  the attribute and return ERANGE, matching Linux behavior. This
  fixes the LTP getxattr01 test.
- Return ENODATA for getxattr on unsupported file types: for file
  types that do not support extended attributes (fifo, char device,
  block device, UNIX domain socket), the FreeBSD VFS layer returns
  EOPNOTSUPP via vop_eopnotsupp(). Map this to ENOATTR so that the
  Linux errno translation produces ENODATA (61), matching Linux
  behavior. This fixes the LTP getxattr02 test.

Signed-off-by: YAO, Xin <mr.yaoxin@outlook.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant