SELinux provides mandatory access control on Linux systems to confine processes and restrict what they can do. It works by labeling system resources like files, processes, and ports with security contexts. When a process tries to access a resource, SELinux checks if the process's security context is allowed to access the target resource based on the SELinux policy. This provides finer-grained access control than traditional Linux discretionary access control based on users and groups. The security context includes the SELinux user, role, and type (domain) that together determine the process's permissions.