From e8fab058dac7300569cb54b08e5500115f8bab8f Mon Sep 17 00:00:00 2001 From: Mark Allen Date: Wed, 3 Jun 2020 01:58:14 -0400 Subject: [PATCH] adding op-codes for syscall ipc for shmat/shmdt These op codes used to be in bits/ipc.h but were removed in glibc in 2015 with a comment saying they should be defined in internal headers: https://sourceware.org/bugzilla/show_bug.cgi?id=18560 and when glibc uses that syscall it seems to do so from its own definitions: https://github.com/bminor/glibc/search?q=IPCOP_shmat&unscoped_q=IPCOP_shmat So I think using #ifndef and defining them if they're not already defined using the values from glibc is the best option. At IBM it was the testing on redhat 8 that found this as an issue (the opcodes being undefined on the system made it select the left undefined so shmat/shmdt memory events went unintercepted). Signed-off-by: Mark Allen --- opal/mca/memory/patcher/memory_patcher_component.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/opal/mca/memory/patcher/memory_patcher_component.c b/opal/mca/memory/patcher/memory_patcher_component.c index 5566dc12c9..5eaf2cec2d 100644 --- a/opal/mca/memory/patcher/memory_patcher_component.c +++ b/opal/mca/memory/patcher/memory_patcher_component.c @@ -15,7 +15,7 @@ * reserved. * Copyright (c) 2016-2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2016-2019 IBM Corporation. All rights reserved. + * Copyright (c) 2016-2020 IBM Corporation. All rights reserved. * * $COPYRIGHT$ * @@ -334,6 +334,18 @@ static int intercept_brk (void *addr) #endif +// These op codes used to be in bits/ipc.h but were removed in glibc in 2015 +// with a comment saying they should be defined in internal headers: +// https://sourceware.org/bugzilla/show_bug.cgi?id=18560 +// and when glibc uses that syscall it seems to do so from its own definitions: +// https://github.com/bminor/glibc/search?q=IPCOP_shmat&unscoped_q=IPCOP_shmat +#ifndef IPCOP_shmat +#define IPCOP_shmat 21 +#endif +#ifndef IPCOP_shmdt +#define IPCOP_shmdt 22 +#endif + #if defined(SYS_shmdt) || (defined(IPCOP_shmdt) && defined(SYS_ipc)) #define HAS_SHMDT 1 #else