public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Rusty Russell <rusty@rustcorp.com.au>
To: Gobinda Maji <gobinda.cemk07@gmail.com>
Cc: linux-next@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 9/9] sysfs: disallow world-writable files.
Date: Thu, 30 Apr 2015 11:32:05 +0930	[thread overview]
Message-ID: <874mnyxtk2.fsf@rustcorp.com.au> (raw)
In-Reply-To: <CAB_aHcxDvUnqNaEJDhQ7e1Jd4U3-qvV1=99uyiBfD1384jku5g@mail.gmail.com>

Gobinda Maji <gobinda.cemk07@gmail.com> writes:
> Hi Rusty,

Hi Gobinda,

> I have a small doubt about the permission restriction (User perms >=
> group perms >= other perms) in VERIFY_OCTAL_PERMISSIONS(). Please Note
> that permission field of User, Group or Other consists of three bits.
> LSB is EXECUTE permission, MSB is READ permission and the middle bit
> is WRITE permission. Say for example, permission value is "0431". Here
> User has only READ permission whereas Group has both WRITE and EXECUTE
> permission and Other has EXECUTE permission. I guess, it is not good
> to give Group the WRITE permission whereas User itself has no WRITE
> permission.

You're absolutely right, well spotted!  The checks can be tightened.  We
don't really care about execute, but logically write is "more
privileged" than read.

Best to separate the tests; OTHER_WRITABLE <= GROUP_WRITABLE <= OWNER_WRITABLE
and OTHER_READABLE <= GROUP_READABLE <= OWNER_READABLE.

A patch would be welcome!

Thanks,
Rusty.

  reply	other threads:[~2015-04-30  2:57 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-29 12:10 [PATCH 9/9] sysfs: disallow world-writable files Gobinda Maji
2015-04-30  2:02 ` Rusty Russell [this message]
  -- strict thread matches above, loose matches on Subject: below --
2015-05-01 11:59 Gobinda Maji
2014-04-22  3:33 [PATCH 0/9] Avoid world-writable sysfs files Rusty Russell
2014-04-22  3:33 ` [PATCH 9/9] sysfs: disallow world-writable files Rusty Russell
2015-04-29 12:24   ` Gobinda Charan Maji

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=874mnyxtk2.fsf@rustcorp.com.au \
    --to=rusty@rustcorp.com.au \
    --cc=gobinda.cemk07@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-next@vger.kernel.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