-
Notifications
You must be signed in to change notification settings - Fork 0
Landlock flat array domains #9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: landlock-arraydomain-base
Are you sure you want to change the base?
Changes from all commits
c2843fc
adda1f2
107507b
e39f9ca
c5bd6ea
38d85f7
1ac8886
37729bc
979f781
d6549e8
d8c48de
80c273e
985151f
d07afd9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,56 @@ | ||||||
| /* SPDX-License-Identifier: GPL-2.0 */ | ||||||
| /* | ||||||
| * Copyright © 2025 Microsoft Corporation | ||||||
| */ | ||||||
|
|
||||||
| #undef TRACE_SYSTEM | ||||||
| #define TRACE_SYSTEM landlock | ||||||
|
|
||||||
| #if !defined(_TRACE_LANDLOCK_H) || defined(TRACE_HEADER_MULTI_READ) | ||||||
| #define _TRACE_LANDLOCK_H | ||||||
|
|
||||||
| #include <linux/tracepoint.h> | ||||||
|
|
||||||
| struct landlock_domain_index; | ||||||
|
|
||||||
| TRACE_EVENT( | ||||||
| landlock_domain_hash_find, | ||||||
| TP_PROTO( | ||||||
| const struct landlock_domain_index* indices_arr, | ||||||
| u32 num_indices, | ||||||
| int hash_bits, | ||||||
| const struct landlock_domain_index* elem_to_find, | ||||||
| u32 collisions_followed | ||||||
| ), | ||||||
|
|
||||||
| TP_ARGS(indices_arr, num_indices, hash_bits, elem_to_find, collisions_followed), | ||||||
| TP_STRUCT__entry( | ||||||
| __field(const struct landlock_domain_index *, indices_arr) | ||||||
| __field(u32, num_indices) | ||||||
| __field(u32, hash_bits) | ||||||
| __field(uintptr_t, key) | ||||||
| __field(u32, collisions_followed) | ||||||
| ), | ||||||
|
|
||||||
| TP_fast_assign( | ||||||
| __entry->indices_arr = indices_arr; | ||||||
| __entry->num_indices = num_indices; | ||||||
| __entry->hash_bits = hash_bits; | ||||||
| __entry->key = *(uintptr_t *)elem_to_find; | ||||||
| __entry->collisions_followed = collisions_followed; | ||||||
| ), | ||||||
|
|
||||||
| TP_printk( | ||||||
| "indices_arr=%p num_indices=%u hash_bits=%u, key=%lx collisions_followed=%u", | ||||||
|
||||||
| "indices_arr=%p num_indices=%u hash_bits=%u, key=%lx collisions_followed=%u", | |
| "indices_arr=%p num_indices=%u hash_bits=%u key=%lx collisions_followed=%u", |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,11 +1,10 @@ | ||
| obj-$(CONFIG_SECURITY_LANDLOCK) := landlock.o | ||
|
|
||
| landlock-y := setup.o syscalls.o object.o ruleset.o \ | ||
| cred.o task.o fs.o | ||
| cred.o task.o fs.o domain.o trace.o | ||
|
|
||
| landlock-$(CONFIG_INET) += net.o | ||
|
|
||
| landlock-$(CONFIG_AUDIT) += \ | ||
| id.o \ | ||
| audit.o \ | ||
| domain.o | ||
| audit.o |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unsafe type cast in tracepoint. Line 39 casts
elem_to_find(aconst struct landlock_domain_index*) directly touintptr_t*and dereferences it. This assumes that the first field oflandlock_domain_indexis thekey, but this is fragile. If the struct layout changes, this will silently break. Useelem_to_find->key.datainstead for type-safe access to the key field.