<div dir="ltr">Hi Will,<div><br></div><div>This should go to the <a href="mailto:yocto@yoctoproject.org" target="_blank">yocto@yoctoproject.org</a> list really. I've CC'd the maintainer to be sure he spots it.</div><div><br></div><div>Ross</div></div><div class="gmail_extra"><br><div class="gmail_quote">On 15 September 2017 at 23:27, Will Page <span dir="ltr"><<a href="mailto:Will.Page@ni.com" target="_blank">Will.Page@ni.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">The fcntl guts switch on "cmd" parameter to identify the fcntl<br>
command being issued, but isn't aware of the file creation flags that<br>
can be ORed in.<br>
<br>
This change masks out the flags from the command only for the switch<br>
statement so that it can correctly determine whether it needs to pass<br>
"lock" or "arg". When real_fcntl() is called, the original value is<br>
still passed on. This corrects an issue observed using pseudo on modern<br>
linux desktops resulting in "pseudo: unknown fcntl argument 1030,<br>
assuming long argument." diagnostics in the output. Decimal 1030 is<br>
0x0406, which translates to O_NOCTTY | F_SETLK, and should call<br>
"rc = real_fcntl(fd, cmd, lock);", but instead falls through to the<br>
default case instead calling "rc = real_fcntl(fd, cmd, arg);".<br>
<br>
Tested the change using perftest - without this patch, the issue is<br>
trivially reproducible on my Ubuntu Xenial system, and after patching it<br>
emitted no "unknown fcntl argument" diagnostics.<br>
<br>
Signed-off-by: Will Page <<a href="mailto:Will.Page@ni.com">Will.Page@ni.com</a>><br>
---<br>
ports/linux/guts/fcntl.c | 6 +++++-<br>
1 file changed, 5 insertions(+), 1 deletion(-)<br>
<br>
diff --git a/ports/linux/guts/fcntl.c b/ports/linux/guts/fcntl.c<br>
index 639fd24..d278a8c 100644<br>
--- a/ports/linux/guts/fcntl.c<br>
+++ b/ports/linux/guts/fcntl.c<br>
@@ -8,6 +8,10 @@<br>
*/<br>
long arg;<br>
int save_errno;<br>
+ /* some bits can be ORed into the cmd should be explicitly ignored<br>
+ * see fcntl documentation on F_SETFL */<br>
+ int o_mode_mask = (O_RDONLY | O_WRONLY | O_RDWR) |<br>
+ (O_CREAT | O_EXCL | O_NOCTTY | O_TRUNC);<br>
<br>
/* we don't know whether we need lock or arg; grab both, which<br>
* should be safe enough on Linuxy systems. */<br>
@@ -15,7 +19,7 @@<br>
arg = va_arg(ap, long);<br>
va_end(ap);<br>
<br>
- switch (cmd) {<br>
+ switch (cmd & ~(o_mode_mask)) {<br>
case F_DUPFD:<br>
#ifdef F_DUPFD_CLOEXEC<br>
case F_DUPFD_CLOEXEC:<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.7.4<br>
<br>
--<br>
______________________________<wbr>_________________<br>
Openembedded-core mailing list<br>
<a href="mailto:Openembedded-core@lists.openembedded.org">Openembedded-core@lists.<wbr>openembedded.org</a><br>
<a href="http://lists.openembedded.org/mailman/listinfo/openembedded-core" rel="noreferrer" target="_blank">http://lists.openembedded.org/<wbr>mailman/listinfo/openembedded-<wbr>core</a><br>
</font></span></blockquote></div><br></div>