mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-11 04:18:39 +08:00
LSM: Pass original mount flags to security_sb_mount().
This patch allows LSM modules to determine based on original mount flags passed to mount(). A LSM module can get masked mount flags (if needed) by flags &= ~(MS_NOSUID | MS_NOEXEC | MS_NODEV | MS_ACTIVE | MS_NOATIME | MS_NODIRATIME | MS_RELATIME| MS_KERNMOUNT | MS_STRICTATIME); Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> Signed-off-by: James Morris <jmorris@namei.org>
This commit is contained in:
parent
8b8efb4403
commit
a27ab9f26b
@ -1921,6 +1921,16 @@ long do_mount(char *dev_name, char *dir_name, char *type_page,
|
|||||||
if (data_page)
|
if (data_page)
|
||||||
((char *)data_page)[PAGE_SIZE - 1] = 0;
|
((char *)data_page)[PAGE_SIZE - 1] = 0;
|
||||||
|
|
||||||
|
/* ... and get the mountpoint */
|
||||||
|
retval = kern_path(dir_name, LOOKUP_FOLLOW, &path);
|
||||||
|
if (retval)
|
||||||
|
return retval;
|
||||||
|
|
||||||
|
retval = security_sb_mount(dev_name, &path,
|
||||||
|
type_page, flags, data_page);
|
||||||
|
if (retval)
|
||||||
|
goto dput_out;
|
||||||
|
|
||||||
/* Default to relatime unless overriden */
|
/* Default to relatime unless overriden */
|
||||||
if (!(flags & MS_NOATIME))
|
if (!(flags & MS_NOATIME))
|
||||||
mnt_flags |= MNT_RELATIME;
|
mnt_flags |= MNT_RELATIME;
|
||||||
@ -1945,16 +1955,6 @@ long do_mount(char *dev_name, char *dir_name, char *type_page,
|
|||||||
MS_NOATIME | MS_NODIRATIME | MS_RELATIME| MS_KERNMOUNT |
|
MS_NOATIME | MS_NODIRATIME | MS_RELATIME| MS_KERNMOUNT |
|
||||||
MS_STRICTATIME);
|
MS_STRICTATIME);
|
||||||
|
|
||||||
/* ... and get the mountpoint */
|
|
||||||
retval = kern_path(dir_name, LOOKUP_FOLLOW, &path);
|
|
||||||
if (retval)
|
|
||||||
return retval;
|
|
||||||
|
|
||||||
retval = security_sb_mount(dev_name, &path,
|
|
||||||
type_page, flags, data_page);
|
|
||||||
if (retval)
|
|
||||||
goto dput_out;
|
|
||||||
|
|
||||||
if (flags & MS_REMOUNT)
|
if (flags & MS_REMOUNT)
|
||||||
retval = do_remount(&path, flags & ~MS_REMOUNT, mnt_flags,
|
retval = do_remount(&path, flags & ~MS_REMOUNT, mnt_flags,
|
||||||
data_page);
|
data_page);
|
||||||
|
Loading…
Reference in New Issue
Block a user