#define pr_fmt(fmt) …
#include <linux/lsm_hooks.h>
#include <linux/module.h>
#include <linux/ptrace.h>
#include <linux/sched/task_stack.h>
#include <linux/security.h>
#include <uapi/linux/lsm.h>
#include "lsm.h"
int safesetid_initialized __initdata;
struct setid_ruleset __rcu *safesetid_setuid_rules;
struct setid_ruleset __rcu *safesetid_setgid_rules;
enum sid_policy_type _setid_policy_lookup(struct setid_ruleset *policy,
kid_t src, kid_t dst)
{ … }
static enum sid_policy_type setid_policy_lookup(kid_t src, kid_t dst, enum setid_type new_type)
{ … }
static int safesetid_security_capable(const struct cred *cred,
struct user_namespace *ns,
int cap,
unsigned int opts)
{ … }
static bool id_permitted_for_cred(const struct cred *old, kid_t new_id, enum setid_type new_type)
{ … }
static int safesetid_task_fix_setuid(struct cred *new,
const struct cred *old,
int flags)
{ … }
static int safesetid_task_fix_setgid(struct cred *new,
const struct cred *old,
int flags)
{ … }
static int safesetid_task_fix_setgroups(struct cred *new, const struct cred *old)
{ … }
static const struct lsm_id safesetid_lsmid = …;
static struct security_hook_list safesetid_security_hooks[] = …;
static int __init safesetid_security_init(void)
{ … }
DEFINE_LSM(safesetid_security_init) = …;