All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/9] Avoid world-writable sysfs files.
@ 2014-04-22  3:33 Rusty Russell
  2014-04-22  3:33 ` [PATCH 1/9] drivers/mtd/devices/docg3.c: avoid " Rusty Russell
                   ` (8 more replies)
  0 siblings, 9 replies; 26+ messages in thread
From: Rusty Russell @ 2014-04-22  3:33 UTC (permalink / raw)
  To: linux-kernel; +Cc: Rusty Russell

This adds checking for world-writable sysfs files, after cleaning up
all the users.  This check has been in module sysfs params since 2006.

If you have a reason for being world-writable, please tell me now!

Rusty Russell (9):
  drivers/mtd/devices/docg3.c: avoid world-writable sysfs files.
  drivers/video/fbdev/sm501fb.c: avoid world-writable sysfs files.
  drivers/hid/hid-lg4ff.c: avoid world-writable sysfs files.
  drivers/scsi/pm8001/pm8001_ctl.c: avoid world-writable sysfs files.
  drivers/regulator/virtual: avoid world-writable sysfs files.
  drivers/staging/speakup/: avoid world-writable sysfs files.
  drivers/hid/hid-picolcd_fb: avoid world-writable sysfs files.
  samples/kobject/: avoid world-writable sysfs files.
  sysfs: disallow world-writable files.

 drivers/hid/hid-lg4ff.c                  |  2 +-
 drivers/hid/hid-picolcd_fb.c             |  2 +-
 drivers/mtd/devices/docg3.c              |  4 +--
 drivers/regulator/virtual.c              | 10 +++---
 drivers/scsi/pm8001/pm8001_ctl.c         |  2 +-
 drivers/staging/speakup/kobjects.c       | 60 ++++++++++++++++----------------
 drivers/staging/speakup/speakup_acntpc.c | 14 ++++----
 drivers/staging/speakup/speakup_acntsa.c | 14 ++++----
 drivers/staging/speakup/speakup_apollo.c | 16 ++++-----
 drivers/staging/speakup/speakup_audptr.c | 16 ++++-----
 drivers/staging/speakup/speakup_bns.c    | 14 ++++----
 drivers/staging/speakup/speakup_decext.c | 16 ++++-----
 drivers/staging/speakup/speakup_decpc.c  | 16 ++++-----
 drivers/staging/speakup/speakup_dectlk.c | 16 ++++-----
 drivers/staging/speakup/speakup_dtlk.c   | 20 +++++------
 drivers/staging/speakup/speakup_dummy.c  | 14 ++++----
 drivers/staging/speakup/speakup_keypc.c  | 10 +++---
 drivers/staging/speakup/speakup_ltlk.c   | 20 +++++------
 drivers/staging/speakup/speakup_soft.c   | 22 ++++++------
 drivers/staging/speakup/speakup_spkout.c | 16 ++++-----
 drivers/staging/speakup/speakup_txprt.c  | 14 ++++----
 drivers/video/fbdev/sm501fb.c            |  2 +-
 include/linux/kernel.h                   |  2 ++
 samples/kobject/kobject-example.c        |  7 ++--
 samples/kobject/kset-example.c           |  7 ++--
 25 files changed, 170 insertions(+), 166 deletions(-)

-- 
1.8.3.2


^ permalink raw reply	[flat|nested] 26+ messages in thread
* Re: [PATCH 9/9] sysfs: disallow world-writable files.
@ 2015-04-29 12:10 Gobinda Maji
  2015-04-30  2:02 ` Rusty Russell
  0 siblings, 1 reply; 26+ messages in thread
From: Gobinda Maji @ 2015-04-29 12:10 UTC (permalink / raw)
  To: rusty; +Cc: linux-next, linux-kernel

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

^ permalink raw reply	[flat|nested] 26+ messages in thread
* Re: [PATCH 9/9] sysfs: disallow world-writable files.
@ 2015-05-01 11:59 Gobinda Maji
  0 siblings, 0 replies; 26+ messages in thread
From: Gobinda Maji @ 2015-05-01 11:59 UTC (permalink / raw)
  To: Rusty Russell; +Cc: linux-next, linux-kernel

On 30 April 2015 at 07:32, Rusty Russell <rusty@rustcorp.com.au> wrote:

> 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 for the suggestion. OTHER_WRITABLE is already not permitted.
So, added the checks for GROUP_WRITABLE <= OWNER_WRITABLE for write
and OTHER_READABLE <= GROUP_READABLE <= OWNER_READABLE for read.

I am just sending a separate patch for this. The subject line will be
"[PATCH] sysfs: tightened sysfs permission checks"

-- 
Thanks,
Gobinda

^ permalink raw reply	[flat|nested] 26+ messages in thread

end of thread, other threads:[~2015-05-01 11:59 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2015-04-29 12:10 Gobinda Maji
2015-04-30  2:02 ` Rusty Russell
2015-05-01 11:59 Gobinda Maji

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.