Open
Bug 1385898
Opened 8 years ago
Updated 3 years ago
|chmod()| is invoked with incorrect permission parameters such as 040775, etc.
Categories
(Core :: Networking: File, defect, P5)
Tracking
()
NEW
People
(Reporter: ishikawa, Unassigned)
Details
(Whiteboard: [necko-would-take])
I am quoting a few paragraphs I posted to Bug 1384461 Comment 1:
https://bugzilla.mozilla.org/show_bug.cgi?id=1384461#c1
The ivalid parameter value was observed during the execution of xpcshell test
of C-C TB, mailnews/jsaccount/test/unit/test_jaMsgFolder.js.
--- begin quote ---
Bad news is there are strange |chmod| calls.
TB calls chmod with very strange second mode parameter some times.
I marked such calls with "*" at the beginning of the line in the dump below.
There are lines such as
*/tmp/t.bad.19872:chmod("/tmp/firefox/xpcshellprofile/startupCache", 040755) = 0
*/tmp/t.bad.19872:chmod("/tmp/firefox/xpcshellprofile/TestFoo", 040700) = 0
Note the 040xxx values. From what I understand there ought to be only 4 octets (excluding the leading 0)
in this |mode| parameter.
It looks to me that functions screw up the call to chmod and instead of
simply ORing the values of the following, it does strange shift?
Or maybe the constant definition is wrong somewhere?
S_ISUID (04000) set-user-ID (set process effective user ID on
execve(2))
S_ISGID (02000) set-group-ID (set process effective group ID on
execve(2); mandatory locking, as described in
fcntl(2); take a new file's group from parent direc-
tory, as described in chown(2) and mkdir(2))
S_ISVTX (01000) sticky bit (restricted deletion flag, as described in
unlink(2))
040700 ought to be either 04700, 02700, or 01700.
fgrep "chmod(" /tmp/t.bad* /tmp/t.good*
/tmp/t.bad.19794:chmod("/NREF-COMM-CENTRAL/comm-central/hg-checkexec-DQD910", 0711) = 0
/tmp/t.bad.19795:fchmod(3, 02700) = 0
/tmp/t.bad.19795:fchmod(3, 02700) = 0
/tmp/t.bad.19795:fchmod(3, 02700) = 0
/tmp/t.bad.19798:chmod("/NREF-COMM-CENTRAL/comm-central/hg-checkexec-9ITWfJ", 0711) = 0
/tmp/t.bad.19799:fchmod(3, 02700) = 0
/tmp/t.bad.19799:fchmod(3, 02700) = 0
/tmp/t.bad.19799:fchmod(3, 02700) = 0
/tmp/t.bad.19803:chmod("/NREF-COMM-CENTRAL/comm-central/mozilla/hg-checkexec-IUvITj", 0711) = 0
/tmp/t.bad.19804:fchmod(3, 02700) = 0
/tmp/t.bad.19804:fchmod(3, 02700) = 0
/tmp/t.bad.19804:fchmod(3, 02700) = 0
*/tmp/t.bad.19872:chmod("/tmp/firefox/xpcshellprofile", 040755) = 0
*/tmp/t.bad.19872:chmod("/tmp/firefox/xpcshellprofile/startupCache", 040755) = 0
*/tmp/t.bad.19872:chmod("/tmp/firefox/xpcshellprofile/TestFoo", 040700) = 0
*/tmp/t.bad.19872:chmod("/tmp/firefox/xpcshellprofile/cache2", 040700) = 0
*/tmp/t.bad.19872:chmod("/tmp/firefox/xpcshellprofile/key3.db", 0100600) = 0
*/tmp/t.bad.19872:chmod("/tmp/firefox/xpcshellprofile/cert8.db", 0100600) = 0
*/tmp/t.bad.19872:chmod("/tmp/firefox/xpcshellprofile/mozinfo.json", 0100644) = 0
*/tmp/t.bad.19872:chmod("/tmp/firefox/xpcshellprofile/secmod.db", 0100600) = 0
*/tmp/t.bad.19872:chmod("/tmp/firefox/xpcshellprofile/panacea.dat", 0100644) = 0
*/tmp/t.bad.19872:chmod("/tmp/firefox/xpcshellprofile/startupCache/startupCache.8.little", 0100644) = 0
*/tmp/t.bad.19872:chmod("/tmp/firefox/xpcshellprofile/cache2/entries", 040700) = 0
*/tmp/t.bad.19872:chmod("/tmp/firefox/xpcshellprofile/cache2/doomed", 040700) = 0
/tmp/t.bad.19872:chmod("/NREF-COMM-CENTRAL/objdir-tb3/temp/xpc-plugins-b0xp2k/libnptest.so", 0755) = 0
/tmp/t.bad.19872:chmod("/NREF-COMM-CENTRAL/objdir-tb3/temp/xpc-plugins-b0xp2k/libnptestjava.so", 0755) = 0
/tmp/t.bad.19872:chmod("/NREF-COMM-CENTRAL/objdir-tb3/temp/xpc-plugins-b0xp2k/libnpthirdtest.so", 0755) = 0
/tmp/t.bad.19872:chmod("/NREF-COMM-CENTRAL/objdir-tb3/temp/xpc-plugins-b0xp2k/libnpsecondtest.so", 0755) = 0
/tmp/t.bad.19872:chmod("/NREF-COMM-CENTRAL/objdir-tb3/temp/xpc-plugins-b0xp2k/libnpswftest.so", 0755) = 0
*/tmp/t.bad.19872:chmod("/NREF-COMM-CENTRAL/objdir-tb3/temp/xpc-other-3kdU5T", 040700) = 0
*/tmp/t.bad.19872:chmod("/NREF-COMM-CENTRAL/objdir-tb3/temp/xpc-plugins-b0xp2k", 040700) = 0
*/tmp/t.bad.19872:chmod("/NREF-COMM-CENTRAL/objdir-tb3/temp/xpc-plugins-b0xp2k/libnptest.so", 0100755) = 0
*/tmp/t.bad.19872:chmod("/NREF-COMM-CENTRAL/objdir-tb3/temp/xpc-plugins-b0xp2k/libnptestjava.so", 0100755) = 0
*/tmp/t.bad.19872:chmod("/NREF-COMM-CENTRAL/objdir-tb3/temp/xpc-plugins-b0xp2k/libnpthirdtest.so", 0100755) = 0
*/tmp/t.bad.19872:chmod("/NREF-COMM-CENTRAL/objdir-tb3/temp/xpc-plugins-b0xp2k/libnpsecondtest.so", 0100755) = 0
*/tmp/t.bad.19872:chmod("/NREF-COMM-CENTRAL/objdir-tb3/temp/xpc-plugins-b0xp2k/libnpswftest.so", 0100755) = 0
/tmp/t.good.19907:chmod("/NREF-COMM-CENTRAL/comm-central/hg-checkexec-vOFPT7", 0711) = 0
/tmp/t.good.19908:fchmod(3, 02700) = 0
/tmp/t.good.19908:fchmod(3, 02700) = 0
/tmp/t.good.19908:fchmod(3, 02700) = 0
/tmp/t.good.19911:chmod("/NREF-COMM-CENTRAL/comm-central/hg-checkexec-1nkxfl", 0711) = 0
/tmp/t.good.19912:fchmod(3, 02700) = 0
/tmp/t.good.19912:fchmod(3, 02700) = 0
/tmp/t.good.19912:fchmod(3, 02700) = 0
/tmp/t.good.19916:chmod("/NREF-COMM-CENTRAL/comm-central/mozilla/hg-checkexec-yWVl21", 0711) = 0
/tmp/t.good.19917:fchmod(3, 02700) = 0
/tmp/t.good.19917:fchmod(3, 02700) = 0
/tmp/t.good.19917:fchmod(3, 02700) = 0
*/tmp/t.good.19983:chmod("/tmp/firefox/xpcshellprofile", 040755) = 0
*/tmp/t.good.19983:chmod("/tmp/firefox/xpcshellprofile/startupCache", 040755) = 0
*/tmp/t.good.19983:chmod("/tmp/firefox/xpcshellprofile/TestFoo", 040700) = 0
*/tmp/t.good.19983:chmod("/tmp/firefox/xpcshellprofile/cache2", 040700) = 0
*/tmp/t.good.19983:chmod("/tmp/firefox/xpcshellprofile/key3.db", 0100600) = 0
*/tmp/t.good.19983:chmod("/tmp/firefox/xpcshellprofile/cert8.db", 0100600) = 0
*/tmp/t.good.19983:chmod("/tmp/firefox/xpcshellprofile/mozinfo.json", 0100644) = 0
*/tmp/t.good.19983:chmod("/tmp/firefox/xpcshellprofile/secmod.db", 0100600) = 0
*/tmp/t.good.19983:chmod("/tmp/firefox/xpcshellprofile/panacea.dat", 0100644) = 0
*/tmp/t.good.19983:chmod("/tmp/firefox/xpcshellprofile/startupCache/startupCache.8.little", 0100644) = 0
*/tmp/t.good.19983:chmod("/tmp/firefox/xpcshellprofile/cache2/entries", 040700) = 0
*/tmp/t.good.19983:chmod("/tmp/firefox/xpcshellprofile/cache2/doomed", 040700) = 0
/tmp/t.good.19983:chmod("/NREF-COMM-CENTRAL/objdir-tb3/temp/xpc-plugins-Ro5AAZ/libnptest.so", 0755) = 0
/tmp/t.good.19983:chmod("/NREF-COMM-CENTRAL/objdir-tb3/temp/xpc-plugins-Ro5AAZ/libnptestjava.so", 0755) = 0
/tmp/t.good.19983:chmod("/NREF-COMM-CENTRAL/objdir-tb3/temp/xpc-plugins-Ro5AAZ/libnpthirdtest.so", 0755) = 0
/tmp/t.good.19983:chmod("/NREF-COMM-CENTRAL/objdir-tb3/temp/xpc-plugins-Ro5AAZ/libnpsecondtest.so", 0755) = 0
*/tmp/t.good.19983:chmod("/NREF-COMM-CENTRAL/objdir-tb3/temp/xpc-plugins-Ro5AAZ/libnpswftest.so", 0755) = 0
*/tmp/t.good.19983:chmod("/NREF-COMM-CENTRAL/objdir-tb3/temp/xpc-other-qjT1eB", 040700) = 0
*/tmp/t.good.19983:chmod("/NREF-COMM-CENTRAL/objdir-tb3/temp/xpc-plugins-Ro5AAZ", 040700) = 0
*/tmp/t.good.19983:chmod("/NREF-COMM-CENTRAL/objdir-tb3/temp/xpc-plugins-Ro5AAZ/libnptest.so", 0100755) = 0
*/tmp/t.good.19983:chmod("/NREF-COMM-CENTRAL/objdir-tb3/temp/xpc-plugins-Ro5AAZ/libnptestjava.so", 0100755) = 0
*/tmp/t.good.19983:chmod("/NREF-COMM-CENTRAL/objdir-tb3/temp/xpc-plugins-Ro5AAZ/libnpthirdtest.so", 0100755) = 0
*/tmp/t.good.19983:chmod("/NREF-COMM-CENTRAL/objdir-tb3/temp/xpc-plugins-Ro5AAZ/libnpsecondtest.so", 0100755) = 0
*/tmp/t.good.19983:chmod("/NREF-COMM-CENTRAL/objdir-tb3/temp/xpc-plugins-Ro5AAZ/libnpswftest.so", 0100755) = 0
I will dig more.
=== end quote
As of now, I am not even sure
- if the problem resides in the TB C-C code itself (C++ or JavaScript) OR
the test harness (xpcshell test)
TIA
Comment 1•8 years ago
|
||
Bulk change to priority: https://bugzilla.mozilla.org/show_bug.cgi?id=1399258
Priority: -- → P5
| Reporter | ||
Comment 2•8 years ago
|
||
In the original post, I said
> 040700 ought to be either 04700, 02700, or 01700.
Or can this be something like
"04" op "0700"
where op is the string concatenator where the original programmer thought that
he/she is ADDing (ORing) the integral numerical value to obtain 0704 instead of 040700 (!?).
I wonder if aceman knows anything about this.
In any case, the test is screwed up, and probably is not testing what we should be testing.
Flags: needinfo?(acelists)
Googling for chmod 040755 seems to produce multiple hits. It seems the system returns such modes even for files that are not set-use-ID, e.g. /etc. I'd guess 040000 (not 04000) means the file is actually a directory.
See e.g. https://stackoverflow.com/questions/15055634/understanding-and-decoding-the-file-mode-value-from-stat-function-output, the S_IFDIR constant.
Flags: needinfo?(acelists)
Updated•3 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•