[oe-commits] [openembedded-core] 02/02: pseudo: Add fcntl fix

git at git.openembedded.org git at git.openembedded.org
Mon Sep 18 12:01:24 UTC 2017


This is an automated email from the git hooks/post-receive script.

rpurdie pushed a commit to branch master-next
in repository openembedded-core.

commit e9f757dd5f900cbe90a26207fee823786a122470
Author: Richard Purdie <richard.purdie at linuxfoundation.org>
AuthorDate: Mon Sep 18 11:53:33 2017 +0100

    pseudo: Add fcntl fix
    
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 meta/recipes-devtools/pseudo/files/fcntl-fix.patch | 51 ++++++++++++++++++++++
 meta/recipes-devtools/pseudo/pseudo_1.8.2.bb       |  1 +
 2 files changed, 52 insertions(+)

diff --git a/meta/recipes-devtools/pseudo/files/fcntl-fix.patch b/meta/recipes-devtools/pseudo/files/fcntl-fix.patch
new file mode 100644
index 0000000..3fbe1ed
--- /dev/null
+++ b/meta/recipes-devtools/pseudo/files/fcntl-fix.patch
@@ -0,0 +1,51 @@
+Fix to fcntl guts to ignore flags that can be ORed into cmd
+
+The fcntl guts switch on "cmd" parameter to identify the fcntl
+command being issued, but isn't aware of the file creation flags that
+can be ORed in.
+
+This change masks out the flags from the command only for the switch
+statement so that it can correctly determine whether it needs to pass
+"lock" or "arg".  When real_fcntl() is called, the original value is
+still passed on. This corrects an issue observed using pseudo on modern
+linux desktops resulting in "pseudo: unknown fcntl argument 1030,
+assuming long argument." diagnostics in the output.  Decimal 1030 is
+0x0406, which translates to O_NOCTTY | F_SETLK, and should call
+"rc = real_fcntl(fd, cmd, lock);", but instead falls through to the
+default case instead calling "rc = real_fcntl(fd, cmd, arg);".
+
+Tested the change using perftest - without this patch, the issue is
+trivially reproducible on my Ubuntu Xenial system, and after patching it
+emitted no "unknown fcntl argument" diagnostics.
+
+Signed-off-by: Will Page <Will.Page at ni.com>
+---
+ ports/linux/guts/fcntl.c | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+Upstream-Status: Submitted
+
+diff --git a/ports/linux/guts/fcntl.c b/ports/linux/guts/fcntl.c
+index 639fd24..d278a8c 100644
+--- a/ports/linux/guts/fcntl.c
++++ b/ports/linux/guts/fcntl.c
+@@ -8,6 +8,10 @@
+  */
+  	long arg;
+ 	int save_errno;
++	/* some bits can be ORed into the cmd should be explicitly ignored
++	 * see fcntl documentation on F_SETFL */
++	int o_mode_mask = (O_RDONLY | O_WRONLY | O_RDWR) |
++		(O_CREAT | O_EXCL | O_NOCTTY | O_TRUNC);
+ 
+ 	/* we don't know whether we need lock or arg; grab both, which
+ 	 * should be safe enough on Linuxy systems. */
+@@ -15,7 +19,7 @@
+ 	arg = va_arg(ap, long);
+ 	va_end(ap);
+ 
+-	switch (cmd) {
++	switch (cmd & ~(o_mode_mask)) {
+ 	case F_DUPFD:
+ #ifdef F_DUPFD_CLOEXEC
+ 	case F_DUPFD_CLOEXEC:
diff --git a/meta/recipes-devtools/pseudo/pseudo_1.8.2.bb b/meta/recipes-devtools/pseudo/pseudo_1.8.2.bb
index 81853e9..ea4ec89 100644
--- a/meta/recipes-devtools/pseudo/pseudo_1.8.2.bb
+++ b/meta/recipes-devtools/pseudo/pseudo_1.8.2.bb
@@ -8,6 +8,7 @@ SRC_URI = "http://downloads.yoctoproject.org/releases/pseudo/${BPN}-${PV}.tar.bz
            file://efe0be279901006f939cd357ccee47b651c786da.patch \
            file://b6b68db896f9963558334aff7fca61adde4ec10f.patch \
            file://toomanyfiles.patch \
+           file://fcntl-fix.patch \
            file://0001-Use-epoll-API-on-Linux.patch \
            "
 

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list