public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] proc: warn if registering world writeable files
@ 2010-12-16 20:32 Alexey Dobriyan
  2010-12-16 21:26 ` Dave Jones
  0 siblings, 1 reply; 3+ messages in thread
From: Alexey Dobriyan @ 2010-12-16 20:32 UTC (permalink / raw)
  To: akpm; +Cc: linux-kernel, davej

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
---

 fs/proc/generic.c |    1 +
 1 file changed, 1 insertion(+)

--- a/fs/proc/generic.c
+++ b/fs/proc/generic.c
@@ -623,6 +623,7 @@ static struct proc_dir_entry *__proc_create(struct proc_dir_entry **parent,
 	memcpy(((char *) ent) + sizeof(struct proc_dir_entry), fn, len + 1);
 	ent->name = ((char *) ent) + sizeof(*ent);
 	ent->namelen = len;
+	WARN_ON(S_ISREG(mode) && (mode & S_IWOTH));
 	ent->mode = mode;
 	ent->nlink = nlink;
 	atomic_set(&ent->count, 1);

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

* Re: [PATCH] proc: warn if registering world writeable files
  2010-12-16 20:32 [PATCH] proc: warn if registering world writeable files Alexey Dobriyan
@ 2010-12-16 21:26 ` Dave Jones
  2010-12-16 22:04   ` Alexey Dobriyan
  0 siblings, 1 reply; 3+ messages in thread
From: Dave Jones @ 2010-12-16 21:26 UTC (permalink / raw)
  To: Alexey Dobriyan; +Cc: akpm, linux-kernel

On Thu, Dec 16, 2010 at 10:32:17PM +0200, Alexey Dobriyan wrote:
 > Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
 > ---
 > 
 >  fs/proc/generic.c |    1 +
 >  1 file changed, 1 insertion(+)
 > 
 > --- a/fs/proc/generic.c
 > +++ b/fs/proc/generic.c
 > @@ -623,6 +623,7 @@ static struct proc_dir_entry *__proc_create(struct proc_dir_entry **parent,
 >  	memcpy(((char *) ent) + sizeof(struct proc_dir_entry), fn, len + 1);
 >  	ent->name = ((char *) ent) + sizeof(*ent);
 >  	ent->namelen = len;
 > +	WARN_ON(S_ISREG(mode) && (mode & S_IWOTH));
 >  	ent->mode = mode;
 >  	ent->nlink = nlink;
 >  	atomic_set(&ent->count, 1);

Not sure about this. For the reason I mentioned in the checkpatch diff
that this is "usually" a problem.  There may be some use cases where
it may actually be ok.

(I'm having a hard time thinking up a justification though tbh)

	Dave


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

* Re: [PATCH] proc: warn if registering world writeable files
  2010-12-16 21:26 ` Dave Jones
@ 2010-12-16 22:04   ` Alexey Dobriyan
  0 siblings, 0 replies; 3+ messages in thread
From: Alexey Dobriyan @ 2010-12-16 22:04 UTC (permalink / raw)
  To: Dave Jones, akpm, linux-kernel

On Thu, Dec 16, 2010 at 04:26:10PM -0500, Dave Jones wrote:
> On Thu, Dec 16, 2010 at 10:32:17PM +0200, Alexey Dobriyan wrote:
>  > +	WARN_ON(S_ISREG(mode) && (mode & S_IWOTH));
>  >  	ent->mode = mode;
>  >  	ent->nlink = nlink;
>  >  	atomic_set(&ent->count, 1);
> 
> Not sure about this. For the reason I mentioned in the checkpatch diff
> that this is "usually" a problem.  There may be some use cases where
> it may actually be ok.
> 
> (I'm having a hard time thinking up a justification though tbh)

Me too.

If it's for quick debugging, one can reassign ->mode after registering and
escape the warning.

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

end of thread, other threads:[~2010-12-16 22:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-16 20:32 [PATCH] proc: warn if registering world writeable files Alexey Dobriyan
2010-12-16 21:26 ` Dave Jones
2010-12-16 22:04   ` Alexey Dobriyan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox