eBPF-based security platform
AGENTS.md: name the poisons in <shirudo/misc.h> and <shirudo/string.h>
Daniel Borkmannd4a176ef0d34
diff --git a/AGENTS.md b/AGENTS.mdindex 5f6acfa2..885f08a6 100644--- a/AGENTS.md+++ b/AGENTS.md@@ -81,22 +81,26 @@ before the LSM hooks and `attr.keyring_id` is a key serial, not a name.long`, so it prints with `%llu`, and `ptr_to_u64()` turns a pointerinto the `__u64` the bpf() ABI carries. A library interface that takesanother type keeps it, and BPF programs spell hook arguments as the- kernel's prototypes do. `check-style.sh` rejects `uint32_t` and its kin+ kernel's prototypes do. `<shirudo/misc.h>` poisons `uint8_t` to+ `int64_t`, so a system header that uses them, `<netinet/in.h>`,+ `<elf.h>` or one of OpenSSL's or tpm2-tss's, goes above the first+ shirudo header. `check-style.sh` rejects `uint32_t` and its kineverywhere and `unsigned char`, `short`, `int` and `long` in userspace,less the files it names.- **Parse numbers with `parse_u64()`, `parse_s64()` and `parse_x64()`**from `<shirudo/string.h>`, and find where one ends with `digits()`:they take a length, read nothing past it and refuse a sign, blank or- base prefix. `check-style.sh` rejects `strtoul()` and its kin and- `atoi()` outside `testing/`.+ base prefix. `<shirudo/string.h>` poisons `strtoul()` and its kin and+ `atoi()`, and `check-style.sh` rejects them outside `testing/`.- **Copy strings with `strscpy()` and format into a fixed buffer with`strsprintf()`**, both from `<shirudo/string.h>`: `strscpy()` alwaysterminates and returns `-E2BIG` when it cut, which a caller checkswherever a cut path or name would mean a different one, and`strsprintf()` returns `-E2BIG` with the buffer left empty rather thana cut path, in place of comparing `snprintf()` with the size by hand.- `check-style.sh` rejects `strcpy()`, `strncpy()` and their kin and a- `snprintf(dst, size, "%s", src)` copy outside `testing/`.+ `<shirudo/string.h>` poisons `strcpy()`, `strncpy()` and their kin and+ `sprintf()` and `vsprintf()`, and `check-style.sh` rejects the copies+ and a `snprintf(dst, size, "%s", src)` copy outside `testing/`.- **Declare locals in reverse-Christmas-tree order** (the netdevconvention): longest declaration line first, shortest last. Groupdeclarations that have no initializer dependency and sort them by