All of lore.kernel.org
 help / color / mirror / Atom feed
* ext3 and like, mount point in module
@ 2015-08-01 12:27 Tomas Bortoli
  2015-08-01 12:46 ` Richard Weinberger
  0 siblings, 1 reply; 7+ messages in thread
From: Tomas Bortoli @ 2015-08-01 12:27 UTC (permalink / raw)
  To: linux-fsdevel

Hi! I'm looking for a way to get the mount point of a file system from the EXT3 linux kernel module.
The folder of the module is (in linux 4.0.5) /fs/ext3
Is it possible? Which is the variable that contains it?

Thanks all
 		 	   		  

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

* Re: ext3 and like, mount point in module
  2015-08-01 12:27 ext3 and like, mount point in module Tomas Bortoli
@ 2015-08-01 12:46 ` Richard Weinberger
  2015-08-01 13:10   ` Tomas Bortoli
  0 siblings, 1 reply; 7+ messages in thread
From: Richard Weinberger @ 2015-08-01 12:46 UTC (permalink / raw)
  To: Tomas Bortoli; +Cc: linux-fsdevel

On Sat, Aug 1, 2015 at 2:27 PM, Tomas Bortoli <tomasbortoli@hotmail.it> wrote:
> Hi! I'm looking for a way to get the mount point of a file system from the EXT3 linux kernel module.
> The folder of the module is (in linux 4.0.5) /fs/ext3
> Is it possible? Which is the variable that contains it?

The VFS manages mount points, not filesystem drivers.
What problem are you drying to solve?

-- 
Thanks,
//richard

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

* RE: ext3 and like, mount point in module
  2015-08-01 12:46 ` Richard Weinberger
@ 2015-08-01 13:10   ` Tomas Bortoli
  2015-08-01 13:27     ` Richard Weinberger
  0 siblings, 1 reply; 7+ messages in thread
From: Tomas Bortoli @ 2015-08-01 13:10 UTC (permalink / raw)
  To: Richard Weinberger; +Cc: linux-fsdevel

Thanks for the clarification!
I'm trying to make a patch to slightly improve security in file system.
It consists in removing the ".." dir entry in the "/" dir of the file system mounted on the root mount point.
This could prevent an attacker from using a long series of "../../../" etc in a  transversal directory attack 
with unknown initial relative path to reach the root dir for sure and then move from there.
The dangerousness depends from which is the flaw
Do you think it's worth it?

----------------------------------------
> Date: Sat, 1 Aug 2015 14:46:33 +0200
> Subject: Re: ext3 and like, mount point in module
> From: richard.weinberger@gmail.com
> To: tomasbortoli@hotmail.it
> CC: linux-fsdevel@vger.kernel.org
>
> On Sat, Aug 1, 2015 at 2:27 PM, Tomas Bortoli <tomasbortoli@hotmail.it> wrote:
>> Hi! I'm looking for a way to get the mount point of a file system from the EXT3 linux kernel module.
>> The folder of the module is (in linux 4.0.5) /fs/ext3
>> Is it possible? Which is the variable that contains it?
>
> The VFS manages mount points, not filesystem drivers.
> What problem are you drying to solve?
>
> --
> Thanks,
> //richard
> --
> To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
 		 	   		  --
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: ext3 and like, mount point in module
  2015-08-01 13:10   ` Tomas Bortoli
@ 2015-08-01 13:27     ` Richard Weinberger
  2015-08-01 13:43       ` Al Viro
  2015-08-01 14:34       ` Tomas Bortoli
  0 siblings, 2 replies; 7+ messages in thread
From: Richard Weinberger @ 2015-08-01 13:27 UTC (permalink / raw)
  To: Tomas Bortoli; +Cc: linux-fsdevel

Am 01.08.2015 um 15:10 schrieb Tomas Bortoli:
> Thanks for the clarification!
> I'm trying to make a patch to slightly improve security in file system.
> It consists in removing the ".." dir entry in the "/" dir of the file system mounted on the root mount point.

What about chroot/namespaces/etc? :)

> This could prevent an attacker from using a long series of "../../../" etc in a  transversal directory attack 
> with unknown initial relative path to reach the root dir for sure and then move from there.
> The dangerousness depends from which is the flaw
> Do you think it's worth it?

I'm not sure if it is worth the hassle, I bet some applications depend on that behavior.
But you can give it a try, I'd insert a negative dentry for ".." if ".." is child of the current
root.

Thanks,
//richard

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

* Re: ext3 and like, mount point in module
  2015-08-01 13:27     ` Richard Weinberger
@ 2015-08-01 13:43       ` Al Viro
  2015-08-01 14:34       ` Tomas Bortoli
  1 sibling, 0 replies; 7+ messages in thread
From: Al Viro @ 2015-08-01 13:43 UTC (permalink / raw)
  To: Richard Weinberger; +Cc: Tomas Bortoli, linux-fsdevel

On Sat, Aug 01, 2015 at 03:27:17PM +0200, Richard Weinberger wrote:

> I'm not sure if it is worth the hassle, I bet some applications depend on that behavior.
> But you can give it a try, I'd insert a negative dentry for ".." if ".." is child of the current
> root.

Leaving aside the fact that .. handling does not depend on the corresponding
directory entry, why would such logics belong in the filesystem itself
anyway?  And not in the caller of ->lookup(), which *does* have all the
information needed.

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

* RE: ext3 and like, mount point in module
  2015-08-01 13:27     ` Richard Weinberger
  2015-08-01 13:43       ` Al Viro
@ 2015-08-01 14:34       ` Tomas Bortoli
  2015-08-05 17:17         ` Eric W. Biederman
  1 sibling, 1 reply; 7+ messages in thread
From: Tomas Bortoli @ 2015-08-01 14:34 UTC (permalink / raw)
  To: Richard Weinberger; +Cc: linux-fsdevel


> What about chroot/namespaces/etc? :)

I think chroot would work even so. Why would a program call chroot("..") on the root dir of the root fs? 
It's unnecessary and tricky. A local program has all the information to know relative paths and move consequently.
Anyway it is possible.


> I'm not sure if it is worth the hassle, I bet some applications depend on that behavior.
> But you can give it a try, I'd insert a negative dentry for ".." if ".." is child of the current
> root.

If with negative dentry you mean not putting ".." I've understood. 
But, ".." is needed for file system mounted not on the root point, otherwise they would be disconnected from the "parent" fs.
So, the "mount_point" variable is needed and it is not present in the file system module itself, as you said. 
Where can I find the vfs module? 
And, If I've understood what Al Viro said, it's correct to work on vfs rather than on the specific file system module.

Thanks all!
 		 	   		  

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

* Re: ext3 and like, mount point in module
  2015-08-01 14:34       ` Tomas Bortoli
@ 2015-08-05 17:17         ` Eric W. Biederman
  0 siblings, 0 replies; 7+ messages in thread
From: Eric W. Biederman @ 2015-08-05 17:17 UTC (permalink / raw)
  To: Tomas Bortoli; +Cc: Richard Weinberger, linux-fsdevel

Tomas Bortoli <tomasbortoli@hotmail.it> writes:

>> What about chroot/namespaces/etc? :)
>
> I think chroot would work even so. Why would a program call chroot("..") on the root dir of the root fs? 
> It's unnecessary and tricky. A local program has all the information to know relative paths and move consequently.
> Anyway it is possible.
>
>
>> I'm not sure if it is worth the hassle, I bet some applications depend on that behavior.
>> But you can give it a try, I'd insert a negative dentry for ".." if ".." is child of the current
>> root.
>
> If with negative dentry you mean not putting ".." I've understood. 
> But, ".." is needed for file system mounted not on the root point, otherwise they would be disconnected from the "parent" fs.
> So, the "mount_point" variable is needed and it is not present in the file system module itself, as you said. 
> Where can I find the vfs module? 
> And, If I've understood what Al Viro said, it's correct to work on vfs rather than on the specific file system module.

fs/namei.c  follow_dotdot and follow_dotdot_rcu

You might also take a gander at the patches I have recently posted that
address a similiar but different issue with .. and bind mounts.  That
should at least show you where the code is.

Eric

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

end of thread, other threads:[~2015-08-05 17:23 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-01 12:27 ext3 and like, mount point in module Tomas Bortoli
2015-08-01 12:46 ` Richard Weinberger
2015-08-01 13:10   ` Tomas Bortoli
2015-08-01 13:27     ` Richard Weinberger
2015-08-01 13:43       ` Al Viro
2015-08-01 14:34       ` Tomas Bortoli
2015-08-05 17:17         ` Eric W. Biederman

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.