Home | History | Annotate | Download | only in kern
History log of /src/sys/kern/vfs_xattr.c
RevisionDateAuthorComments
 1.41  07-Dec-2024  riastradh vfs(9): Sprinkle SET_ERROR dtrace probes.

PR kern/58378: Kernel error code origination lacks dtrace probes
 1.40  07-Dec-2024  riastradh vfs(9): Sprinkle KNF.

No functional change intended.
 1.39  24-Mar-2023  bouyer extattr_set_vp(): properly handle XATTR_REPLACE flags, FFSv2ea will return
ENOATTR, not ENODATA if the attribute is missing.

Makes glusterfs 10 run on a FFSv2ea file system.
 1.38  25-Oct-2022  riastradh branches: 1.38.2;
extattr(9): KNF

No functional change intended.
 1.37  25-Oct-2022  riastradh extattr(9): Fix uninitialized uio_iovcnt.
 1.36  27-Jun-2021  christos factor out the ktrace printing into their own functions.
 1.35  16-May-2020  christos branches: 1.35.6;
Add ACL support for FFS. From FreeBSD.
 1.34  20-Apr-2020  christos Fix the ktrace calls, the data is in user space.
 1.33  05-Sep-2014  matt branches: 1.33.20; 1.33.30;
Try not to use f_data, use f_{vnode,socket,pipe,mqueue,kqueue,ksem} to get
a correctly typed pointer.
 1.32  05-Sep-2014  matt Don't next structure and enum definitions.
Don't use C++ keywords new, try, class, private, etc.
 1.31  01-May-2012  manu branches: 1.31.2;
Return ENODATA when no attribute is found, like Linux does. After
all we decided to adopt the Linux API, therefore there is rationale
to stick to it.

No standard tells us what to do, and our extended attribute API has not
been used in a release, therefore we do not break anything, and we get
more easily compatible with programs using the Linux extended attribute
API.

Note that FreeBSD and MacOS X return ENOATTR. FreeBSD has its own API
and MacOS X has a Linux-like API. How did the world get so complicated?
 1.30  13-Mar-2012  elad Replace the remaining KAUTH_GENERIC_ISSUSER authorization calls with
something meaningful. All relevant documentation has been updated or
written.

Most of these changes were brought up in the following messages:

http://mail-index.netbsd.org/tech-kern/2012/01/18/msg012490.html
http://mail-index.netbsd.org/tech-kern/2012/01/19/msg012502.html
http://mail-index.netbsd.org/tech-kern/2012/02/17/msg012728.html

Thanks to christos, manu, njoly, and jmmv for input.

Huge thanks to pgoyette for spinning these changes through some build
cycles and ATF.
 1.29  09-Nov-2011  drochner branches: 1.29.4; 1.29.6;
for the *xattr() calls, return ENOTSUP rather than EOPNOTSUPP if
the filesystem doesn't support extended attributes -- this is how
it is documented in Linux manpages
(on Linux itself, ENOTSUP and EOPNOTSUPP are the same value)
approved by Emmanuel Dreyfus
 1.28  22-Jul-2011  manu branches: 1.28.2;
Add tracepoints for extended attribute names and values, so that
we can figure what is going on when looking at a ktrace output.
 1.27  04-Jul-2011  manu Add a flag to VOP_LISTEXTATTR(9) so that the vnode interface can tell the
filesystem in which format extended attribute shall be listed.

There are currently two formats:
- NUL-terminated strings, used for listxattr(2), this is the default.
- one byte length-pprefixed, non NUL-terminated strings, used for
extattr_list_file(2), which is obtanined by setting the
EXTATTR_LIST_PREFIXLEN flag to VOP_LISTEXTATTR(9)

This approach avoid the need for converting the list back and forth, except
in libperfuse, since FUSE uses NUL-terminated strings, and the kernel may
have requested EXTATTR_LIST_PREFIXLEN.
 1.26  29-Jun-2011  manu Fix bug introduced in previous commuit: Do not vrele() a vnode we did not
obtained.
 1.25  28-Jun-2011  manu Improve a bit listxattr(2). It attemps to list both system and user
extended attributes, and it faled if calling user did not have privilege
for reading system EA. Now we just lise user EA and skip system EA in
reading them is not allowed.
 1.24  27-Jun-2011  manu Fix multiple non compliances in our Linux-like extattr API, and make it
public so that it can be used.
 1.23  19-Nov-2010  dholland Introduce struct pathbuf. This is an abstraction to hold a pathname
and the metadata required to interpret it. Callers of namei must now
create a pathbuf and pass it to NDINIT (instead of a string and a
uio_seg), then destroy the pathbuf after the namei session is
complete.

Update all namei call sites accordingly. Add a pathbuf(9) man page and
update namei(9).

The pathbuf interface also now appears in a couple of related
additional places that were passing string/uio_seg pairs that were
later fed into NDINIT. Update other call sites accordingly.
 1.22  24-Jun-2010  hannken Clean up vnode lock operations pass 2:

VOP_UNLOCK(vp, flags) -> VOP_UNLOCK(vp): Remove the unneeded flags argument.

Welcome to 5.99.32.

Discussed on tech-kern.
 1.21  21-May-2010  pooka Don't namei while holding vnode lock. kern/43328
 1.20  29-Jun-2009  dholland branches: 1.20.2; 1.20.4;
Convert 67 namei call sites to use namei_simple, in these functions:

check_console, veriexecclose, veriexec_delete, veriexec_file_add,
emul_find_root, coff_load_shlib (sh3 version), coff_load_shlib,
compat_20_sys_statfs, compat_20_netbsd32_statfs,
ELFNAME2(netbsd32,probe_noteless), darwin_sys_statfs,
ibcs2_sys_statfs, ibcs2_sys_statvfs, linux_sys_uselib,
osf1_sys_statfs, sunos_sys_statfs, sunos32_sys_statfs,
ultrix_sys_statfs, do_sys_mount, fss_create_files (3 of 4),
adosfs_mount, cd9660_mount, coda_ioctl, coda_mount, ext2fs_mount,
ffs_mount, filecore_mount, hfs_mount, lfs_mount, msdosfs_mount,
ntfs_mount, sysvbfs_mount, udf_mount, union_mount, sys_chflags,
sys_lchflags, sys_chmod, sys_lchmod, sys_chown, sys_lchown,
sys___posix_chown, sys___posix_lchown, sys_link, do_sys_pstatvfs,
sys_quotactl, sys_revoke, sys_truncate, do_sys_utimes, sys_extattrctl,
sys_extattr_set_file, sys_extattr_set_link, sys_extattr_get_file,
sys_extattr_get_link, sys_extattr_delete_file,
sys_extattr_delete_link, sys_extattr_list_file, sys_extattr_list_link,
sys_setxattr, sys_lsetxattr, sys_getxattr, sys_lgetxattr,
sys_listxattr, sys_llistxattr, sys_removexattr, sys_lremovexattr

All have been scrutinized (several times, in fact) and compile-tested,
but not all have been explicitly tested in action.

XXX: While I haven't (intentionally) changed the use or nonuse of
XXX: TRYEMULROOT in any of these places, I'm not convinced all the
XXX: uses are correct; an audit might be desirable.
 1.19  23-Jun-2008  ad branches: 1.19.6; 1.19.10; 1.19.14;
getvnode -> fd_getvnode
 1.18  28-Apr-2008  martin branches: 1.18.2; 1.18.4;
Remove clause 3 and 4 from TNF licenses
 1.17  21-Mar-2008  ad branches: 1.17.2; 1.17.4;
Catch up with descriptor handling changes. See kern_descrip.c revision
1.173 for details.
 1.16  25-Jan-2008  ad branches: 1.16.6;
Remove VOP_LEASE. Discussed on tech-kern.
 1.15  20-Dec-2007  dsl Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.14  08-Dec-2007  pooka branches: 1.14.4;
Remove cn_lwp from struct componentname. curlwp should be used
from on. The NDINIT() macro no longer takes the lwp parameter and
associates the credentials of the calling thread with the namei
structure.
 1.13  26-Nov-2007  pooka branches: 1.13.2;
Remove the "struct lwp *" argument from all VFS and VOP interfaces.
The general trend is to remove it from all kernel interfaces and
this is a start. In case the calling lwp is desired, curlwp should
be used.

quick consensus on tech-kern
 1.12  03-Apr-2007  hannken branches: 1.12.8; 1.12.10; 1.12.16;
Remove calls to now obsolete vn_start_write() and vn_finished_write().
 1.11  09-Feb-2007  ad branches: 1.11.2; 1.11.6; 1.11.8;
Merge newlock2 to head.
 1.10  04-Jan-2007  elad Consistent usage of KAUTH_GENERIC_ISSUSER.
 1.9  01-Nov-2006  yamt remove some __unused from function parameters.
 1.8  12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.7  23-Jul-2006  ad branches: 1.7.4; 1.7.6;
Use the LWP cached credentials where sane.
 1.6  14-May-2006  elad branches: 1.6.6;
integrate kauth.
 1.5  01-Mar-2006  yamt branches: 1.5.2; 1.5.4; 1.5.6;
merge yamt-uio_vmspace branch.

- use vmspace rather than proc or lwp where appropriate.
the latter is more natural to specify an address space.
(and less likely to be abused for random purposes.)
- fix a swdmover race.
 1.4  11-Dec-2005  christos branches: 1.4.2; 1.4.4; 1.4.6;
merge ktrace-lwp.
 1.3  10-Jul-2005  thorpej branches: 1.3.6;
Move the rest of the extattr stuff into vfs_xattr.c
 1.2  10-Jul-2005  thorpej Add Linux-compatible {,fl}{get,set,list}xattr() system call interface
to the VFS extended attribute subsystem.
 1.1  09-Jul-2005  thorpej Move VFS extended attribute support to its own file.
 1.3.6.2  10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.3.6.1  10-Jul-2005  skrll file vfs_xattr.c was added on branch ktrace-lwp on 2005-11-10 14:09:46 +0000
 1.4.6.2  01-Jun-2006  kardel Sync with head.
 1.4.6.1  22-Apr-2006  simonb Sync with head.
 1.4.4.1  09-Sep-2006  rpaulo sync with head
 1.4.2.1  31-Dec-2005  yamt uio_segflg/uio_lwp -> uio_vmspace.
 1.5.6.1  24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.5.4.3  06-May-2006  christos - Move kauth_cred_t declaration to <sys/types.h>
- Cleanup struct ucred; forward declarations that are unused.
- Don't include <sys/kauth.h> in any header, but include it in the c files
that need it.

Approved by core.
 1.5.4.2  10-Mar-2006  elad generic_authorize() -> kauth_authorize_generic().
 1.5.4.1  08-Mar-2006  elad Adapt to kernel authorization KPI.
 1.5.2.2  11-Aug-2006  yamt sync with head
 1.5.2.1  24-May-2006  yamt sync with head.
 1.6.6.9  24-Mar-2008  yamt sync with head.
 1.6.6.8  04-Feb-2008  yamt sync with head.
 1.6.6.7  21-Jan-2008  yamt sync with head
 1.6.6.6  07-Dec-2007  yamt sync with head
 1.6.6.5  03-Sep-2007  yamt sync with head.
 1.6.6.4  26-Feb-2007  yamt sync with head.
 1.6.6.3  30-Dec-2006  yamt sync with head.
 1.6.6.2  21-Jun-2006  yamt sync with head.
 1.6.6.1  14-May-2006  yamt file vfs_xattr.c was added on branch yamt-lazymbuf on 2006-06-21 15:09:39 +0000
 1.7.6.2  10-Dec-2006  yamt sync with head.
 1.7.6.1  22-Oct-2006  yamt sync with head
 1.7.4.2  30-Jan-2007  ad Remove support for SA. Ok core@.
 1.7.4.1  12-Jan-2007  ad Sync with head.
 1.11.8.1  11-Jul-2007  mjf Sync with head.
 1.11.6.1  10-Apr-2007  ad Sync with head.
 1.11.2.1  15-Apr-2007  yamt sync with head.
 1.12.16.3  18-Feb-2008  mjf Sync with HEAD.
 1.12.16.2  27-Dec-2007  mjf Sync with HEAD.
 1.12.16.1  08-Dec-2007  mjf Sync with HEAD.
 1.12.10.2  23-Mar-2008  matt sync with HEAD
 1.12.10.1  09-Jan-2008  matt sync with HEAD
 1.12.8.2  09-Dec-2007  jmcneill Sync with HEAD.
 1.12.8.1  27-Nov-2007  joerg Sync with HEAD. amd64 Xen support needs testing.
 1.13.2.1  26-Dec-2007  ad Sync with head.
 1.14.4.1  02-Jan-2008  bouyer Sync with HEAD
 1.16.6.3  29-Jun-2008  mjf Sync with HEAD.
 1.16.6.2  02-Jun-2008  mjf Sync with HEAD.
 1.16.6.1  03-Apr-2008  mjf Sync with HEAD.
 1.17.4.4  11-Aug-2010  yamt sync with head.
 1.17.4.3  18-Jul-2009  yamt sync with head.
 1.17.4.2  04-May-2009  yamt sync with head.
 1.17.4.1  16-May-2008  yamt sync with head.
 1.17.2.1  18-May-2008  yamt sync with head.
 1.18.4.1  27-Jun-2008  simonb Sync with head.
 1.18.2.3  18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.18.2.2  14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.18.2.1  10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.19.14.1  20-May-2011  matt bring matt-nb5-mips64 up to date with netbsd-5-1-RELEASE (except compat).
 1.19.10.1  23-Jul-2009  jym Sync with HEAD.
 1.19.6.2  17-Jul-2011  riz Pull up following revision(s) (requested by manu in ticket #1645):
lib/libc/sys/Makefile.inc 1.207 via patch
lib/libc/sys/extattr_get_file.2 patch
lib/libpuffs/dispatcher.c 1.34,1.36 via patch
lib/libpuffs/puffs.c 1.107 via patch
lib/libpuffs/puffs.h 1.115,1.118 via patch
sys/fs/puffs/puffs_msgif.h 1.71,1.76 via patch
sys/fs/puffs/puffs_vfsops.c 1.88 via patch
sys/fs/puffs/puffs_vnops.c 1.145,1.154 via patch
sys/kern/vfs_xattr.c 1.24-1.27 via patch
sys/kern/vnode_if.c 1.87 via patch
sys/sys/Makefile 1.133 via patch
sys/sys/extattr.h 1.6 via patch
sys/sys/vnode_if.h 1.81 via patch
sys/ufs/ffs/ffs_vnops.c patch
sys/ufs/ufs/ufs_extattr.c 1.31,1.34 via patch

* support extended attributes
* bump major due to structure growth
* add some spare space
* remove ABI sillyness
Support extended attributes.
Fix multiple non compliances in our Linux-like extattr API, and make it
public so that it can be used.
Improve a bit listxattr(2). It attemps to list both system and user
extended attributes, and it faled if calling user did not have privilege
for reading system EA. Now we just lise user EA and skip system EA in
reading them is not allowed.
Fix bug introduced in previous commuit: Do not vrele() a vnode we did not
obtained.
Improve UFS1 extended attributes usability
- autocreate attribute backing file for new attributes
- autoload attributes when issuing extattrctl start
- when autoloading attributes, do not display garbage warning when looking
up entries that got ENOENT
Add a flag to VOP_LISTEXTATTR(9) so that the vnode interface can tell the
filesystem in which format extended attribute shall be listed.
There are currently two formats:
- NUL-terminated strings, used for listxattr(2), this is the default.
- one byte length-pprefixed, non NUL-terminated strings, used for
extattr_list_file(2), which is obtanined by setting the
EXTATTR_LIST_PREFIXLEN flag to VOP_LISTEXTATTR(9)
This approach avoid the need for converting the list back and forth, except
in libperfuse, since FUSE uses NUL-terminated strings, and the kernel may
have requested EXTATTR_LIST_PREFIXLEN.
 1.19.6.1  12-Jun-2010  riz Pull up following revision(s) (requested by pooka in ticket #1405):
sys/kern/vfs_xattr.c: revision 1.21 via patch
Don't namei while holding vnode lock. kern/43328
 1.20.4.3  05-Mar-2011  rmind sync with head
 1.20.4.2  03-Jul-2010  rmind sync with head
 1.20.4.1  30-May-2010  rmind sync with head
 1.20.2.1  17-Aug-2010  uebayasi Sync with HEAD.
 1.28.2.3  23-May-2012  yamt sync with head.
 1.28.2.2  17-Apr-2012  yamt sync with head
 1.28.2.1  10-Nov-2011  yamt sync with head
 1.29.6.1  19-May-2012  riz Pull up following revision(s) (requested by manu in ticket #260):
sys/kern/vfs_xattr.c: revision 1.31
sys/ufs/ufs/ufs_extattr.c: revision 1.39
Return ENODATA when no attribute is found, like Linux does. After
all we decided to adopt the Linux API, therefore there is rationale
to stick to it.
No standard tells us what to do, and our extended attribute API has not
been used in a release, therefore we do not break anything, and we get
more easily compatible with programs using the Linux extended attribute
API.
Note that FreeBSD and MacOS X return ENOATTR. FreeBSD has its own API
and MacOS X has a Linux-like API. How did the world get so complicated?
 1.29.4.2  02-Jun-2012  mrg sync to latest -current.
 1.29.4.1  05-Apr-2012  mrg sync to latest -current.
 1.31.2.1  03-Dec-2017  jdolecek update from HEAD
 1.33.30.1  20-Apr-2020  bouyer Sync with HEAD
 1.33.20.1  21-Apr-2020  martin Sync with HEAD
 1.35.6.1  01-Aug-2021  thorpej Sync with HEAD.
 1.38.2.1  30-Mar-2023  martin Pull up following revision(s) (requested by bouyer in ticket #129):

sys/kern/vfs_xattr.c: revision 1.39

extattr_set_vp(): properly handle XATTR_REPLACE flags, FFSv2ea will return
ENOATTR, not ENODATA if the attribute is missing.

Makes glusterfs 10 run on a FFSv2ea file system.

RSS XML Feed