This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- config_def 2024-12-14 16:45:05.479185391 +0530 | |
+++ config_dbgk-ti-try1 2024-12-14 17:30:41.836810933 +0530 | |
@@ -19,6 +19,7 @@ | |
CONFIG_CC_HAS_ASM_INLINE=y | |
CONFIG_CC_HAS_NO_PROFILE_FN_ATTR=y | |
CONFIG_PAHOLE_VERSION=125 | |
+CONFIG_CONSTRUCTORS=y | |
CONFIG_IRQ_WORK=y | |
CONFIG_BUILDTIME_TABLE_SORT=y | |
CONFIG_THREAD_INFO_IN_TASK=y |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Source material: | |
http://security.stackexchange.com/questions/24444/what-is-the-most-hardened-set-of-options-for-gcc-compiling-c-c | |
https://wiki.gentoo.org/wiki/Hardened_Gentoo | |
https://wiki.debian.org/Hardening | |
================================================================================================================> | |
GCC Security related flags and options: | |
CFLAGS="-fPIE -fstack-protector-all -D_FORTIFY_SOURCE=2" | |
LDFLAGS="-Wl,-z,now -Wl,-z,relro" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Makefile | |
# *************************************************************** | |
# Brief Description: | |
# A 'better' Makefile template for Linux LKMs (Loadable Kernel Modules); besides | |
# the 'usual' targets (the build, install and clean), we incorporate targets to | |
# do useful (and indeed required) stuff like: | |
# - adhering to kernel coding style (indent+checkpatch) | |
# - several static analysis targets (via sparse, gcc, flawfinder, cppcheck) | |
# - two _dummy_ dynamic analysis targets (KASAN, LOCKDEP); just to remind you! | |
# - a packaging (.tar.xz) target and |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Dec 20 11:08:50 osboxes kernel: Oops: 0000 [#1] PREEMPT SMP PTI | |
Dec 20 11:08:50 osboxes kernel: CPU: 1 PID: 295 Comm: systemd-udevd Not tainted 6.1.0-lkp2e-01+ #2 | |
Dec 20 11:08:50 osboxes kernel: Hardware name: innotek GmbH VirtualBox/VirtualBox, BIOS VirtualBox 12/01/2006 | |
Dec 20 11:08:50 osboxes kernel: RIP: 0010:ttm_bo_move_memcpy+0x15f/0x2e0 [ttm] | |
Dec 20 11:08:50 osboxes kernel: Code: 89 c6 0f 84 e2 00 00 00 49 81 fe 00 f0 ff ff 0f 87 7a 01 00 00 49 8b 06 0f b6 40 10 3c 01 0f 87 41 63 00 00 a8 01 75 6c 31 ff <8b> 71 0c 48 89 da 4c 89 f1 e8 63 fb ff ff 49 8b 06 44 0f b6 70 10 | |
Dec 20 11:08:50 osboxes kernel: RSP: 0018:ffffb2a0406f71a8 EFLAGS: 00010246 | |
Dec 20 11:08:50 osboxes kernel: RAX: 0000000000000001 RBX: ffffb2a0406f71c8 RCX: 0000000000000000 | |
Dec 20 11:08:50 osboxes kernel: RDX: ffff963705e97ba0 RSI: 0000000000000000 RDI: 0000000000000001 | |
Dec 20 11:08:50 osboxes kernel: RBP: ffffb2a0406f7238 R08: 0000000000000000 R09: 00000000000e03e7 | |
Dec 20 11:08:50 osboxes kernel: R10: ffffb2a041c01000 R11: 00000000000 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
---------------------------------------------------------------------------------------------------------------- | |
Kaiwan N Billimoria, kaiwanTECH : opensource GitHub repos for source code | |
---------------------------------------------------------------------------------------------------------------- | |
<<------- My book repos ------->> | |
Linux Kernel Programming, 2E (2nd Edition) | |
- A comprehensive guide to kernel internals, writing kernel modules, and kernel synchronization | |
Packt, Feb 2024 | |
https://github.com/PacktPublishing/Linux-Kernel-Programming_2E |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Aarch64 | |
DUT: Raspberry Pi 3B+ | |
- via the LLKD ch7/show_kernel_seg LKM: | |
[...] | |
[ 4171.867794] llkd_minsysinfo(): minimal platform info: | |
CPU: Aarch64, little-endian; 64-bit OS. | |
[ 4171.867798] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Aim: to list all the Linux kernel APIs of the format | |
foo_register_driver(); | |
With a good bit of scripting foo within the drivers/ dir, I got these APIs (from 5.4.0); | |
(am unsure how accurate this is though...): | |
acpi_button_register_driver | |
cnic_register_driver | |
cpufreq_register_driver | |
cpuidle_register_driver | |
cx8802_register_driver |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-------------------------------------------- | |
To get timestamp in a useful format: | |
date +%a_%d_%m_%Y_%H%M | |
Eg. o/p: | |
$ date +%a_%d_%m_%Y_%H%M | |
Thu_06_12_2018_0737 | |
$ | |
-------------------------------------------- | |
Shell scripting: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
errno.h - C Error Codes in Linux | |
All the Linux/C error codes are listed below. | |
I occasionally google C error codes, but always end up grepping through /usr/include to find the answer. | |
To save myself, and a few others, some time in the future, here they are: | |
Include file :: /usr/include/asm-generic/errno-base.h | |
#ifndef _ASM_GENERIC_ERRNO_BASE_H | |
#define _ASM_GENERIC_ERRNO_BASE_H |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |