From 54a31a9429ac776c0239d29ffa7d361c654e007348617aa7be943146eb0a45d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cristian=20Rodr=C3=ADguez?= Date: Mon, 26 Sep 2011 17:57:44 +0000 Subject: [PATCH] Accepting request 84944 from openSUSE:Tools:Unstable fix openat function OBS-URL: https://build.opensuse.org/request/show/84944 OBS-URL: https://build.opensuse.org/package/show/Virtualization/qemu?expand=0&rev=16 --- 0019-linux-user-fix-openat.patch | 52 ++++++++++++++++++++++++++++++++ qemu.changes | 5 +++ qemu.spec | 2 ++ 3 files changed, 59 insertions(+) create mode 100644 0019-linux-user-fix-openat.patch diff --git a/0019-linux-user-fix-openat.patch b/0019-linux-user-fix-openat.patch new file mode 100644 index 0000000..035d434 --- /dev/null +++ b/0019-linux-user-fix-openat.patch @@ -0,0 +1,52 @@ +From 39c6bee3d5023a3e339bafd8073bc2c920cd79c5 Mon Sep 17 00:00:00 2001 +From: Alexander Graf +Date: Sun, 25 Sep 2011 06:21:28 +0200 +Subject: [PATCH] linux-user: fix openat + +When running openat using qemu-arm, we stumbled over invalid permissions +on the created files. The reason for this is that the mode parameter gets +treates as an O_... flag, which it isn't - it's a permission bitmask. + +This patch removes the needless translation of the mode parameter, +rendering permission passing of openat() to work with linux-user. + +Reported-by: Dirk Mueller +Signed-off-by: Alexander Graf +--- + linux-user/syscall.c | 14 +------------- + 1 files changed, 1 insertions(+), 13 deletions(-) + +diff --git a/linux-user/syscall.c b/linux-user/syscall.c +index 6b73769..27970a4 100644 +--- a/linux-user/syscall.c ++++ b/linux-user/syscall.c +@@ -376,25 +376,13 @@ static int sys_mknodat(int dirfd, const char *pathname, mode_t mode, + } + #endif + #ifdef TARGET_NR_openat +-static int sys_openat(int dirfd, const char *pathname, int flags, ...) ++static int sys_openat(int dirfd, const char *pathname, int flags, mode_t mode) + { + /* + * open(2) has extra parameter 'mode' when called with + * flag O_CREAT. + */ + if ((flags & O_CREAT) != 0) { +- va_list ap; +- mode_t mode; +- +- /* +- * Get the 'mode' parameter and translate it to +- * host bits. +- */ +- va_start(ap, flags); +- mode = va_arg(ap, mode_t); +- mode = target_to_host_bitmask(mode, fcntl_flags_tbl); +- va_end(ap); +- + return (openat(dirfd, pathname, flags, mode)); + } + return (openat(dirfd, pathname, flags)); +-- +1.6.0.2 + diff --git a/qemu.changes b/qemu.changes index 8558f53..f886fae 100644 --- a/qemu.changes +++ b/qemu.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Mon Sep 26 15:53:41 UTC 2011 - adrian@suse.de + +- add fix from alex for openat file permission handling + ------------------------------------------------------------------- Mon Jun 20 09:25:59 UTC 2011 - aj@suse.de diff --git a/qemu.spec b/qemu.spec index 716c556..8dfb977 100644 --- a/qemu.spec +++ b/qemu.spec @@ -43,6 +43,7 @@ Patch15: 0015-S-390-support.patch Patch16: 0016-fix-mipsn32-linux-user-builds.patch Patch17: 0017-S-390-build-fix.patch Patch18: 0018-qemu-0.14.1-mcast-udp.patch +Patch19: 0019-linux-user-fix-openat.patch # this is to make lint happy Source300: rpmlintrc BuildRoot: %{_tmppath}/%{name}-%{version}-build @@ -104,6 +105,7 @@ Authors: %endif %patch16 -p1 %patch18 -p1 +%patch19 -p1 %build # build QEMU