diff --git a/core/base/libs/socrate/socrate/system.py b/core/base/libs/socrate/socrate/system.py index 9647cdd1..dc3f5105 100644 --- a/core/base/libs/socrate/socrate/system.py +++ b/core/base/libs/socrate/socrate/system.py @@ -61,12 +61,24 @@ class LogFilter(object): def flush(self): self.stream.flush() +def _is_compatible_with_hardened_malloc(): + with open('/proc/cpuinfo', 'r') as f: + lines = f.readlines() + for line in lines: + # See #2764, we need vmovdqu + if line.startswith('flags') and ' avx ' not in line: + return False + return True + def set_env(required_secrets=[], log_filters=[], log_file=None): if log_filters: sys.stdout = LogFilter(sys.stdout, log_filters, log_file) sys.stderr = LogFilter(sys.stderr, log_filters, log_file) log.basicConfig(stream=sys.stderr, level=os.environ.get("LOG_LEVEL", 'WARNING')) + if not _is_compatible_with_hardened_malloc(): + del os.environ['LD_PRELOAD'] + """ This will set all the environment variables and retains only the secrets we need """ if 'SECRET_KEY_FILE' in os.environ: try: diff --git a/towncrier/newsfragments/2644.misc b/towncrier/newsfragments/2644.misc index b77673eb..3134c97e 100644 --- a/towncrier/newsfragments/2644.misc +++ b/towncrier/newsfragments/2644.misc @@ -1 +1,2 @@ -Filter unwanted logs. +Filter unwanted logs out. +Disable hardened-malloc if we detect a processor not supporting the AVX extension set