From: Peter Seebach <peter.seebach@windriver.com>
To: Peter Seebach <peter.seebach@windriver.com>
Cc: OE-core <openembedded-core@lists.openembedded.org>
Subject: WARNING: FILES GETTING MARKED WORLD-WRITEABLE. (Was: Re: [PATCH 1/1] pseudo: handle fchmodat better, mask out unwanted write bits)
Date: Tue, 27 May 2014 14:01:27 -0500 [thread overview]
Message-ID: <20140527140127.229d766e@e6410-2> (raw)
In-Reply-To: <9f01f929ce7aa2344836e9360a832899217626bb.1400713858.git.peter.seebach@windriver.com>
On Wed, 21 May 2014 18:12:33 -0500
Peter Seebach <peter.seebach@windriver.com> wrote:
> +-#define PSEUDO_FS_MODE(mode, isdir) ((mode) | S_IRUSR | S_IWUSR | ((isdir) ? S_IXUSR : 0))
> +-#define PSEUDO_DB_MODE(fs_mode, user_mode) (((fs_mode) & ~0700) | ((user_mode & 0700)))
> ++#define PSEUDO_FS_MODE(mode, isdir) ((((mode) | S_IRUSR | S_IWUSR | ((isdir) ? S_IXUSR : 0)) & ~(S_IWGRP | S_IWOTH)) & ~(S_IWOTH | S_IWGRP))
> ++#define PSEUDO_DB_MODE(fs_mode, user_mode) (((fs_mode) & ~0722) | ((user_mode & 0722)))
So, someone just spotted a bug this introduces.
In the case where you're calling chmod, this produces exactly the results you
probably expect: Files end up with the specified mode in the database, and
with 022 masked out and 0700 masked in on the filesystem.
If you're using open or mkdir, though, the old code was picking up changes to
the mode from umask in the 077 bits (typically, 022), and the new code
doesn't because I ignore the 022 bits in the filesystem since I know I masked
them out.
I don't know how to solve this correctly yet, but basically I should be
taking umask into account.
I'll try to get a patch out for this ASAP.
-s
--
Listen, get this. Nobody with a good compiler needs to be justified.
prev parent reply other threads:[~2014-05-27 19:01 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-21 23:12 [PATCH 0/1] Revised pseudo-fchmodat (updated upstream-status) Peter Seebach
2014-05-21 23:12 ` [PATCH 1/1] pseudo: handle fchmodat better, mask out unwanted write bits Peter Seebach
2014-05-27 19:01 ` Peter Seebach [this message]
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=20140527140127.229d766e@e6410-2 \
--to=peter.seebach@windriver.com \
--cc=openembedded-core@lists.openembedded.org \
/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