Date: Thu, 14 May 2020 03:01:24 +0000 (UTC) From: Conrad Meyer <cem@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r361021 - in head: sys/kern usr.sbin/extattr/tests Message-ID: <202005140301.04E31Oh6035455@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: cem Date: Thu May 14 03:01:23 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 Modified: head/sys/kern/vfs_extattr.c head/usr.sbin/extattr/tests/extattr_test.sh Modified: head/sys/kern/vfs_extattr.c ============================================================================== --- head/sys/kern/vfs_extattr.c Wed May 13 21:16:02 2020 (r361020) +++ head/sys/kern/vfs_extattr.c Thu May 14 03:01:23 2020 (r361021) @@ -82,7 +82,7 @@ sys_extattrctl(struct thread *td, struct extattrctl_ar struct vnode *filename_vp; struct nameidata nd; struct mount *mp, *mp_writable; - char attrname[EXTATTR_MAXNAMELEN]; + char attrname[EXTATTR_MAXNAMELEN + 1]; int error; AUDIT_ARG_CMD(uap->cmd); @@ -92,7 +92,7 @@ sys_extattrctl(struct thread *td, struct extattrctl_ar * invoke the VFS call so as to pass in NULL there if needed. */ if (uap->attrname != NULL) { - error = copyinstr(uap->attrname, attrname, EXTATTR_MAXNAMELEN, + error = copyinstr(uap->attrname, attrname, sizeof(attrname), NULL); if (error) return (error); @@ -231,13 +231,13 @@ int sys_extattr_set_fd(struct thread *td, struct extattr_set_fd_args *uap) { struct file *fp; - char attrname[EXTATTR_MAXNAMELEN]; + char attrname[EXTATTR_MAXNAMELEN + 1]; cap_rights_t rights; int error; AUDIT_ARG_FD(uap->fd); AUDIT_ARG_VALUE(uap->attrnamespace); - error = copyinstr(uap->attrname, attrname, EXTATTR_MAXNAMELEN, NULL); + error = copyinstr(uap->attrname, attrname, sizeof(attrname), NULL); if (error) return (error); AUDIT_ARG_TEXT(attrname); @@ -293,11 +293,11 @@ kern_extattr_set_path(struct thread *td, const char *p const char *uattrname, void *data, size_t nbytes, int follow) { struct nameidata nd; - char attrname[EXTATTR_MAXNAMELEN]; + char attrname[EXTATTR_MAXNAMELEN + 1]; int error; AUDIT_ARG_VALUE(attrnamespace); - error = copyinstr(uattrname, attrname, EXTATTR_MAXNAMELEN, NULL); + error = copyinstr(uattrname, attrname, sizeof(attrname), NULL); if (error) return (error); AUDIT_ARG_TEXT(attrname); @@ -398,13 +398,13 @@ int sys_extattr_get_fd(struct thread *td, struct extattr_get_fd_args *uap) { struct file *fp; - char attrname[EXTATTR_MAXNAMELEN]; + char attrname[EXTATTR_MAXNAMELEN + 1]; cap_rights_t rights; int error; AUDIT_ARG_FD(uap->fd); AUDIT_ARG_VALUE(uap->attrnamespace); - error = copyinstr(uap->attrname, attrname, EXTATTR_MAXNAMELEN, NULL); + error = copyinstr(uap->attrname, attrname, sizeof(attrname), NULL); if (error) return (error); AUDIT_ARG_TEXT(attrname); @@ -458,11 +458,11 @@ kern_extattr_get_path(struct thread *td, const char *p const char *uattrname, void *data, size_t nbytes, int follow) { struct nameidata nd; - char attrname[EXTATTR_MAXNAMELEN]; + char attrname[EXTATTR_MAXNAMELEN + 1]; int error; AUDIT_ARG_VALUE(attrnamespace); - error = copyinstr(uattrname, attrname, EXTATTR_MAXNAMELEN, NULL); + error = copyinstr(uattrname, attrname, sizeof(attrname), NULL); if (error) return (error); AUDIT_ARG_TEXT(attrname); @@ -533,13 +533,13 @@ int sys_extattr_delete_fd(struct thread *td, struct extattr_delete_fd_args *uap) { struct file *fp; - char attrname[EXTATTR_MAXNAMELEN]; + char attrname[EXTATTR_MAXNAMELEN + 1]; cap_rights_t rights; int error; AUDIT_ARG_FD(uap->fd); AUDIT_ARG_VALUE(uap->attrnamespace); - error = copyinstr(uap->attrname, attrname, EXTATTR_MAXNAMELEN, NULL); + error = copyinstr(uap->attrname, attrname, sizeof(attrname), NULL); if (error) return (error); AUDIT_ARG_TEXT(attrname); @@ -590,11 +590,11 @@ kern_extattr_delete_path(struct thread *td, const char const char *uattrname, int follow) { struct nameidata nd; - char attrname[EXTATTR_MAXNAMELEN]; + char attrname[EXTATTR_MAXNAMELEN + 1]; int error; AUDIT_ARG_VALUE(attrnamespace); - error = copyinstr(uattrname, attrname, EXTATTR_MAXNAMELEN, NULL); + error = copyinstr(uattrname, attrname, sizeof(attrname), NULL); if (error) return(error); AUDIT_ARG_TEXT(attrname); Modified: head/usr.sbin/extattr/tests/extattr_test.sh ============================================================================== --- head/usr.sbin/extattr/tests/extattr_test.sh Wed May 13 21:16:02 2020 (r361020) +++ head/usr.sbin/extattr/tests/extattr_test.sh Thu May 14 03:01:23 2020 (r361021) @@ -75,9 +75,6 @@ long_name_body() { atf_skip "Filesystem not reporting NAME_MAX; skipping testcase" fi - # https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=208965 - atf_expect_fail "BUG 208965 extattr(2) doesn't allow maxlen attr names" - ATTRNAME=`jot -b X -s "" $NAME_MAX 0` touch foo atf_check -s exit:0 -o empty setextattr user $ATTRNAME myvalue foo
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202005140301.04E31Oh6035455>