Skip to content

Commit bced952

Browse files
H. Peter AnvinJames Morris
authored andcommitted
security: remove security_sb_post_mountroot hook
The security_sb_post_mountroot() hook is long-since obsolete, and is fundamentally broken: it is never invoked if someone uses initramfs. This is particularly damaging, because the existence of this hook has been used as motivation for not using initramfs. Stephen Smalley confirmed on 2007-07-19 that this hook was originally used by SELinux but can now be safely removed: http://marc.info/?l=linux-kernel&m=118485683612916&w=2 Cc: Stephen Smalley <[email protected]> Cc: James Morris <[email protected]> Cc: Eric Paris <[email protected]> Cc: Chris Wright <[email protected]> Signed-off-by: H. Peter Anvin <[email protected]> Signed-off-by: James Morris <[email protected]>
1 parent 42d7896 commit bced952

File tree

4 files changed

+0
-20
lines changed

4 files changed

+0
-20
lines changed

include/linux/security.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -249,9 +249,6 @@ struct request_sock;
249249
* @mnt contains the mounted file system.
250250
* @flags contains the new filesystem flags.
251251
* @data contains the filesystem-specific data.
252-
* @sb_post_mountroot:
253-
* Update the security module's state when the root filesystem is mounted.
254-
* This hook is only called if the mount was successful.
255252
* @sb_post_addmount:
256253
* Update the security module's state when a filesystem is mounted.
257254
* This hook is called any time a mount is successfully grafetd to
@@ -1257,7 +1254,6 @@ struct security_operations {
12571254
void (*sb_umount_busy) (struct vfsmount * mnt);
12581255
void (*sb_post_remount) (struct vfsmount * mnt,
12591256
unsigned long flags, void *data);
1260-
void (*sb_post_mountroot) (void);
12611257
void (*sb_post_addmount) (struct vfsmount * mnt,
12621258
struct nameidata * mountpoint_nd);
12631259
int (*sb_pivotroot) (struct nameidata * old_nd,
@@ -1524,7 +1520,6 @@ int security_sb_umount(struct vfsmount *mnt, int flags);
15241520
void security_sb_umount_close(struct vfsmount *mnt);
15251521
void security_sb_umount_busy(struct vfsmount *mnt);
15261522
void security_sb_post_remount(struct vfsmount *mnt, unsigned long flags, void *data);
1527-
void security_sb_post_mountroot(void);
15281523
void security_sb_post_addmount(struct vfsmount *mnt, struct nameidata *mountpoint_nd);
15291524
int security_sb_pivotroot(struct nameidata *old_nd, struct nameidata *new_nd);
15301525
void security_sb_post_pivotroot(struct nameidata *old_nd, struct nameidata *new_nd);
@@ -1813,9 +1808,6 @@ static inline void security_sb_post_remount (struct vfsmount *mnt,
18131808
unsigned long flags, void *data)
18141809
{ }
18151810

1816-
static inline void security_sb_post_mountroot (void)
1817-
{ }
1818-
18191811
static inline void security_sb_post_addmount (struct vfsmount *mnt,
18201812
struct nameidata *mountpoint_nd)
18211813
{ }

init/do_mounts.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -470,6 +470,5 @@ void __init prepare_namespace(void)
470470
out:
471471
sys_mount(".", "/", NULL, MS_MOVE, NULL);
472472
sys_chroot(".");
473-
security_sb_post_mountroot();
474473
}
475474

security/dummy.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -225,11 +225,6 @@ static void dummy_sb_post_remount (struct vfsmount *mnt, unsigned long flags,
225225
}
226226

227227

228-
static void dummy_sb_post_mountroot (void)
229-
{
230-
return;
231-
}
232-
233228
static void dummy_sb_post_addmount (struct vfsmount *mnt, struct nameidata *nd)
234229
{
235230
return;
@@ -1017,7 +1012,6 @@ void security_fixup_ops (struct security_operations *ops)
10171012
set_to_dummy_if_null(ops, sb_umount_close);
10181013
set_to_dummy_if_null(ops, sb_umount_busy);
10191014
set_to_dummy_if_null(ops, sb_post_remount);
1020-
set_to_dummy_if_null(ops, sb_post_mountroot);
10211015
set_to_dummy_if_null(ops, sb_post_addmount);
10221016
set_to_dummy_if_null(ops, sb_pivotroot);
10231017
set_to_dummy_if_null(ops, sb_post_pivotroot);

security/security.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -288,11 +288,6 @@ void security_sb_post_remount(struct vfsmount *mnt, unsigned long flags, void *d
288288
security_ops->sb_post_remount(mnt, flags, data);
289289
}
290290

291-
void security_sb_post_mountroot(void)
292-
{
293-
security_ops->sb_post_mountroot();
294-
}
295-
296291
void security_sb_post_addmount(struct vfsmount *mnt, struct nameidata *mountpoint_nd)
297292
{
298293
security_ops->sb_post_addmount(mnt, mountpoint_nd);

0 commit comments

Comments
 (0)