Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

Commit 293898b

Browse files
authored
Merge pull request #38 from vmware/dbozzuto-struct-randomization
Fix invalid memory accesses related to struct randomization
2 parents 5daa5e5 + f9666b9 commit 293898b

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/bcc_sensor.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,22 @@
22
* Copyright 2019-2020 VMware, Inc.
33
* SPDX-License-Identifier: GPL-2.0
44
*/
5+
6+
// Struct randomization causes issues on 4.13 and some versions of 4.14
7+
// These are redefined to work around this, per:
8+
// https://lists.iovisor.org/g/iovisor-dev/topic/21386300#1239
9+
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0)
10+
#ifdef randomized_struct_fields_start
11+
#undef randomized_struct_fields_start
12+
#endif
13+
#define randomized_struct_fields_start struct {
14+
15+
#ifdef randomized_struct_fields_end
16+
#undef randomized_struct_fields_end
17+
#endif
18+
#define randomized_struct_fields_end };
19+
#endif
20+
521
#include <uapi/linux/limits.h>
622
#include <uapi/linux/in.h>
723
#include <uapi/linux/ip.h>

0 commit comments

Comments
 (0)