// Since Linux 6.10
DECL_TEMPLATE(linux, sys_mseal);
+DECL_TEMPLATE(linux, sys_lsm_get_self_attr);
+DECL_TEMPLATE(linux, sys_lsm_set_self_attr);
/* ---------------------------------------------------------------------
Wrappers for sockets and ipc-ery. These are split into standalone
LINX_(__NR_fchmodat2, sys_fchmodat2), // 452
LINXY(__NR_statmount, sys_statmount), // 457
LINXY(__NR_listmount, sys_listmount), // 458
+ LINXY(__NR_lsm_get_self_attr, sys_lsm_get_self_attr), // 459
+ LINX_(__NR_lsm_set_self_attr, sys_lsm_set_self_attr), // 460
LINX_(__NR_mseal, sys_mseal), // 462
};
LINX_(__NR_fchmodat2, sys_fchmodat2), // 452
LINXY(__NR_statmount, sys_statmount), // 457
LINXY(__NR_listmount, sys_listmount), // 458
+ LINXY(__NR_lsm_get_self_attr, sys_lsm_get_self_attr), // 459
+ LINX_(__NR_lsm_set_self_attr, sys_lsm_set_self_attr), // 460
LINX_(__NR_mseal, sys_mseal), // 462
};
LINX_(__NR_fchmodat2, sys_fchmodat2), // 452
LINXY(__NR_statmount, sys_statmount), // 457
LINXY(__NR_listmount, sys_listmount), // 458
+ LINXY(__NR_lsm_get_self_attr, sys_lsm_get_self_attr), // 459
+ LINX_(__NR_lsm_set_self_attr, sys_lsm_set_self_attr), // 460
LINX_(__NR_mseal, sys_mseal), // 462
};
}
}
+PRE(sys_lsm_get_self_attr)
+{
+ // * sys_lsm_get_self_attr - Return current task's security module attributes
+ // * @attr: which attribute to return
+ // * @ctx: the user-space destination for the information, or NULL
+ // * @size: pointer to the size of space available to receive the data
+ // * @flags: special handling options. LSM_FLAG_SINGLE indicates that only
+ // * attributes associated with the LSM identified in the passed @ctx be
+ // * reported.
+ // SYSCALL_DEFINE4(lsm_get_self_attr, unsigned int, attr, struct lsm_ctx __user *,
+ // ctx, u32 __user *, size, u32, flags)
+ PRINT("sys_lsm_get_self_attr ( %#" FMT_REGWORD "x, %#" FMT_REGWORD "x, %" FMT_REGWORD "u, %#" FMT_REGWORD "x)", ARG1, ARG2, ARG3, ARG4);
+ PRE_REG_READ4(long, "lsm_get_self_attr", unsigned int, attr, struct vki_lsm_ctx *, ctx, __vki_u32 *, size, __vki_u32, flags);
+ PRE_MEM_READ("lsm_get_self_attr(ctx)", ARG2, ARG3);
+}
+
+POST(sys_lsm_get_self_attr)
+{
+ if(ARG3 > 0)
+ {
+ POST_MEM_WRITE(ARG2, ARG3);
+ }
+}
+
+PRE(sys_lsm_set_self_attr)
+{
+ // * sys_lsm_set_self_attr - Set current task's security module attribute
+ // * @attr: which attribute to set
+ // * @ctx: the LSM contexts
+ // * @size: size of @ctx
+ // * @flags: reserved for future use
+ // SYSCALL_DEFINE4(lsm_set_self_attr, unsigned int, attr, struct lsm_ctx __user *,
+ // ctx, u32, size, u32, flags)
+ PRINT("sys_lsm_get_self_attr ( %#" FMT_REGWORD "x, %#" FMT_REGWORD "x, %" FMT_REGWORD "u, %#" FMT_REGWORD "x)", ARG1, ARG2, ARG3, ARG4);
+ PRE_REG_READ4(long, "lsm_set_self_attr", unsigned int, attr, struct vki_lsm_ctx *, ctx, __vki_u32 *, size, __vki_u32, flags);
+}
+
PRE(sys_syncfs)
{
*flags |= SfMayBlock;
LINX_(__NR_fchmodat2, sys_fchmodat2), // 452
LINXY(__NR_statmount, sys_statmount), // 457
LINXY(__NR_listmount, sys_listmount), // 458
+ LINXY(__NR_lsm_get_self_attr, sys_lsm_get_self_attr), // 459
+ LINX_(__NR_lsm_set_self_attr, sys_lsm_set_self_attr), // 460
LINX_(__NR_mseal, sys_mseal), // 462
};
LINXY (__NR_userfaultfd, sys_userfaultfd),
LINXY (__NR_statmount, sys_statmount),
LINXY (__NR_listmount, sys_listmount),
+ LINXY(__NR_lsm_get_self_attr, sys_lsm_get_self_attr),
+ LINX_(__NR_lsm_set_self_attr, sys_lsm_set_self_attr),
LINX_ (__NR_mseal, sys_mseal),
LINX_ (__NR_futex_waitv, sys_futex_waitv),
LINX_ (__NR_quotactl_fd, sys_quotactl_fd),
LINX_ (__NR_fchmodat2, sys_fchmodat2),
LINXY (__NR_statmount, sys_statmount),
LINXY (__NR_listmount, sys_listmount),
+ LINXY(__NR_lsm_get_self_attr, sys_lsm_get_self_attr),
+ LINX_(__NR_lsm_set_self_attr, sys_lsm_set_self_attr),
LINX_ (__NR_mseal, sys_mseal),
LINX_ (__NR_futex_waitv, sys_futex_waitv),
};
LINX_ (__NR_fchmodat2, sys_fchmodat2), // 452
LINXY (__NR_statmount, sys_statmount), // 457
LINXY (__NR_listmount, sys_listmount), // 458
+ LINXY(__NR_lsm_get_self_attr, sys_lsm_get_self_attr), // 459
+ LINX_(__NR_lsm_set_self_attr, sys_lsm_set_self_attr), // 460
LINX_ (__NR_mseal, sys_mseal), // 462
};
LINX_ (__NR_fchmodat2, sys_fchmodat2), // 452
LINXY (__NR_statmount, sys_statmount), // 457
LINXY (__NR_listmount, sys_listmount), // 458
+ LINXY(__NR_lsm_get_self_attr, sys_lsm_get_self_attr), // 459
+ LINX_(__NR_lsm_set_self_attr, sys_lsm_set_self_attr), // 460
LINX_ (__NR_mseal, sys_mseal), // 462
};
LINX_(__NR_fchmodat2, sys_fchmodat2), /* 452 */
LINXY(__NR_statmount, sys_statmount), /* 457 */
LINXY(__NR_listmount, sys_listmount), /* 458 */
+ LINXY(__NR_lsm_get_self_attr, sys_lsm_get_self_attr), /* 459 */
+ LINX_(__NR_lsm_set_self_attr, sys_lsm_set_self_attr), /* 460 */
LINX_(__NR_mseal, sys_mseal), /* 462 */
};
LINX_ (__NR_fchmodat2, sys_fchmodat2), // 452
LINXY (__NR_statmount, sys_statmount), // 457
LINXY (__NR_listmount, sys_listmount), // 458
+ LINXY(__NR_lsm_get_self_attr, sys_lsm_get_self_attr), // 459
+ LINX_(__NR_lsm_set_self_attr, sys_lsm_set_self_attr), // 460
LINX_ (__NR_mseal, sys_mseal), // 462
};
LINX_(__NR_fchmodat2, sys_fchmodat2), // 452
LINXY(__NR_statmount, sys_statmount), // 457
LINXY(__NR_listmount, sys_listmount), // 458
+ LINXY(__NR_lsm_get_self_attr, sys_lsm_get_self_attr), // 459
+ LINX_(__NR_lsm_set_self_attr, sys_lsm_set_self_attr), // 460
LINX_(__NR_mseal, sys_mseal), // 462
};
char str[]; /* Variable size part containing strings */
};
+//----------------------------------------------------------------------
+// From uapi/linux/lsm.h
+//----------------------------------------------------------------------
+
+struct vki_lsm_ctx {
+ __vki_u64 id;
+ __vki_u64 flags;
+ __vki_u64 len;
+ __vki_u64 ctx_len;
+ __vki_u8 ctx[]; /* __counted_by(ctx_len); */
+};
+
/*--------------------------------------------------------------------*/
/*--- end ---*/
/*--------------------------------------------------------------------*/
#define __NR_fchmodat2 452
#define __NR_statmount 457
#define __NR_listmount 458
+#define __NR_lsm_get_self_attr 459
+#define __NR_lsm_set_self_attr 460
#define __NR_mseal 462
#endif