trinity.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dave Jones <davej@codemonkey.org.uk>
To: Vinson Lee <vlee@twopensource.com>
Cc: trinity@vger.kernel.org
Subject: Re: "invalid open call: O_CREAT or O_TMPFILE without mode" errors
Date: Mon, 20 Jul 2015 10:52:57 -0400	[thread overview]
Message-ID: <20150720145257.GB23521@codemonkey.org.uk> (raw)
In-Reply-To: <CAHTgTXVFGfR0an5DcQKKt7HGmUVWddogDquL-oNMHYA8zfpBAw@mail.gmail.com>

On Thu, Jul 16, 2015 at 04:38:21PM -0700, Vinson Lee wrote:
 > Hi.
 > 
 > trinity stops running very soon after launch with invalid open call errors.
 > 
 > [main] Generating file descriptors
 > [main] Added 104 filenames from /dev
 > [main] Added 70615 filenames from /proc
 > [main] Added 29037 filenames from /sys
 > *** invalid open call: O_CREAT or O_TMPFILE without mode ***:
 > ./trinity terminated

Ugh. Is that some shiny new glibc ?

Probably something like this ?

Totally untested, I don't have a lot of time right now.

	Dave


diff --git a/syscalls/open.c b/syscalls/open.c
index 143e838fb7f5..9f65370b7225 100644
--- a/syscalls/open.c
+++ b/syscalls/open.c
@@ -31,11 +31,39 @@ unsigned long get_o_flags(void)
 	return mask;
 }
 
+static void sanitise_open(struct syscallrecord *rec)
+{
+	unsigned long flags;
+
+	flags = get_o_flags();
+
+	rec->a2 |= flags;
+
+	if (rec->a2 & O_CREAT)
+		rec->a3 = 0666;
+
+	if (rec->a2 & O_TMPFILE)
+		rec->a3 = 0666;
+}
+
+static void sanitise_openat(struct syscallrecord *rec)
+{
+	unsigned long flags;
+
+	flags = get_o_flags();
+
+	rec->a3 |= flags;
+
+	if (rec->a3 & O_CREAT)
+		rec->a4 = 0666;
+
+	if (rec->a3 & O_TMPFILE)
+		rec->a4 = 0666;
+}
+
 /*
  * SYSCALL_DEFINE3(open, const char __user *, filename, int, flags, int, mode)
  */
-static void sanitise_open(struct syscallrecord *rec);
-
 struct syscallentry syscall_open = {
 	.name = "open",
 	.num_args = 3,
@@ -52,20 +80,9 @@ struct syscallentry syscall_open = {
 	.sanitise = sanitise_open,
 };
 
-static void sanitise_open(struct syscallrecord *rec)
-{
-	unsigned long flags;
-
-	flags = get_o_flags();
-
-	rec->a2 |= flags;
-}
-
 /*
  * SYSCALL_DEFINE4(openat, int, dfd, const char __user *, filename, int, flags, int, mode)
  */
-static void sanitise_openat(struct syscallrecord *rec);
-
 struct syscallentry syscall_openat = {
 	.name = "openat",
 	.num_args = 4,
@@ -85,15 +102,6 @@ struct syscallentry syscall_openat = {
 	.sanitise = sanitise_openat,
 };
 
-static void sanitise_openat(struct syscallrecord *rec)
-{
-	unsigned long flags;
-
-	flags = get_o_flags();
-
-	rec->a3 |= flags;
-}
-
 /*
  * SYSCALL_DEFINE3(open_by_handle_at, int, mountdirfd,
  *               struct file_handle __user *, handle,

  reply	other threads:[~2015-07-20 14:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-16 23:38 "invalid open call: O_CREAT or O_TMPFILE without mode" errors Vinson Lee
2015-07-20 14:52 ` Dave Jones [this message]
2015-11-18 12:49   ` Kirill A. Shutemov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150720145257.GB23521@codemonkey.org.uk \
    --to=davej@codemonkey.org.uk \
    --cc=trinity@vger.kernel.org \
    --cc=vlee@twopensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).