Bug 35413 - chmod doesnt fail when it cant modify group permissions
chmod doesnt fail when it cant modify group permissions
Product: Red Hat Linux
Classification: Retired
Component: fileutils (Show other bugs)
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Bernhard Rosenkraenzer
Aaron Brown
: Security
Depends On:
  Show dependency treegraph
Reported: 2001-04-09 23:30 EDT by lumpy_
Modified: 2007-04-18 12:32 EDT (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2001-05-21 16:23:01 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description lumpy_ 2001-04-09 23:30:51 EDT
From Bugzilla Helper:
User-Agent: Mozilla/4.76 [en] (X11; U; FreeBSD 4.2-STABLE i386)

chmod does not fail when it cant set group permissions properly.

Reproducible: Always
Steps to Reproduce:
1.as root:  touch testfile; chown nonrootuser:root file
2.as nonrootuser: chmod 2777 file
3. notice how chmod does not fail, and how it returns 0, yet it failed

Actual Results:  every time, it works

Expected Results:  for chmod to report an error, at least in its return

in bsd this orks properly
Comment 1 Bernhard Rosenkraenzer 2001-05-21 14:59:56 EDT
The chmod() system call returns 0 under those conditions, so the real fix 
should be in the kernel.

FreeBSD doesn't change the permissions on the file at all when it gets the 
chmod() system call and returns EPERM, we currently change the permissions to 
0777 (stripping off setgid) and return 0.

What does POSIX say?

Comment 2 Arjan van de Ven 2001-05-21 16:05:08 EDT
Alan: reason this is a bug ?
Comment 3 Arjan van de Ven 2001-05-21 16:17:22 EDT
SuS says:

      In order to ensure that the S_ISUID and S_ISGID bits are set, an
      application requiring this should use stat() after a successful
      chmod() to verify this.

so the chmod(1) program should do a stat(2) on a file after doing chmod(2).
Comment 4 Bernhard Rosenkraenzer 2002-08-29 18:43:47 EDT
Fixed in 4.1.9-10

Note You need to log in before you can comment on or make changes to this bug.