Daniel Kiper
2010-Mar-26 14:14 UTC
[Xen-devel] [PATCH] Do not set execute permission on qemu-dm log file
Hi, Patch for xen-3.4-testing/xen-unstable which do not allow to set execute permission on qemu-dm log file. # HG changeset patch # User dkiper@net-space.pl # Date 1269611494 -3600 # Node ID 12a8db7dfdc2e589bce509069cb2ff1951bf68d5 # Parent 5b43b64a40f92b59e765c874289ed5af4d4155fe Do not set execute permission on qemu-dm log file. Signed-off-by: Daniel Kiper <dkiper@net-space.pl> diff -r 5b43b64a40f9 -r 12a8db7dfdc2 tools/python/xen/xend/image.py --- a/tools/python/xen/xend/image.py Wed Mar 24 11:19:55 2010 +0000 +++ b/tools/python/xen/xend/image.py Fri Mar 26 14:51:34 2010 +0100 @@ -411,7 +411,7 @@ class ImageHandler: os.rename(self.logfile, self.logfile + ".1") null = os.open("/dev/null", os.O_RDONLY) - logfd = os.open(self.logfile, logfile_mode) + logfd = os.open(self.logfile, logfile_mode, 0666) sys.stderr.flush() contract = osdep.prefork("%s:%d" % # HG changeset patch # User dkiper@net-space.pl # Date 1269611880 -3600 # Node ID c51208d7795fbfd6e198b63db5373aae0c9c5743 # Parent 21d7095162da9976dad39ab1473cacd37959e070 Do not set execute permission on qemu-dm log file. Signed-off-by: Daniel Kiper <dkiper@net-space.pl> diff -r 21d7095162da -r c51208d7795f tools/python/xen/xend/image.py --- a/tools/python/xen/xend/image.py Fri Mar 26 10:29:46 2010 +0000 +++ b/tools/python/xen/xend/image.py Fri Mar 26 14:58:00 2010 +0100 @@ -435,7 +435,7 @@ class ImageHandler: os.rename(self.logfile, self.logfile + ".1") null = os.open("/dev/null", os.O_RDONLY) - logfd = os.open(self.logfile, logfile_mode) + logfd = os.open(self.logfile, logfile_mode, 0666) sys.stderr.flush() contract = osdep.prefork("%s:%d" % Daniel _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Ian Jackson
2010-Apr-06 14:04 UTC
Re: [Xen-devel] [PATCH] Do not set execute permission on qemu-dm log file
Daniel Kiper writes ("[Xen-devel] [PATCH] Do not set execute permission on qemu-dm log file"):> Patch for xen-3.4-testing/xen-unstable which do not > allow to set execute permission on qemu-dm log file.Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> You might want to grep the rest of the code for similar uses of os.open. The choice of 0777 as the default mode is ... surprising. IMO this should be backported to 3.4 and to the 4.0 tree (but only after the 4.0 release). Ian. _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Daniel Kiper
2010-Apr-07 21:10 UTC
Re: [Xen-devel] [PATCH] Do not set execute permission on qemu-dm log file
Hi,> You might want to grep the rest of the code > for similar uses of os.open.Fast search: grep -r os\\.open . | grep -v O_RDONLY | wc -l Occurences: 32 (one of them is invalid) For the first sight it looks not bed because most of the opens with !O_RDONLY are for files on sysfs/proc filesystem. However I think it should be verified (it is a piece of cake). Additionally, I think that also C code should be checked, however it require a bit more work. If you are interested in that I could do that.> The choice of 0777 as the default mode is ... surprising.man 2 open: "mode must be specified when O_CREAT is in the flags, and is ignored otherwise" I think that: os.open(pathname, flags) is int open(const char *pathname, int flags) and os.open(pathname, flags, mode) is int open(const char *pathname, int flags, mode_t mode) fcntl.h: extern int open (__const char *__file, int __oflag, ...) Here is reply ^^^ If flags/__oflag contains O_CREAT and two argument open is used then invalid mode is taken from the stack and then modified by umask. If I am wrong please correct me. Daniel Kiper _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel