For a reason that I don't understand, the profile transition needs to
be done on the current process. Changing the attributes for a
subsequent execve(2) (with /proc/self/attr/exec) will cause the kernel
to set AT_SECURE in the auxiliary vector and thus secure_getenv(3)
inside libnvidia-container will return NULL.
Signed-off-by: Felix Abecassis <fabecassis@nvidia.com>
done
fi
+if [ -d "/sys/kernel/security/apparmor" ]; then
+ # Try to transition to the unconfined AppArmor profile.
+ echo "changeprofile unconfined" > /proc/self/attr/current || true
+fi
+
set -x
exec nvidia-container-cli ${global_args[@]} configure ${configure_args[@]} "${LXC_ROOTFS_MOUNT}"