ldap/systools/idsktune.c | 40 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-)
New commits: commit 5eb19778f7939967e8ca714c4d4cb03ffa11064d Author: William Brown firstyear@redhat.com Date: Thu Jul 14 13:47:11 2016 +1000
Ticket 48925 - slapd crash with SIGILL: Dsktune should detect lack of CMPXCHG16B
Bug Description: On older AMD the CMPXCHG16B is not present. This is critical to the correct operation of lfds. Without out it we are unable to use nunc-stans
Fix Description: dsktune should warn if CMPXCHG16B (flag cx16) is not present. In a future release we will NOT allow installation upon a platform that lacks this instruction.
https://fedorahosted.org/389/ticket/48925
Author: wibrown
Review by: nhosoi (Thank you!)
diff --git a/ldap/systools/idsktune.c b/ldap/systools/idsktune.c index c7e76e7..b6c352a 100644 --- a/ldap/systools/idsktune.c +++ b/ldap/systools/idsktune.c @@ -11,11 +11,12 @@ # include <config.h> #endif
+#define _GNU_SOURCE
/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! * Don't forget to update build_date when the patch sets are updated. * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */ -static char *build_date = "23-FEBRUARY-2012"; +static char *build_date = "14-JULY-2016";
#if defined(linux) || defined(__linux) || defined(__linux__) #define IDDS_LINUX_INCLUDE 1 @@ -32,10 +33,12 @@ static char *build_date = "23-FEBRUARY-2012"; #include <sys/resource.h> #include <unistd.h> #endif + #include <stdlib.h> #include <string.h> #include <errno.h> #include <ctype.h> + #if !defined(__VMS) && !defined(IDDS_LINUX_INCLUDE) #if defined(__hpux) && defined(f_type) #undef f_type @@ -864,6 +867,39 @@ done: free(cmd); } } + + +static void +linux_check_cpu_features(void) +{ + FILE *cpuinfo = fopen("/proc/cpuinfo", "rb"); + char *arg = 0; + char *token = NULL; + size_t size = 0; + int found = 0; + while(getline(&arg, &size, cpuinfo) != -1) + { + if (strncmp("flags", arg, 5) == 0) { + token = strtok(arg, " "); + while (token != NULL) { + if (strncmp(token, "cx16", 4) == 0) { + found += 1; + } + token = strtok(NULL, " "); + } + } + } + free(arg); + fclose(cpuinfo); + + if (found == 0) { + flag_os_bad = 1; + printf("ERROR: This system does not support CMPXCHG16B instruction (cpuflag cx16).\n"); + printf(" nsslapd-enable-nunc-stans must be set to "off" on this system. \n"); + printf(" In a future release of Directory Server this platform will NOT be supported.\n\n"); + } + +} #endif /* IDDS_LINUX_INCLUDE */
@@ -976,6 +1012,8 @@ static void gen_tests (void)
#if defined(IDDS_LINUX_INCLUDE) linux_check_release(); + + linux_check_cpu_features(); #endif
389-commits@lists.fedoraproject.org