Commit graph

507 commits

Author SHA1 Message Date
Adam_pi3
26f36ed495 Add a kprobe verification functionality
Add a new logic to the integrity verification routine verifying if the
kprobes are enabled and correctly run.
This commit makes kprobe verification functionality as an independent
module invoked by integrity verification routine as well as during
initialization to make sure kprobes are enabled and run as intended
(otherwise, initialization fails).
2022-12-04 21:31:22 +01:00
Solar Designer
7db7483880 CHANGES, README: Update with major changes since 0.9.5 2022-11-22 19:22:23 +01:00
Adam_pi3
1fc5312223 Add synchronization logic around sysctl interface
This commit fixes the race problem between 2+ concurrent sysctl updates.
It is part of the work related to #204
2022-11-19 19:55:46 +01:00
redp
2cd2c2bc00 add get_kprobe_maxactive to remaining kprobes
Co-authored-by: Solar Designer <solar@openwall.com>
2022-11-10 21:58:02 +01:00
redp
6736d568dc kretprobes.maxactive should depend on number of cores
Co-authored-by: Solar Designer <solar@openwall.com>
2022-11-10 21:58:02 +01:00
Solar Designer
3f7af09f5b UMH: Allow /usr/libexec/abrt-hook-ccpp for older Red Hat distros 2022-11-10 21:57:48 +01:00
Solar Designer
fc3545696b pINT: Make the real_cred check in p_cmp_tasks() unconditional
Fixes #240
2022-11-05 18:39:49 +01:00
Adam_pi3
ad03367344 Add support for new RHEL8.6+ kernels
Starting from RHEL8.6 4.18.0-372.32.1.el8_6 kernel struct text_poke_loc
is not exported and we need to correctly take this into account.
Previous RHEL8.6 kernels did not hide this structure so we need to find
some ways to disinguish them. We do it in this commit and it should fix #236
2022-11-05 18:38:12 +01:00
Vladimir D. Seleznev
a4e5c00f13 Add support for Kernel 5.19+ for aarch64
Since Linux Kernel 5.19 struct stackframe has been renamed to struct
unwind_state for arm64:

torvalds/linux@e9d75a0ba8
2022-11-05 14:15:44 +01:00
Vladimir D. Seleznev
8fbdbda372 Add support for RHEL 9.2 kernel
Reported-by: Alexey Gladkov <legion@altlinux.ru>
Signed-off-by: Vladimir D. Seleznev <vseleznv@altlinux.org>
2022-10-31 21:24:05 +01:00
Solar Designer
4da9ded1a2 CI: Re-enable AArch64 test, but without BTI 2022-10-29 16:06:17 +02:00
Solar Designer
f32f627950 Simplify our get_random_long() wrapper (only used with old kernels)
Fixes #234
2022-10-17 22:20:20 +02:00
Solar Designer
11553ec0df Notifiers: Fix typo in the value of P_M_SS_MORE_OFTEN_RATE
Noticed by Jason A. Donenfeld
2022-10-17 22:20:20 +02:00
Solar Designer
2241a32231 Don't depend on get_random_int(), which Linux 6.1+ dropped
Fixes #233
2022-10-17 22:20:20 +02:00
Adam_pi3
717137dbd2
Remove IOMMU verification on kernel 5.19+
IOMMU table infrastructure was removed by this commit
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=78013eaadf696d2105982abb4018fbae394ca08f

which breaks the way how LKRG could verify it.
This commit skips the IOMMU verification starting from kernels 5.19+
and fixes #226
2022-09-25 00:09:01 +00:00
mrl5
d7f079baa1 fix: umh - allow openrc cgroup release agent [#230]
closes #230
2022-09-11 03:34:53 +00:00
Vitaly Chikunov
b56b8758af CI: mkosi: Restore loading LKRG module from initrd
For (non-grub) BLS boot - install generated by Dracut initrd into
systemd-boot loader entry.

Man pages for curious details: systemd-boot(7), bootctl(1),
kernel-install(8).

Link: https://github.com/lkrg-org/lkrg/pull/228#issuecomment-1235403740
Fixes: db42541 ("CI: mkosi: Do not assume grub is installed")
Signed-off-by: Vitaly Chikunov <vt@altlinux.org>
2022-09-04 13:41:59 +02:00
Vitaly Chikunov
db42541477 CI: mkosi: Do not assume grub is installed
mkosi' "--boot-protocols is deprecated and has no effect anymore", thus
do not assume we will be booting using grub/bios.

Fixes: https://github.com/lkrg-org/lkrg/issues/227
Signed-off-by: Vitaly Chikunov <vt@altlinux.org>
2022-09-02 13:41:33 +02:00
Solar Designer
ff18ec6856 LKRG 0.9.5 2022-08-01 13:28:28 +02:00
Solar Designer
333ae0774e Revert "Logging: Use KERN_EMERG in place of KERN_CRIT"
This reverts commit dfb60a6eb2.
2022-08-01 13:13:25 +02:00
Solar Designer
c58cb52145 Simplify the new logic supporting OverlayFS 2022-07-29 10:35:23 -07:00
Solar Designer
9dd2a8d3f7 CI: Enable CodeQL for all branches (not just main) 2022-07-29 10:35:23 -07:00
Adam_pi3
6f3627e32c Rework the logic supporting OverlayFS/docker
The original logic was hooking 'ovl_create_or_link' function but it could be
inlined. This commit changes it by hooking 'ovl_dentry_is_whiteout' when
possible.

Fixes #215
2022-07-29 13:50:45 +02:00
Solar Designer
dfb60a6eb2 Logging: Use KERN_EMERG in place of KERN_CRIT
Fixes #222
2022-07-28 16:30:23 -07:00
Solar Designer
e773798649 kINT: Support variable length jump labels also for 5.10.133+
Extends b8ff7abcd0
Extends fb9e272f7d
Fixes #221
2022-07-28 16:30:23 -07:00
Vitaly Chikunov
09a156a53e CI: Remove EOL'ed Ubuntu releases
Impish is started to fail, because it's EOL'ed at July 14, 2022.
Hirsute is EOL'ed at January 20, 2022, but it started to fail only
recently.

Signed-off-by: Vitaly Chikunov <vt@altlinux.org>
2022-07-27 19:43:16 +02:00
Solar Designer
7bb9cf154e LKRG 0.9.4 2022-07-22 20:34:32 +02:00
Solar Designer
d8b0e8387e README: Add DKMS uninstall instructions 2022-07-22 20:33:58 +02:00
Solar Designer
cfc320a167 LICENSE: Update copyright years 2022-07-22 16:56:11 +02:00
Solar Designer
ce3016b49a pCFI: Increase severity of "Frame pointer is not on the stack" 2022-07-21 21:47:37 +02:00
Solar Designer
f5286727b4 pCFI: Avoid skipping of stack frame checks when CONFIG_UNWINDER_ORC
Fixes #210
2022-07-21 21:47:37 +02:00
Solar Designer
a14d81e81f Logging: Make logging of sysctl value changes more consistent
Skip logging on no change and include old values for interval and
log_level, like we do for others.

Fixes #211
2022-07-21 21:47:37 +02:00
Solar Designer
93eda28b8b Logging: kINT: Don't skip any checks regardless of log level
The checks we tried to skip updated "p_mod_bad_nr", which affected how we
treat further violations.

Amends 8b7d68a4c7
Fixes #212
2022-07-21 21:47:37 +02:00
Solar Designer
05369422f1 CHANGES: Update with major changes since 0.9.3 2022-07-20 17:57:37 +02:00
Solar Designer
49a3117542 Rename the module from p_lkrg to lkrg 2022-07-20 17:57:37 +02:00
Solar Designer
e4c46d7d6b copy-builtin.sh: Simplify the Makefile parsing command 2022-07-20 17:57:37 +02:00
yeggor
cbd4198943 Enable code scanning with CodeQL 2022-07-19 15:36:43 +00:00
RageLtMan
f267c369e8 Adapt copy-builtin.sh script for LKRG debug option
Changes to the Makefile enabling debug builds of LKRG resulted in
the copy-builtin script producing an errant Makefile inside the
target kernel tree.

Address this by creating a SECURITY_LKRG_DEBUG Kconfig option in
the Kconfig file and copy/update the relevant Makefile stanza into
the in-tree Makefile manually (vs extracting it from the source
Makefile and modifying in-flight).

Testing:
  Built in Arch chroot, verified prompt for new option and module
build in-tree.
2022-07-18 20:40:05 +02:00
Solar Designer
237ece7ef3 CI: Detect keywords ALERT, FAULT, FATAL in kernel messages 2022-07-17 20:39:31 +00:00
Solar Designer
0f0f74fbcb Logging: Wrap panic() in a macro, log an alert before panic 2022-07-17 20:39:31 +00:00
Solar Designer
4e7dd0951f Logging: Expose the STATE, DYING, FATAL categories 2022-07-17 20:39:31 +00:00
Solar Designer
8b7d68a4c7 Logging: kINT: Change extra module messages from ALERT to WATCH
It was inconsistent to produce "alerts" that did not invoke any response
action, whereas downgrading them to informational messages lets us skip
a lengthy block of checks at default log level.
2022-07-17 20:39:31 +00:00
Solar Designer
e3badfaf73 Logging: Revise, unify, and reduce duplication of logging and responses
Use macros, move logging and enforcement responses from callers into
called functions, remove where it was duplicate.

Unify our log and kernel panic messages.
2022-07-17 20:39:31 +00:00
Solar Designer
f4dc1e31a9 Unify kernel symbol lookups through introduction of a macro 2022-07-17 20:39:31 +00:00
Solar Designer
4b9a74ad51 Logging: Revise messages from sysctl handlers 2022-07-17 20:39:31 +00:00
Solar Designer
68f649bb0c Logging: Replace '\n' within log messages with ' ' (space character)
sed -i 's/\\n/ /g' src/modules/database/p_database.c src/modules/integrity_timer/p_integrity_timer.c
2022-07-17 20:39:31 +00:00
Solar Designer
33dfb1474f Logging: Move trailing '\n' to inside of p_print_log()
sed -i 's/\\n"/"/g' `fgrep -rl '\n"' src`

Followed by manual re-alignment of trailing backslashes in a few places,
and indeed the edit of p_print_log().
2022-07-17 20:39:31 +00:00
Solar Designer
7956c28836 Drop trailing '\n' from panic() messages
panic() removes and re-adds them anyway:

	if (len && buf[len - 1] == '\n')
		buf[len - 1] = '\0';

	pr_emerg("Kernel panic - not syncing: %s\n", buf);
2022-07-17 20:39:31 +00:00
Solar Designer
08ff518bf9 Logging: Have P_TRY_OFFLOAD_NOTIFIER() construct messages 2022-07-17 20:39:31 +00:00
Solar Designer
db46f714ed Logging: Consistently use p_debug_log() for P_LOG_DEBUG messages 2022-07-17 20:39:31 +00:00