]> git.lttng.org Git - lttng-ust.git/commitdiff
Fix: Update `get_mempolicy` check to handle `EPERM` master
authorKienan Stewart <kstewart@efficios.com>
Fri, 22 Nov 2024 14:38:09 +0000 (09:38 -0500)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 25 Nov 2024 16:17:55 +0000 (11:17 -0500)
See libnuma commit 0ab9c7a0d857bea1724139c48e2e58ed6a81647f:

    commit 0ab9c7a0d857bea1724139c48e2e58ed6a81647f
    Author: filimonov <1549571+filimonov@users.noreply.github.com>
    Date:   Mon Oct 21 18:45:02 2024 +0200

        Make numa_available respect EPERM

        Make numa_available respect EPERM

        In the Docker environment, usage of `get_mempolicy` is restricted by seccomp security profiles:
        https://docs.docker.com/engine/security/seccomp/ (unless `CAP_SYS_NICE` is set).

        But `numa_available` used to ignore EPERM and return 'true', i.e., available. This led to further code attempting other API calls, which resulted in "operation not permitted" errors printed to stderr.

        See details in:
        https://github.com/ClickHouse/ClickHouse/issues/68747#issuecomment-2426210768

Change-Id: I5169f54ac7622754e33e7c67ee1d813876de44b9
Signed-off-by: Kienan Stewart <kstewart@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
src/common/counter/shm.c
src/common/ringbuffer/shm.c

index ee2b822ef29ed50a8899319f21f037bc172ffdc7..d025910d64765696e8aecee1c43517385799df12 100644 (file)
@@ -188,7 +188,7 @@ static bool lttng_is_numa_available(void)
        int ret;
 
        ret = get_mempolicy(NULL, NULL, 0, NULL, 0);
-       if (ret && errno == ENOSYS) {
+       if (ret && (errno == ENOSYS || errno == EPERM)) {
                return false;
        }
        return numa_available() >= 0;
index 002e08984cf2c3a08bb467ee543a325ddfc2395b..ef95d9f59ec8b0462b79134f3b76d4bc9af1dd8b 100644 (file)
@@ -247,7 +247,7 @@ static bool lttng_is_numa_available(void)
        int ret;
 
        ret = get_mempolicy(NULL, NULL, 0, NULL, 0);
-       if (ret && errno == ENOSYS) {
+       if (ret && (errno == ENOSYS || errno == EPERM)) {
                return false;
        }
        return numa_available() >= 0;
This page took 0.029852 seconds and 4 git commands to generate.