Skip to content
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

Ignore /proc/sys/fs/binfmt_misc by default #7650

Merged
merged 3 commits into from
Sep 24, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion disk/assets/configuration/spec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ files:
description: |
Instruct the check to always add these patterns to `mount_point_blacklist`.
value:
example: []
example:
- /proc/sys/fs/binfmt_misc$
type: array
items:
type: string
Expand Down
3 changes: 2 additions & 1 deletion disk/datadog_checks/disk/data/conf.yaml.default
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ init_config:
## @param mount_point_global_blacklist - list of strings - optional
## Instruct the check to always add these patterns to `mount_point_blacklist`.
#
# mount_point_global_blacklist: []
# mount_point_global_blacklist:
# - /proc/sys/fs/binfmt_misc$
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add a comment that overriding this value will introduce possible problems on systems using systemd?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, dunno if a comment in description for each would scale long term. WDYT?


## Every instance is scheduled independent of the others.
#
Expand Down
6 changes: 5 additions & 1 deletion disk/datadog_checks/disk/disk.py
Original file line number Diff line number Diff line change
Expand Up @@ -438,4 +438,8 @@ def get_default_device_blacklist():

@staticmethod
def get_default_mount_mount_blacklist():
return []
return [
# https://github.com/DataDog/datadog-agent/issues/1961
# https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2018-1049
'/proc/sys/fs/binfmt_misc$'
]
6 changes: 3 additions & 3 deletions disk/tests/test_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def test_bad_config_string_regex():
assert_regex_equal(c._device_whitelist, re.compile('test', IGNORE_CASE))
assert_regex_equal(c._device_blacklist, re.compile('test', IGNORE_CASE))
assert_regex_equal(c._mount_point_whitelist, re.compile('test', IGNORE_CASE))
assert_regex_equal(c._mount_point_blacklist, re.compile('test', IGNORE_CASE))
assert_regex_equal(c._mount_point_blacklist, re.compile('test|/proc/sys/fs/binfmt_misc$', IGNORE_CASE))


def test_ignore_empty_regex():
Expand All @@ -58,7 +58,7 @@ def test_ignore_empty_regex():
assert_regex_equal(c._device_whitelist, re.compile('test', IGNORE_CASE))
assert_regex_equal(c._device_blacklist, re.compile('test', IGNORE_CASE))
assert_regex_equal(c._mount_point_whitelist, re.compile('test', IGNORE_CASE))
assert_regex_equal(c._mount_point_blacklist, re.compile('test', IGNORE_CASE))
assert_regex_equal(c._mount_point_blacklist, re.compile('test|/proc/sys/fs/binfmt_misc$', IGNORE_CASE))


def test_exclude_bad_devices():
Expand Down Expand Up @@ -191,7 +191,7 @@ def test_legacy_config():

assert_regex_equal(c._file_system_blacklist, re.compile('iso9660$|test$', re.I))
assert_regex_equal(c._device_blacklist, re.compile('test1$|test2', IGNORE_CASE))
assert_regex_equal(c._mount_point_blacklist, re.compile('test', IGNORE_CASE))
assert_regex_equal(c._mount_point_blacklist, re.compile('/proc/sys/fs/binfmt_misc$|test', IGNORE_CASE))


def test_legacy_exclude_disk():
Expand Down
3 changes: 2 additions & 1 deletion disk/tests/test_unit.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from datadog_checks.base.utils.platform import Platform
from datadog_checks.base.utils.timeout import TimeoutException
from datadog_checks.disk import Disk
from datadog_checks.disk.disk import IGNORE_CASE

from .common import DEFAULT_DEVICE_BASE_NAME, DEFAULT_DEVICE_NAME, DEFAULT_FILE_SYSTEM, DEFAULT_MOUNT_POINT
from .mocks import MockDiskMetrics, MockPart, mock_blkid_output
Expand All @@ -26,7 +27,7 @@ def test_default_options():
assert check._device_whitelist is None
assert check._device_blacklist is None
assert check._mount_point_whitelist is None
assert check._mount_point_blacklist is None
assert check._mount_point_blacklist == re.compile('/proc/sys/fs/binfmt_misc$', IGNORE_CASE)
assert check._tag_by_filesystem is False
assert check._device_tag_re == []
assert check._service_check_rw is False
Expand Down