* "invalid open call: O_CREAT or O_TMPFILE without mode" errors
@ 2015-07-16 23:38 Vinson Lee
2015-07-20 14:52 ` Dave Jones
0 siblings, 1 reply; 3+ messages in thread
From: Vinson Lee @ 2015-07-16 23:38 UTC (permalink / raw)
To: trinity
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
Cheers,
Vinson
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: "invalid open call: O_CREAT or O_TMPFILE without mode" errors
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
2015-11-18 12:49 ` Kirill A. Shutemov
0 siblings, 1 reply; 3+ messages in thread
From: Dave Jones @ 2015-07-20 14:52 UTC (permalink / raw)
To: Vinson Lee; +Cc: trinity
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,
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: "invalid open call: O_CREAT or O_TMPFILE without mode" errors
2015-07-20 14:52 ` Dave Jones
@ 2015-11-18 12:49 ` Kirill A. Shutemov
0 siblings, 0 replies; 3+ messages in thread
From: Kirill A. Shutemov @ 2015-11-18 12:49 UTC (permalink / raw)
To: Dave Jones; +Cc: Vinson Lee, trinity
On Mon, Jul 20, 2015 at 10:52:57AM -0400, Dave Jones wrote:
> 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.
There's one more source of such crashes: open_file() in fds/files.c
diff --git a/fds/files.c b/fds/files.c
index 2c7fa1ec1244..997cfea3fa18 100644
--- a/fds/files.c
+++ b/fds/files.c
@@ -321,7 +321,7 @@ retry_flags:
if (RAND_BOOL()) {
randflags = get_o_flags();
- fd = open(filename, flags | randflags | O_NONBLOCK);
+ fd = open(filename, flags | randflags | O_NONBLOCK, 0666);
} else {
fd = open_with_fopen(filename, flags);
fcntl_flags = random_fcntl_setfl_flags();
--
Kirill A. Shutemov
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-11-18 12:49 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2015-11-18 12:49 ` Kirill A. Shutemov
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).