Mirror of strace – the linux syscall tracer
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

netlink_selinux.c 1.0KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /*
  2. * Copyright (c) 2017 JingPiao Chen <chenjingpiao@gmail.com>
  3. * Copyright (c) 2017-2018 The strace developers.
  4. * All rights reserved.
  5. *
  6. * SPDX-License-Identifier: LGPL-2.1-or-later
  7. */
  8. #include "defs.h"
  9. #include "netlink.h"
  10. #include "print_fields.h"
  11. #include <linux/selinux_netlink.h>
  12. bool
  13. decode_netlink_selinux(struct tcb *const tcp,
  14. const struct nlmsghdr *const nlmsghdr,
  15. const kernel_ulong_t addr,
  16. const unsigned int len)
  17. {
  18. switch (nlmsghdr->nlmsg_type) {
  19. case SELNL_MSG_SETENFORCE: {
  20. struct selnl_msg_setenforce msg;
  21. if (len < sizeof(msg))
  22. printstr_ex(tcp, addr, len, QUOTE_FORCE_HEX);
  23. else if (!umove_or_printaddr(tcp, addr, &msg)) {
  24. PRINT_FIELD_D("{", msg, val);
  25. tprints("}");
  26. }
  27. break;
  28. }
  29. case SELNL_MSG_POLICYLOAD: {
  30. struct selnl_msg_policyload msg;
  31. if (len < sizeof(msg))
  32. printstr_ex(tcp, addr, len, QUOTE_FORCE_HEX);
  33. else if (!umove_or_printaddr(tcp, addr, &msg)) {
  34. PRINT_FIELD_U("{", msg, seqno);
  35. tprints("}");
  36. }
  37. break;
  38. }
  39. default:
  40. return false;
  41. }
  42. return true;
  43. }