safe_macros: Add SAFE_GETXATTR() macro
PATCH 1/2 safe_macros: Add SAFE_GETXATTR() macro
Signed-off-by Xiao Yang <[email protected]>
--- include/tst_safe_macros.h | 5 +++++ lib/safe_macros.c | 21 +++++++++++++++++++++ 2 files changed, 26 insertions(+)
include/tst_safe_macros.h +5 -0
@@ -441,6 +441,11 @@ struct group *safe_getgrnam(const char *file, const int lineno,#define SAFE_GETGRNAM (name) \ safe_getgrnam(__FILE__, __LINE__, (name)) +ssize_t safe_getxattr (const char *file,const int lineno,const char *path, +const char *name,void *value,size_t size); +#define SAFE_GETXATTR (path, name, value, size) \ + safe_getxattr(__FILE__, __LINE__, (path), (name), (value), (size)) +int safe_setxattr (const char *file,const int lineno,const char *path,const char *name,const void *value,size_t size,int flags);#define SAFE_SETXATTR (path, name, value, size, flags) \
lib/safe_macros.c +21 -0
@@ -840,6 +840,27 @@ int safe_getpriority(const char *file, const int lineno, int which, id_t who)return rval; } +ssize_t safe_getxattr (const char *file,const int lineno,const char *path, +const char *name,void *value,size_t size) +{ +ssize_t rval; + + rval =getxattr (path, name, value, size); + +if (rval ==-1 ) { +if (errno ==ENOTSUP ) { +tst_brkm (TCONF ,NULL , +"%s:%d: no xattr support in fs or mounted " +"without user_xattr option" , file, lineno); + } + +tst_brkm (TBROK |TERRNO ,NULL ,"%s:%d: getxattr() failed" , + file, lineno); + } + +return rval; +} +int safe_setxattr (const char *file,const int lineno,const char *path,const char *name,const void *value,size_t size,int flags) {
Signature · 1 line
1.8.3.1
PATCH 2/2 syscalls/getxattr05: Add new regression testcase
Test POSIX Access Control Lists by getxattr(2) with/without a user namespace. The following issue is included by the new testcase and has been fixed in kernel:
'82c9a927bc5d ("getxattr: use correct xattr length")'
Fix #396
Signed-off-by Xiao Yang <[email protected]>
--- runtest/syscalls | 1 + testcases/kernel/syscalls/getxattr/.gitignore | 1 + testcases/kernel/syscalls/getxattr/Makefile | 2 + testcases/kernel/syscalls/getxattr/getxattr05.c | 171 ++++++++++++++++++++++++ 4 files changed, 175 insertions(+) create mode 100644 testcases/kernel/syscalls/getxattr/getxattr05.c
runtest/syscalls +1 -0
@@ -461,6 +461,7 @@ getxattr01 getxattr01 getxattr02 getxattr02 getxattr03 getxattr03 getxattr04 getxattr04 +getxattr05 getxattr05 #Needs tty device. #ioctl01 ioctl01 -D /dev/tty0
testcases/kernel/syscalls/getxattr/.gitignore +1 -0
@@ -2,3 +2,4 @@ /getxattr02 /getxattr03 /getxattr04 +/getxattr05
testcases/kernel/syscalls/getxattr/Makefile +2 -0
@@ -20,4 +20,6 @@ top_srcdir ?= ../../../.. include $(top_srcdir)/include/mk/testcases.mk +getxattr05: LDLIBS += $(ACL_LIBS) + include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/syscalls/getxattr/getxattr05.c new file +171 -0
171 lines not on this page · raw message
Signature · 1 line
1.8.3.1
PATCH 2/2 syscalls/getxattr05: Add new regression testcase
Hi!
Both pushed, thanks.
Signature · 2 lines
Cyril Hrubis [email protected]