mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-23 09:51:57 -05:00
dd59fe35c7
The whole concept of Jails was far more complicated than I actually want it to be, so let's reduce the complexity of how it works from now on. Please note that we always leaked the attach count of a Jail object in the fork syscall if it failed midway. Instead, we should have attach to the jail just before registering the new Process, so we don't need to worry about unsuccessful Process creation. The reduction of complexity in regard to jails means that instead of relying on jails to provide PID isolation, we could simplify the whole idea of them to be a simple SetOnce, and let the ProcessList (now called ScopedProcessList) to be responsible for this type of isolation. Therefore, we apply the following changes to do so: - We make the Jail concept no longer a class of its own. Instead, we simplify the idea of being jailed to a simple ProtectedValues boolean flag. This means that we no longer check of matching jail pointers anywhere in the Kernel code. To set a process as jailed, a new prctl option was added to set a Kernel SetOnce boolean flag (so it cannot change ever again). - We provide Process & Thread methods to iterate over process lists. A process can either iterate on the global process list, or if it's attached to a scoped process list, then only over that list. This essentially replaces the need of checking the Jail pointer of a process when iterating over process lists.
108 lines
2.1 KiB
C++
108 lines
2.1 KiB
C++
/*
|
|
* Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <AK/DistinctNumeric.h>
|
|
#include <Kernel/API/POSIX/sys/types.h>
|
|
|
|
namespace Kernel {
|
|
|
|
enum class LockRank;
|
|
|
|
class BlockDevice;
|
|
class CharacterDevice;
|
|
class Coredump;
|
|
class Credentials;
|
|
class CustodyBase;
|
|
class Custody;
|
|
class Device;
|
|
class DeviceControlDevice;
|
|
class DiskCache;
|
|
class DoubleBuffer;
|
|
class File;
|
|
class FATInode;
|
|
class OpenFileDescription;
|
|
class DisplayConnector;
|
|
class FileSystem;
|
|
class FutexQueue;
|
|
class IPv4Socket;
|
|
class Inode;
|
|
class InodeIdentifier;
|
|
class InodeWatcher;
|
|
class MountFile;
|
|
class KBuffer;
|
|
class KString;
|
|
class LocalSocket;
|
|
class LoopDevice;
|
|
class Mutex;
|
|
class MasterPTY;
|
|
class Mount;
|
|
class PerformanceEventBuffer;
|
|
class PowerStateSwitchTask;
|
|
class ProcFS;
|
|
class ProcFSInode;
|
|
class Process;
|
|
class ProcessGroup;
|
|
class RAMFS;
|
|
template<LockRank Rank>
|
|
class RecursiveSpinlock;
|
|
class Scheduler;
|
|
class ScopedProcessList;
|
|
class Socket;
|
|
class StorageManagement;
|
|
class SysFS;
|
|
class SysFSDirectory;
|
|
class SysFSRootDirectory;
|
|
class SysFSBusDirectory;
|
|
class SysFSDevicesDirectory;
|
|
class SysFSDirectoryInode;
|
|
class SysFSInode;
|
|
class TCPSocket;
|
|
class TTY;
|
|
class Thread;
|
|
class ThreadTracer;
|
|
class RAMFSInode;
|
|
class UDPSocket;
|
|
class UserOrKernelBuffer;
|
|
class VFSRootContext;
|
|
class VirtualFileSystem;
|
|
class WaitQueue;
|
|
class WorkQueue;
|
|
|
|
namespace Memory {
|
|
class AddressSpace;
|
|
class AnonymousVMObject;
|
|
class InodeVMObject;
|
|
class MappedROM;
|
|
class MemoryManager;
|
|
class PageDirectory;
|
|
class PhysicalRAMPage;
|
|
class PhysicalRegion;
|
|
class PrivateInodeVMObject;
|
|
class Region;
|
|
class SharedInodeVMObject;
|
|
class VMObject;
|
|
class VirtualRange;
|
|
}
|
|
|
|
template<LockRank Rank>
|
|
class Spinlock;
|
|
template<typename LockType>
|
|
class SpinlockLocker;
|
|
|
|
struct InodeMetadata;
|
|
struct TrapFrame;
|
|
|
|
AK_TYPEDEF_DISTINCT_ORDERED_ID(pid_t, ProcessID);
|
|
AK_TYPEDEF_DISTINCT_ORDERED_ID(pid_t, ThreadID);
|
|
AK_TYPEDEF_DISTINCT_ORDERED_ID(pid_t, SessionID);
|
|
AK_TYPEDEF_DISTINCT_ORDERED_ID(pid_t, ProcessGroupID);
|
|
|
|
AK_TYPEDEF_DISTINCT_ORDERED_ID(uid_t, UserID);
|
|
AK_TYPEDEF_DISTINCT_ORDERED_ID(gid_t, GroupID);
|
|
|
|
}
|