Skip to content

Commit 91888a4

Browse files
authored
Ignore /proc/sys/fs/binfmt_misc by default (#7650)
* Ignore `/proc/sys/fs/binfmt_misc` by default * address * add warning
1 parent 9d100df commit 91888a4

5 files changed

Lines changed: 32 additions & 7 deletions

File tree

disk/assets/configuration/spec.yaml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ files:
88
- name: file_system_global_blacklist
99
description: |
1010
Instruct the check to always add these patterns to `file_system_blacklist`.
11+
12+
WARNING: Overriding these defaults could negatively impact your system or
13+
the performance of the check.
1114
value:
1215
example:
1316
- iso9660$
@@ -17,6 +20,9 @@ files:
1720
- name: device_global_blacklist
1821
description: |
1922
Instruct the check to always add these patterns to `device_blacklist`.
23+
24+
WARNING: Overriding these defaults could negatively impact your system or
25+
the performance of the check.
2026
value:
2127
example: []
2228
type: array
@@ -25,8 +31,12 @@ files:
2531
- name: mount_point_global_blacklist
2632
description: |
2733
Instruct the check to always add these patterns to `mount_point_blacklist`.
34+
35+
WARNING: Overriding these defaults could negatively impact your system or
36+
the performance of the check.
2837
value:
29-
example: []
38+
example:
39+
- (/host)?/proc/sys/fs/binfmt_misc$
3040
type: array
3141
items:
3242
type: string

disk/datadog_checks/disk/data/conf.yaml.default

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,29 @@ init_config:
44

55
## @param file_system_global_blacklist - list of strings - optional
66
## Instruct the check to always add these patterns to `file_system_blacklist`.
7+
##
8+
## WARNING: Overriding these defaults could negatively impact your system or
9+
## the performance of the check.
710
#
811
# file_system_global_blacklist:
912
# - iso9660$
1013

1114
## @param device_global_blacklist - list of strings - optional
1215
## Instruct the check to always add these patterns to `device_blacklist`.
16+
##
17+
## WARNING: Overriding these defaults could negatively impact your system or
18+
## the performance of the check.
1319
#
1420
# device_global_blacklist: []
1521

1622
## @param mount_point_global_blacklist - list of strings - optional
1723
## Instruct the check to always add these patterns to `mount_point_blacklist`.
24+
##
25+
## WARNING: Overriding these defaults could negatively impact your system or
26+
## the performance of the check.
1827
#
19-
# mount_point_global_blacklist: []
28+
# mount_point_global_blacklist:
29+
# - (/host)?/proc/sys/fs/binfmt_misc$
2030

2131
## Every instance is scheduled independent of the others.
2232
#

disk/datadog_checks/disk/disk.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -438,4 +438,8 @@ def get_default_device_blacklist():
438438

439439
@staticmethod
440440
def get_default_mount_mount_blacklist():
441-
return []
441+
return [
442+
# https://github.com/DataDog/datadog-agent/issues/1961
443+
# https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2018-1049
444+
'(/host)?/proc/sys/fs/binfmt_misc$'
445+
]

disk/tests/test_filter.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def test_bad_config_string_regex():
3939
assert_regex_equal(c._device_whitelist, re.compile('test', IGNORE_CASE))
4040
assert_regex_equal(c._device_blacklist, re.compile('test', IGNORE_CASE))
4141
assert_regex_equal(c._mount_point_whitelist, re.compile('test', IGNORE_CASE))
42-
assert_regex_equal(c._mount_point_blacklist, re.compile('test', IGNORE_CASE))
42+
assert_regex_equal(c._mount_point_blacklist, re.compile('test|(/host)?/proc/sys/fs/binfmt_misc$', IGNORE_CASE))
4343

4444

4545
def test_ignore_empty_regex():
@@ -58,7 +58,7 @@ def test_ignore_empty_regex():
5858
assert_regex_equal(c._device_whitelist, re.compile('test', IGNORE_CASE))
5959
assert_regex_equal(c._device_blacklist, re.compile('test', IGNORE_CASE))
6060
assert_regex_equal(c._mount_point_whitelist, re.compile('test', IGNORE_CASE))
61-
assert_regex_equal(c._mount_point_blacklist, re.compile('test', IGNORE_CASE))
61+
assert_regex_equal(c._mount_point_blacklist, re.compile('test|(/host)?/proc/sys/fs/binfmt_misc$', IGNORE_CASE))
6262

6363

6464
def test_exclude_bad_devices():
@@ -191,7 +191,7 @@ def test_legacy_config():
191191

192192
assert_regex_equal(c._file_system_blacklist, re.compile('iso9660$|test$', re.I))
193193
assert_regex_equal(c._device_blacklist, re.compile('test1$|test2', IGNORE_CASE))
194-
assert_regex_equal(c._mount_point_blacklist, re.compile('test', IGNORE_CASE))
194+
assert_regex_equal(c._mount_point_blacklist, re.compile('(/host)?/proc/sys/fs/binfmt_misc$|test', IGNORE_CASE))
195195

196196

197197
def test_legacy_exclude_disk():

disk/tests/test_unit.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
from datadog_checks.base.utils.platform import Platform
1212
from datadog_checks.base.utils.timeout import TimeoutException
1313
from datadog_checks.disk import Disk
14+
from datadog_checks.disk.disk import IGNORE_CASE
1415

1516
from .common import DEFAULT_DEVICE_BASE_NAME, DEFAULT_DEVICE_NAME, DEFAULT_FILE_SYSTEM, DEFAULT_MOUNT_POINT
1617
from .mocks import MockDiskMetrics, MockPart, mock_blkid_output
@@ -26,7 +27,7 @@ def test_default_options():
2627
assert check._device_whitelist is None
2728
assert check._device_blacklist is None
2829
assert check._mount_point_whitelist is None
29-
assert check._mount_point_blacklist is None
30+
assert check._mount_point_blacklist == re.compile('(/host)?/proc/sys/fs/binfmt_misc$', IGNORE_CASE)
3031
assert check._tag_by_filesystem is False
3132
assert check._device_tag_re == []
3233
assert check._service_check_rw is False

0 commit comments

Comments
 (0)