Debian Codegraph @

docs/upgrade.md

raw
1 # Upgrading to using a newer Landlock ABI version using go-landlock
2
3 Use this workflow to adopt new Landlock features after a new version
4 of Go-Landlock was released. This unlocks also new Landlock
5 capabilities offered by the kernel and can make your sandbox policy
6 more constrained.
7
8 ## Step 1 — Update the library
9
10 ```
11 go get -u github.com/landlock-lsm/go-landlock
12 ```
13
14 ## Step 2 — Find existing usage
15
16 Search the codebase for usages of `landlock.V*` (e.g., `landlock.V1`)
17 to identify which ABI version is currently in use.
18
19 ```
20 grep -R 'landlock\.V'
21 ```
22
23 In the less common case, the user might also use `landlock.NewConfig`
24 or `landlock.MustConfig`.
25
26 ## Step 3 — Check what changed
27
28 For each ABI version between the current one and the latest,
29 read the upgrade notes in the library source:
30
31 ```
32 go doc github.com/landlock-lsm/go-landlock/landlock.V1
33 ```
34
35 The upgrade notes describe what each version newly restricts and what
36 you need to consider in your code for safe upgrading.
37
38 Reason about each version individually that it is safe to upgrade to.
39 If it is not unconditionally safe, double check in your code base that
40 you are not affected, using the criteria outlined in the Go
41 documentation.
42
43 ## After upgrading
44
45 Replace the version constant (e.g. `landlock.V6` → `landlock.V9`) and
46 run the test suite. Make sure to exercise scenarios where the sandbox
47 is applied - that often means that the actual program binary must be
48 invoked.
49
50 AI Agents: Briefly explain to the user which additional access rights
51 each newly adopted version restricts and why the upgrade is safe (or
52 what changes are needed if it is not).