* [PATCH] mkfs.ubifs: do not override root inode permissions
@ 2010-09-07 8:36 Artem Bityutskiy
2010-09-07 9:11 ` NOTE! mkfs.ubifs Artem Bityutskiy
0 siblings, 1 reply; 5+ messages in thread
From: Artem Bityutskiy @ 2010-09-07 8:36 UTC (permalink / raw)
To: linux-mtd; +Cc: Arno Steffen, Adrian Hunter
From: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
When mkfs.ubifs is used with -r dir, it does not make the root UBIFS
inode uid/gid/permissions to be equivalent to dir's permissions, but
it makes root inode permissions to be equivalent to uid = git = 0
(root) and permissions = u+rwx go+rx.
This patch changes the behavior and makes mkfs.ubifs use the
permissions of the directory containing the original files on the host.
I.e., it will be <dir>'s uid/git/permissions if case of mkfs.ubifs
-r <dir>.
This patch is a bit dangerous because it changes the behavior and may
have security implications if someone used the older version, relied
on this bug, and upgrades to the newer version.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
---
mkfs.ubifs/mkfs.ubifs.c | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/mkfs.ubifs/mkfs.ubifs.c b/mkfs.ubifs/mkfs.ubifs.c
index 9f2a226..a4aebcb 100644
--- a/mkfs.ubifs/mkfs.ubifs.c
+++ b/mkfs.ubifs/mkfs.ubifs.c
@@ -1639,9 +1639,8 @@ static int write_data(void)
} else {
root_st.st_mtime = time(NULL);
root_st.st_atime = root_st.st_ctime = root_st.st_mtime;
+ root_st.st_mode = S_IFDIR | S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH;
}
- root_st.st_uid = root_st.st_gid = 0;
- root_st.st_mode = S_IFDIR | S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH;
head_flags = 0;
err = add_directory(root, UBIFS_ROOT_INO, &root_st, !root);
--
1.7.1.1
^ permalink raw reply related [flat|nested] 5+ messages in thread* NOTE! mkfs.ubifs
2010-09-07 8:36 [PATCH] mkfs.ubifs: do not override root inode permissions Artem Bityutskiy
@ 2010-09-07 9:11 ` Artem Bityutskiy
2010-09-07 10:23 ` Adrian Hunter
0 siblings, 1 reply; 5+ messages in thread
From: Artem Bityutskiy @ 2010-09-07 9:11 UTC (permalink / raw)
To: linux-mtd; +Cc: Arno Steffen, Adrian Hunter
On Tue, 2010-09-07 at 11:36 +0300, Artem Bityutskiy wrote:
> From: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
>
> When mkfs.ubifs is used with -r dir, it does not make the root UBIFS
> inode uid/gid/permissions to be equivalent to dir's permissions, but
> it makes root inode permissions to be equivalent to uid = git = 0
> (root) and permissions = u+rwx go+rx.
>
> This patch changes the behavior and makes mkfs.ubifs use the
> permissions of the directory containing the original files on the host.
> I.e., it will be <dir>'s uid/git/permissions if case of mkfs.ubifs
> -r <dir>.
>
> This patch is a bit dangerous because it changes the behavior and may
> have security implications if someone used the older version, relied
> on this bug, and upgrades to the newer version.
>
> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
All mkfs.ubifs users should take a look at this - should we apply this
patch? I'm still in doubt...
--
Best Regards,
Artem Bityutskiy (Артём Битюцкий)
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: NOTE! mkfs.ubifs
2010-09-07 9:11 ` NOTE! mkfs.ubifs Artem Bityutskiy
@ 2010-09-07 10:23 ` Adrian Hunter
2010-09-08 5:55 ` Artem Bityutskiy
2010-09-08 8:18 ` Artem Bityutskiy
0 siblings, 2 replies; 5+ messages in thread
From: Adrian Hunter @ 2010-09-07 10:23 UTC (permalink / raw)
To: dedekind1@gmail.com; +Cc: linux-mtd@lists.infradead.org, Arno Steffen
Artem Bityutskiy wrote:
> On Tue, 2010-09-07 at 11:36 +0300, Artem Bityutskiy wrote:
>> From: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
>>
>> When mkfs.ubifs is used with -r dir, it does not make the root UBIFS
>> inode uid/gid/permissions to be equivalent to dir's permissions, but
>> it makes root inode permissions to be equivalent to uid = git = 0
>> (root) and permissions = u+rwx go+rx.
>>
>> This patch changes the behavior and makes mkfs.ubifs use the
>> permissions of the directory containing the original files on the host.
>> I.e., it will be <dir>'s uid/git/permissions if case of mkfs.ubifs
>> -r <dir>.
>>
>> This patch is a bit dangerous because it changes the behavior and may
>> have security implications if someone used the older version, relied
>> on this bug, and upgrades to the newer version.
>>
>> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
>
> All mkfs.ubifs users should take a look at this - should we apply this
> patch? I'm still in doubt...
>
I do not agree with changing the behaviour. It should be a new option,
and you could add a warning explaining what the root inode permissions
are and why e.g.
Warning: Option ?? not used. Setting root inode permissions to blah
Warning: Option ?? used. Setting root inode permissions to blah
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: NOTE! mkfs.ubifs
2010-09-07 10:23 ` Adrian Hunter
@ 2010-09-08 5:55 ` Artem Bityutskiy
2010-09-08 8:18 ` Artem Bityutskiy
1 sibling, 0 replies; 5+ messages in thread
From: Artem Bityutskiy @ 2010-09-08 5:55 UTC (permalink / raw)
To: Adrian Hunter; +Cc: linux-mtd@lists.infradead.org, Arno Steffen
On Tue, 2010-09-07 at 13:23 +0300, Adrian Hunter wrote:
> Artem Bityutskiy wrote:
> > On Tue, 2010-09-07 at 11:36 +0300, Artem Bityutskiy wrote:
> >> From: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
> >>
> >> When mkfs.ubifs is used with -r dir, it does not make the root UBIFS
> >> inode uid/gid/permissions to be equivalent to dir's permissions, but
> >> it makes root inode permissions to be equivalent to uid = git = 0
> >> (root) and permissions = u+rwx go+rx.
> >>
> >> This patch changes the behavior and makes mkfs.ubifs use the
> >> permissions of the directory containing the original files on the host.
> >> I.e., it will be <dir>'s uid/git/permissions if case of mkfs.ubifs
> >> -r <dir>.
> >>
> >> This patch is a bit dangerous because it changes the behavior and may
> >> have security implications if someone used the older version, relied
> >> on this bug, and upgrades to the newer version.
> >>
> >> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
> >
> > All mkfs.ubifs users should take a look at this - should we apply this
> > patch? I'm still in doubt...
> >
>
> I do not agree with changing the behaviour. It should be a new option,
> and you could add a warning explaining what the root inode permissions
> are and why e.g.
But on the other hand, a separate option looks silly... Would be nice to
somehow slowly deprecate current behavior...
> Warning: Option ?? not used. Setting root inode permissions to blah
>
> Warning: Option ?? used. Setting root inode permissions to blah
--
Best Regards,
Artem Bityutskiy (Битюцкий Артём)
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: NOTE! mkfs.ubifs
2010-09-07 10:23 ` Adrian Hunter
2010-09-08 5:55 ` Artem Bityutskiy
@ 2010-09-08 8:18 ` Artem Bityutskiy
1 sibling, 0 replies; 5+ messages in thread
From: Artem Bityutskiy @ 2010-09-08 8:18 UTC (permalink / raw)
To: Adrian Hunter; +Cc: linux-mtd@lists.infradead.org, Arno Steffen
On Tue, 2010-09-07 at 13:23 +0300, Adrian Hunter wrote:
> I do not agree with changing the behaviour. It should be a new option,
> and you could add a warning explaining what the root inode permissions
> are and why e.g.
>
> Warning: Option ?? not used. Setting root inode permissions to blah
>
> Warning: Option ?? used. Setting root inode permissions to blah
Sent you v2 of this patch with an alternative (less harsh) solution.
--
Best Regards,
Artem Bityutskiy (Артём Битюцкий)
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2010-09-08 8:19 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-07 8:36 [PATCH] mkfs.ubifs: do not override root inode permissions Artem Bityutskiy
2010-09-07 9:11 ` NOTE! mkfs.ubifs Artem Bityutskiy
2010-09-07 10:23 ` Adrian Hunter
2010-09-08 5:55 ` Artem Bityutskiy
2010-09-08 8:18 ` Artem Bityutskiy
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).