diff options
author | 2022-01-11 12:43:55 -0500 | |
---|---|---|
committer | 2022-02-28 10:26:38 -0500 | |
commit | d07c9ad622474616e94572e59e725c2c4a494fb4 (patch) | |
tree | c71f2fe4936d6d85155677704bef02b7bb62f5ca /include/trace/perf.h | |
parent | NFSD: Streamline the rare "found" case (diff) | |
download | linux-d07c9ad622474616e94572e59e725c2c4a494fb4.tar.gz linux-d07c9ad622474616e94572e59e725c2c4a494fb4.tar.bz2 linux-d07c9ad622474616e94572e59e725c2c4a494fb4.zip |
tracing: Introduce helpers to safely handle dynamic-sized sockaddrs
Enable a struct sockaddr to be stored in a trace record as a
dynamically-sized field. The common cases are AF_INET and AF_INET6
which are different sizes, and are vastly smaller than a struct
sockaddr_storage.
These are safer because, when used properly, the size of the
sockaddr destination field in each trace record is now guaranteed
to be the same as the source address that is being copied into it.
Link: https://lore.kernel.org/all/164182978641.8391.8277203495236105391.stgit@bazille.1015granger.net/
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Diffstat (limited to 'include/trace/perf.h')
-rw-r--r-- | include/trace/perf.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/include/trace/perf.h b/include/trace/perf.h index 5d48c46a3008..5800d13146c3 100644 --- a/include/trace/perf.h +++ b/include/trace/perf.h @@ -21,6 +21,9 @@ #undef __get_bitmask #define __get_bitmask(field) (char *)__get_dynamic_array(field) +#undef __get_sockaddr +#define __get_sockaddr(field) ((struct sockaddr *)__get_dynamic_array(field)) + #undef __get_rel_dynamic_array #define __get_rel_dynamic_array(field) \ ((void *)__entry + \ @@ -38,6 +41,9 @@ #undef __get_rel_bitmask #define __get_rel_bitmask(field) (char *)__get_rel_dynamic_array(field) +#undef __get_rel_sockaddr +#define __get_rel_sockaddr(field) ((struct sockaddr *)__get_rel_dynamic_array(field)) + #undef __perf_count #define __perf_count(c) (__count = (c)) |