Remove access to the root FS from lua

On linux / is mounted to /rootfs in RageFile, which allows access to the
_whole_ filesystem from lua. This means themes and mod files can
re-write user data and extract files via USB profiles.

/rootfs was only added for internal use by the alsa, oss and memory card
drivers, so it can be easily replaced with direct fstream file access.
This commit is contained in:
Martin Natano
2022-02-06 15:31:31 +01:00
parent 2005713a32
commit 7d8ff85018
5 changed files with 32 additions and 31 deletions
-10
View File
@@ -386,16 +386,6 @@ RString ArchHooks_Unix::GetClipboard()
static LocalizedString COULDNT_FIND_SONGS( "ArchHooks_Unix", "Couldn't find 'Songs'" );
void ArchHooks::MountInitialFilesystems( const RString &sDirOfExecutable )
{
#if defined(UNIX)
/* Mount the root filesystem, so we can read files in /proc, /etc, and so on.
* This is /rootfs, not /root, to avoid confusion with root's home directory. */
FILEMAN->Mount( "dir", "/", "/rootfs" );
/* Mount /proc, so Alsa9Buf::GetSoundCardDebugInfo() and others can access it.
* (Deprecated; use rootfs.) */
FILEMAN->Mount( "dir", "/proc", "/proc" );
#endif
RString Root;
struct stat st;
if( !stat(sDirOfExecutable + "/Packages", &st) && st.st_mode&S_IFDIR )