All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gobinda Charan Maji <gobinda.cemk07@gmail.com>
To: linux-kernel@vger.kernel.org
Subject: Re: [PATCH 9/9] sysfs: disallow world-writable files.
Date: Wed, 29 Apr 2015 12:24:20 +0000 (UTC)	[thread overview]
Message-ID: <loom.20150429T132014-905@post.gmane.org> (raw)
In-Reply-To: 1398137612-9714-10-git-send-email-rusty@rustcorp.com.au

Rusty Russell <rusty <at> rustcorp.com.au> writes:

> 
> This check was introduced in 2006 by Alexey Dobriyan (9774a1f54f173)
> for module parameters; we removed it when we unified the check into
> VERIFY_OCTAL_PERMISSIONS() as sysfs didn't have the same requirement.
> Now all those users are fixed, reintroduce it.
> 
> Cc: Alexey Dobriyan <adobriyan <at> gmail.com>
> Cc: Dave Jones <davej <at> redhat.com>
> Cc: Joe Perches <joe <at> perches.com>
> Signed-off-by: Rusty Russell <rusty <at> rustcorp.com.au>
> ---
>  include/linux/kernel.h | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/include/linux/kernel.h b/include/linux/kernel.h
> index 4c52907a6d8b..43e1c6a9683e 100644
> --- a/include/linux/kernel.h
> +++ b/include/linux/kernel.h
>  <at>  <at>  -849,5 +849,7  <at>  <at>  static inline void
ftrace_dump(enum ftrace_dump_mode oops_dump_mode) { }
>  	 /* User perms >= group perms >= other perms */			\
>  	 BUILD_BUG_ON_ZERO(((perms) >> 6) < (((perms) >> 3) & 7)) +	\
>  	 BUILD_BUG_ON_ZERO((((perms) >> 3) & 7) < ((perms) & 7)) +	\
> +	 /* Other writable?  Generally considered a bad idea. */	\
> +	 BUILD_BUG_ON_ZERO((perms) & 2) +				\
>  	 (perms))
>  #endif

Hi Rusty,

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.
May be, it's better to check those three permissions bit wise rather than 
as a whole.
I already had posted my query at:

http://thread.gmane.org/gmane.linux.kernel/1667095/focus=1737833

But could get any reply.

Please rethink about my point and let me know your opinion.

Thanks,
Gobinda




  reply	other threads:[~2015-04-29 12:24 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-22  3:33 [PATCH 0/9] Avoid world-writable sysfs files Rusty Russell
2014-04-22  3:33 ` [PATCH 1/9] drivers/mtd/devices/docg3.c: avoid " Rusty Russell
2014-04-22  3:33 ` [PATCH 2/9] drivers/video/fbdev/sm501fb.c: " Rusty Russell
2014-04-22  3:33 ` [PATCH 3/9] drivers/hid/hid-lg4ff.c: " Rusty Russell
2014-04-22 16:30   ` simon
2014-04-23  5:34     ` Rusty Russell
2014-04-23 15:06       ` simon
2014-04-24  3:25         ` Rusty Russell
     [not found]           ` <gz6xrj.n4iwpm.2st9zt-qmf@smtp.devoid-pointer.net>
2014-04-24  7:14             ` Rusty Russell
2014-04-22  3:33 ` [PATCH 4/9] drivers/scsi/pm8001/pm8001_ctl.c: " Rusty Russell
2014-04-22  3:33 ` [PATCH 5/9] drivers/regulator/virtual: " Rusty Russell
2014-04-22  3:33 ` [PATCH 6/9] drivers/staging/speakup/: " Rusty Russell
2014-04-22 16:37   ` Greg Kroah-Hartman
2014-04-24  4:27     ` Rusty Russell
2014-04-24 19:29       ` Greg Kroah-Hartman
2014-04-22  3:33 ` [PATCH 7/9] drivers/hid/hid-picolcd_fb: " Rusty Russell
2014-05-02 19:43   ` Bruno Prémont
2014-05-05  1:57     ` Rusty Russell
2014-05-05  9:02       ` Jiri Kosina
2014-04-22  3:33 ` [PATCH 8/9] samples/kobject/: " Rusty Russell
2014-04-22 16:38   ` Greg Kroah-Hartman
2014-04-22  3:33 ` [PATCH 9/9] sysfs: disallow world-writable files Rusty Russell
2015-04-29 12:24   ` Gobinda Charan Maji [this message]
2015-04-29 12:10 Gobinda Maji
2015-04-30  2:02 ` Rusty Russell
2015-05-01 11:59 Gobinda 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=loom.20150429T132014-905@post.gmane.org \
    --to=gobinda.cemk07@gmail.com \
    --cc=linux-kernel@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.