mount --make-private

https://github.com/Kicksecure/security-misc/issues/172
This commit is contained in:
Patrick Schleizer 2024-02-22 09:13:56 -05:00
parent c0f98b05b6
commit 44a15cd97d
No known key found for this signature in database
GPG Key ID: CB8D50BB77BB3C48

View File

@ -187,12 +187,12 @@ remount_secure() {
if findmnt --noheadings "$mount_folder" >/dev/null ; then if findmnt --noheadings "$mount_folder" >/dev/null ; then
$output_command "INFO: '$mount_folder' already mounted, therefore using remount." $output_command "INFO: '$mount_folder' already mounted, therefore using remount."
$output_command INFO: Executing: mount --options "remount,${intended_mount_options}" "$mount_folder" $output_command INFO: Executing: mount --make-private --options "remount,${intended_mount_options}" "$mount_folder"
mount --options "remount,${intended_mount_options}" "$mount_folder" || exit_code=100 mount --make-private --options "remount,${intended_mount_options}" "$mount_folder" || exit_code=100
else else
$output_command "INFO: '$mount_folder' not yet mounted, therefore using mount bind." $output_command "INFO: '$mount_folder' not yet mounted, therefore using mount bind."
$output_command INFO: Executing: mount --options "$intended_mount_options" --bind "$mount_folder" "$mount_folder" $output_command INFO: Executing: mount --make-private --options "$intended_mount_options" --bind "$mount_folder" "$mount_folder"
mount --options "$intended_mount_options" --bind "$mount_folder" "$mount_folder" || exit_code=101 mount --make-private --options "$intended_mount_options" --bind "$mount_folder" "$mount_folder" || exit_code=101
fi fi
new_mount_options="$(findmnt --noheadings --output options -- "$mount_folder")" || true new_mount_options="$(findmnt --noheadings --output options -- "$mount_folder")" || true