Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 15 Jun 2021 09:46:11 GMT
From:      Edward Tomasz Napierala <trasz@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 9d167945e840 - main - linux: improve reporting for unsupported syscall flags
Message-ID:  <202106150946.15F9kBFw046894@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by trasz:

URL: https://cgit.FreeBSD.org/src/commit/?id=9d167945e8409c739442a02e3fbacb3bcdcc3306

commit 9d167945e8409c739442a02e3fbacb3bcdcc3306
Author:     Edward Tomasz Napierala <trasz@FreeBSD.org>
AuthorDate: 2021-06-15 09:18:04 +0000
Commit:     Edward Tomasz Napierala <trasz@FreeBSD.org>
CommitDate: 2021-06-15 09:18:18 +0000

    linux: improve reporting for unsupported syscall flags
    
    Filter out the flags we do support; previously we would print
    out the flag value verbatim.
    
    Reviewed By:    dchagin
    Sponsored By:   EPSRC
    Differential Revision:  https://reviews.freebsd.org/D30693
---
 sys/compat/linux/linux_file.c  |  7 ++++---
 sys/compat/linux/linux_stats.c | 21 ++++++++++++---------
 2 files changed, 16 insertions(+), 12 deletions(-)

diff --git a/sys/compat/linux/linux_file.c b/sys/compat/linux/linux_file.c
index a5ab3506767e..013c435756fb 100644
--- a/sys/compat/linux/linux_file.c
+++ b/sys/compat/linux/linux_file.c
@@ -1757,10 +1757,11 @@ int
 linux_fchownat(struct thread *td, struct linux_fchownat_args *args)
 {
 	char *path;
-	int error, dfd, flag;
+	int error, dfd, flag, unsupported;
 
-	if (args->flag & ~(LINUX_AT_SYMLINK_NOFOLLOW | LINUX_AT_EMPTY_PATH)) {
-		linux_msg(td, "fchownat unsupported flag 0x%x", args->flag);
+	unsupported = args->flag & ~(LINUX_AT_SYMLINK_NOFOLLOW | LINUX_AT_EMPTY_PATH);
+	if (unsupported != 0) {
+		linux_msg(td, "fchownat unsupported flag 0x%x", unsupported);
 		return (EINVAL);
 	}
 
diff --git a/sys/compat/linux/linux_stats.c b/sys/compat/linux/linux_stats.c
index 4e6304500a8b..97bace941943 100644
--- a/sys/compat/linux/linux_stats.c
+++ b/sys/compat/linux/linux_stats.c
@@ -663,11 +663,12 @@ int
 linux_fstatat64(struct thread *td, struct linux_fstatat64_args *args)
 {
 	char *path;
-	int error, dfd, flag;
+	int error, dfd, flag, unsupported;
 	struct stat buf;
 
-	if (args->flag & ~(LINUX_AT_SYMLINK_NOFOLLOW | LINUX_AT_EMPTY_PATH)) {
-		linux_msg(td, "fstatat64 unsupported flag 0x%x", args->flag);
+	unsupported = args->flag & ~(LINUX_AT_SYMLINK_NOFOLLOW | LINUX_AT_EMPTY_PATH);
+	if (unsupported != 0) {
+		linux_msg(td, "fstatat64 unsupported flag 0x%x", unsupported);
 		return (EINVAL);
 	}
 	flag = (args->flag & LINUX_AT_SYMLINK_NOFOLLOW) ?
@@ -696,11 +697,12 @@ int
 linux_newfstatat(struct thread *td, struct linux_newfstatat_args *args)
 {
 	char *path;
-	int error, dfd, flag;
+	int error, dfd, flag, unsupported;
 	struct stat buf;
 
-	if (args->flag & ~(LINUX_AT_SYMLINK_NOFOLLOW | LINUX_AT_EMPTY_PATH)) {
-		linux_msg(td, "fstatat unsupported flag 0x%x", args->flag);
+	unsupported = args->flag & ~(LINUX_AT_SYMLINK_NOFOLLOW | LINUX_AT_EMPTY_PATH);
+	if (unsupported != 0) {
+		linux_msg(td, "fstatat unsupported flag 0x%x", unsupported);
 		return (EINVAL);
 	}
 
@@ -769,11 +771,12 @@ int
 linux_statx(struct thread *td, struct linux_statx_args *args)
 {
 	char *path;
-	int error, dirfd, flags;
+	int error, dirfd, flags, unsupported;
 	struct stat buf;
 
-	if (args->flags & ~(LINUX_AT_SYMLINK_NOFOLLOW | LINUX_AT_EMPTY_PATH)) {
-		linux_msg(td, "statx unsupported flags 0x%x", args->flags);
+	unsupported = args->flags & ~(LINUX_AT_SYMLINK_NOFOLLOW | LINUX_AT_EMPTY_PATH);
+	if (unsupported != 0) {
+		linux_msg(td, "statx unsupported flags 0x%x", unsupported);
 		return (EINVAL);
 	}
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202106150946.15F9kBFw046894>