We already have a clue about SELinux specific mount options in libmount, so
it makes sense to deduplicate the options as Linux kernel does not
support duplicate SELinux options. (SELinux kernel stuff somehow
ignores standard Linux mount conventions...)
Requested-by: Niels de Vos <ndevos@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
else
/* For normal mount we have translate the contexts */
se_fix = 1;
+
+ if (!se_rem) {
+ /* de-duplicate SELinux options */
+ mnt_optstr_deduplicate_option(&fs->fs_optstr, "context");
+ mnt_optstr_deduplicate_option(&fs->fs_optstr, "fscontext");
+ mnt_optstr_deduplicate_option(&fs->fs_optstr, "defcontext");
+ mnt_optstr_deduplicate_option(&fs->fs_optstr, "rootcontext");
+ mnt_optstr_deduplicate_option(&fs->fs_optstr, "seclabel");
+ }
#endif
while (!mnt_optstr_next_option(&next, &name, &namesz, &val, &valsz)) {