Re: [PATCH] zram: restrict add/remove attributes to root only

2016-12-04 Thread Sergey Senozhatsky
On (12/04/16 12:28), Greg KH wrote: > > [..] > > > > > Why can't a normal user read the attribute? Does a read actually modify > > > something? > > > > yes, it does. > > Oh that's totally and completely broken then. > > Reading from a sysfs file should NEVER cause side affects to the system.

Re: [PATCH] zram: restrict add/remove attributes to root only

2016-12-04 Thread Sergey Senozhatsky
On (12/04/16 12:28), Greg KH wrote: > > [..] > > > > > Why can't a normal user read the attribute? Does a read actually modify > > > something? > > > > yes, it does. > > Oh that's totally and completely broken then. > > Reading from a sysfs file should NEVER cause side affects to the system.

Re: [PATCH] zram: restrict add/remove attributes to root only

2016-12-04 Thread Sergey Senozhatsky
On (12/04/16 12:55), Greg KH wrote: [..] > That's fine, the issue is that reading a file should not cause the > system state to change. That's just not a logical thing to have happen, > no other sysfs files do that. Why is zram "special" in this way? yeah, zram is not really special, we just

Re: [PATCH] zram: restrict add/remove attributes to root only

2016-12-04 Thread Sergey Senozhatsky
On (12/04/16 12:55), Greg KH wrote: [..] > That's fine, the issue is that reading a file should not cause the > system state to change. That's just not a logical thing to have happen, > no other sysfs files do that. Why is zram "special" in this way? yeah, zram is not really special, we just

Re: [PATCH] zram: restrict add/remove attributes to root only

2016-12-04 Thread Greg KH
> > Cc: Andrew Morton <a...@linux-foundation.org>, Minchan Kim > > <minc...@kernel.org>, Steven Allen <ste...@stebalien.com>, > > linux-kernel@vger.kernel.org, sta...@vger.kernel.org, Sergey Senozhatsky > > <sergey.senozhatsky.w...@gmail.com> > > Subj

Re: [PATCH] zram: restrict add/remove attributes to root only

2016-12-04 Thread Greg KH
> linux-kernel@vger.kernel.org, sta...@vger.kernel.org, Sergey Senozhatsky > > > > Subject: Re: [PATCH] zram: restrict add/remove attributes to root only > > User-Agent: Mutt/1.7.1 (2016-10-04) > > > > On Sun, Dec 04, 2016 at 07:52:08PM +0900, Sergey Senozhatsky wrote: &

Re: [PATCH] zram: restrict add/remove attributes to root only

2016-12-04 Thread Sergey Senozhatsky
gt;, Steven Allen <ste...@stebalien.com>, > linux-kernel@vger.kernel.org, sta...@vger.kernel.org, Sergey Senozhatsky > <sergey.senozhatsky.w...@gmail.com> > Subject: Re: [PATCH] zram: restrict add/remove attributes to root only > User-Agent: Mutt/1.7.1 (2016-10-04) > &g

Re: [PATCH] zram: restrict add/remove attributes to root only

2016-12-04 Thread Sergey Senozhatsky
On (12/04/16 12:28), Greg KH wrote: > Date: Sun, 4 Dec 2016 12:28:20 +0100 > From: Greg KH > To: Sergey Senozhatsky > Cc: Andrew Morton , Minchan Kim > , Steven Allen , > linux-kernel@vger.kernel.org, sta...@vger.kernel.org, Sergey Senozhatsky > > Subject: Re: [P

Re: [PATCH] zram: restrict add/remove attributes to root only

2016-12-04 Thread Greg KH
On Sun, Dec 04, 2016 at 07:52:08PM +0900, Sergey Senozhatsky wrote: > On (12/04/16 11:28), Greg KH wrote: > > On Sun, Dec 04, 2016 at 11:35:15AM +0900, Sergey Senozhatsky wrote: > [..] > > > Why can't a normal user read the attribute? Does a read actually modify > > something? > > yes, it does.

Re: [PATCH] zram: restrict add/remove attributes to root only

2016-12-04 Thread Greg KH
On Sun, Dec 04, 2016 at 07:52:08PM +0900, Sergey Senozhatsky wrote: > On (12/04/16 11:28), Greg KH wrote: > > On Sun, Dec 04, 2016 at 11:35:15AM +0900, Sergey Senozhatsky wrote: > [..] > > > Why can't a normal user read the attribute? Does a read actually modify > > something? > > yes, it does.

Re: [PATCH] zram: restrict add/remove attributes to root only

2016-12-04 Thread Sergey Senozhatsky
On (12/04/16 11:28), Greg KH wrote: > On Sun, Dec 04, 2016 at 11:35:15AM +0900, Sergey Senozhatsky wrote: [..] > Why can't a normal user read the attribute? Does a read actually modify > something? yes, it does. reading from a hot_add file creates a new zram device and returns a new device's

Re: [PATCH] zram: restrict add/remove attributes to root only

2016-12-04 Thread Sergey Senozhatsky
On (12/04/16 11:28), Greg KH wrote: > On Sun, Dec 04, 2016 at 11:35:15AM +0900, Sergey Senozhatsky wrote: [..] > Why can't a normal user read the attribute? Does a read actually modify > something? yes, it does. reading from a hot_add file creates a new zram device and returns a new device's

Re: [PATCH] zram: restrict add/remove attributes to root only

2016-12-04 Thread Greg KH
On Sun, Dec 04, 2016 at 11:35:15AM +0900, Sergey Senozhatsky wrote: > Only root must be able to create a new zram device, therefore > hot_add attribute must have S_IRUSR mode, not S_IRUGO. Otherwise, > anyone can create a new zram device (device initialization with > the disksize attr requires

Re: [PATCH] zram: restrict add/remove attributes to root only

2016-12-04 Thread Greg KH
On Sun, Dec 04, 2016 at 11:35:15AM +0900, Sergey Senozhatsky wrote: > Only root must be able to create a new zram device, therefore > hot_add attribute must have S_IRUSR mode, not S_IRUGO. Otherwise, > anyone can create a new zram device (device initialization with > the disksize attr requires

[PATCH] zram: restrict add/remove attributes to root only

2016-12-03 Thread Sergey Senozhatsky
Only root must be able to create a new zram device, therefore hot_add attribute must have S_IRUSR mode, not S_IRUGO. Otherwise, anyone can create a new zram device (device initialization with the disksize attr requires root permission). Fixes: 6566d1a32bf72 ("zram: add dynamic device add/remove

[PATCH] zram: restrict add/remove attributes to root only

2016-12-03 Thread Sergey Senozhatsky
Only root must be able to create a new zram device, therefore hot_add attribute must have S_IRUSR mode, not S_IRUGO. Otherwise, anyone can create a new zram device (device initialization with the disksize attr requires root permission). Fixes: 6566d1a32bf72 ("zram: add dynamic device add/remove