Skip to content

Commit 72a2a5d

Browse files
alacukupoiana
authored andcommitted
feat(scap-open): check btf support using scap-open
Signed-off-by: Aldo Lacuku <[email protected]>
1 parent 5a125db commit 72a2a5d

File tree

2 files changed

+6
-24
lines changed

2 files changed

+6
-24
lines changed

ansible-playbooks/group_vars/all/vars.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ machines:
2222
- {name: "amazonlinux2-5.10", kernel: "therealbobo/amazonlinux2-kernel:5.10-x86_64", rootfs: "therealbobo/amazonlinux2-image:5.10-x86_64", arch: "x86_64"}
2323
- {name: "amazonlinux2-5.15", kernel: "therealbobo/amazonlinux2-kernel:5.15-x86_64", rootfs: "therealbobo/amazonlinux2-image:5.15-x86_64", arch: "x86_64"}
2424
- {name: "amazonlinux2-5.4", kernel: "therealbobo/amazonlinux2-kernel:5.4-x86_64", rootfs: "therealbobo/amazonlinux2-image:5.4-x86_64", arch: "x86_64"}
25-
- {name: "archlinux-5.18", kernel: "therealbobo/archlinux-kernel:5.18-x86_64", rootfs: "therealbobo/archlinux-image:5.18-x86_64", arch: "x86_64"}
2625
- {name: "archlinux-6.0", kernel: "therealbobo/archlinux-kernel:6.0-x86_64", rootfs: "therealbobo/archlinux-image:6.0-x86_64", arch: "x86_64"}
2726
- {name: "centos-3.10", kernel: "therealbobo/centos-kernel:3.10-x86_64", rootfs: "therealbobo/centos-image:3.10-x86_64", arch: "x86_64"}
2827
- {name: "centos-4.18", kernel: "therealbobo/centos-kernel:4.18-x86_64", rootfs: "therealbobo/centos-image:4.18-x86_64", arch: "x86_64"}

ansible-playbooks/roles/scap_open/tasks/main.yml

Lines changed: 6 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -16,33 +16,16 @@
1616

1717
- name: Check Modern Bpf Support
1818
block:
19-
- name: Check BTF support
20-
ansible.builtin.stat:
21-
path: /sys/kernel/btf/vmlinux
22-
register: btf_support
23-
24-
- name: Look up for BPF_MAP_TYPE_RINGBUF
25-
ansible.builtin.lineinfile:
26-
path: /usr/include/linux/bpf.h
27-
regex: BPF_MAP_TYPE_RINGBUF*
28-
state: absent
29-
changed_when: false
30-
check_mode: 'yes'
31-
register: ringbuf_present
32-
33-
- name: Look up for BPF_PROG_TYPE_TRACING
34-
ansible.builtin.lineinfile:
35-
path: /usr/include/linux/bpf.h
36-
regex: BPF_PROG_TYPE_TRACING*
37-
state: absent
19+
- name: Check modern-bpf support
20+
ansible.builtin.command:
21+
cmd: /tmp/scap-open --num_events 0 --modern_bpf
22+
register: result
3823
changed_when: false
39-
check_mode: 'yes'
40-
register: tracing_present
41-
24+
rescue:
4225
- name: Enable Modern Bpf support
4326
ansible.builtin.set_fact:
4427
modern_bpf_supported: true
45-
when: btf_support.stat.exists and ringbuf_present.found and tracing_present.found
28+
when: result.rc != 95
4629

4730
- name: Check Old Bpf Support
4831
block:

0 commit comments

Comments
 (0)