From 6c66e599afecd831f6c34fcb7bb83d6a63a237b1 Mon Sep 17 00:00:00 2001 From: gavan Date: Fri, 6 Oct 2017 02:39:38 +0000 Subject: net-snmp: Prevent crash on NetBSD/i386 A compiler bug causes incorrect compilation of the NetBSD-specific code in cpu_sysctl.c. This results in a crash shortly after startup if the machine has 2 or more CPUs. Disable optimisation in netsnmp_cpu_arch_load() only. This works around the problem reported in PR pkg/50939. --- net/net-snmp/Makefile | 4 ++-- net/net-snmp/distinfo | 4 ++-- .../patches/patch-agent_mibgroup_hardware_cpu_cpu__sysctl.c | 11 ++++++++++- 3 files changed, 14 insertions(+), 5 deletions(-) (limited to 'net') diff --git a/net/net-snmp/Makefile b/net/net-snmp/Makefile index ec3c4262a2c..3c49c12dae8 100644 --- a/net/net-snmp/Makefile +++ b/net/net-snmp/Makefile @@ -1,8 +1,8 @@ -# $NetBSD: Makefile,v 1.120 2017/07/23 17:43:33 adam Exp $ +# $NetBSD: Makefile,v 1.121 2017/10/06 02:39:38 gavan Exp $ .include "Makefile.common" CATEGORIES= net -PKGREVISION= 7 +PKGREVISION= 8 MAINTAINER= adam@NetBSD.org COMMENT= Extensible SNMP implementation diff --git a/net/net-snmp/distinfo b/net/net-snmp/distinfo index e9045404099..765fa8c6a70 100644 --- a/net/net-snmp/distinfo +++ b/net/net-snmp/distinfo @@ -1,4 +1,4 @@ -$NetBSD: distinfo,v 1.90 2017/02/09 09:33:57 maya Exp $ +$NetBSD: distinfo,v 1.91 2017/10/06 02:39:38 gavan Exp $ SHA1 (net-snmp-5.7.3.tar.gz) = 97dc25077257680815de44e34128d365c76bd839 RMD160 (net-snmp-5.7.3.tar.gz) = c5cf54d5723ee417e07f1f9fa3936aef505104a2 @@ -10,7 +10,7 @@ SHA1 (patch-ag) = d9595eceeb5ee986ab4365f62e3c3ab339e605aa SHA1 (patch-agent_mibgroup_agentx_master.c) = c2b3f145280e3fecc26a431ec914cf89d87a17f4 SHA1 (patch-agent_mibgroup_agentx_master_admin.c) = 3c233c1e3113fbc9c1de34cb4cbacca9ef4a6fe2 SHA1 (patch-agent_mibgroup_at.c) = 50842f54d98b3cf7bf7028ddbb582b84b7ae682f -SHA1 (patch-agent_mibgroup_hardware_cpu_cpu__sysctl.c) = 5f1cd89f938b60e57ae87c055a269d3848b6a23e +SHA1 (patch-agent_mibgroup_hardware_cpu_cpu__sysctl.c) = d36d2490448c2dfda0383c67deb36fdb31ff18a3 SHA1 (patch-agent_mibgroup_hardware_fsys_fsys_getfsstats.c) = cee9722d9a3f956726a8760b900ed3a375afde3f SHA1 (patch-agent_mibgroup_hardware_memory_memory__netbsd.c) = 928a5aa99e7893ee91dea3110db8098212e328fa SHA1 (patch-agent_mibgroup_host_data__access_swrun__kinfo.c) = f983ae0d99d85ab1ac6dc7cf2d2c0415b6935258 diff --git a/net/net-snmp/patches/patch-agent_mibgroup_hardware_cpu_cpu__sysctl.c b/net/net-snmp/patches/patch-agent_mibgroup_hardware_cpu_cpu__sysctl.c index c94504b57aa..6d7b6cebe72 100644 --- a/net/net-snmp/patches/patch-agent_mibgroup_hardware_cpu_cpu__sysctl.c +++ b/net/net-snmp/patches/patch-agent_mibgroup_hardware_cpu_cpu__sysctl.c @@ -1,4 +1,4 @@ -$NetBSD: patch-agent_mibgroup_hardware_cpu_cpu__sysctl.c,v 1.6 2014/12/31 10:06:57 adam Exp $ +$NetBSD: patch-agent_mibgroup_hardware_cpu_cpu__sysctl.c,v 1.7 2017/10/06 02:39:38 gavan Exp $ --- agent/mibgroup/hardware/cpu/cpu_sysctl.c.orig 2014-12-08 20:23:22.000000000 +0000 +++ agent/mibgroup/hardware/cpu/cpu_sysctl.c @@ -51,6 +51,15 @@ $NetBSD: patch-agent_mibgroup_hardware_cpu_cpu__sysctl.c,v 1.6 2014/12/31 10:06: #endif for ( i = 0; i < n; i++ ) { cpu = netsnmp_cpu_get_byIdx( i, 1 ); +@@ -158,7 +165,7 @@ + /* + * Load the latest CPU usage statistics + */ +-int netsnmp_cpu_arch_load( netsnmp_cache *cache, void *magic ) { ++int __attribute__((optimize("O0"))) netsnmp_cpu_arch_load( netsnmp_cache *cache, void *magic ) { + + /* + * Strictly speaking, BSDi ought to use @@ -190,9 +197,11 @@ int netsnmp_cpu_arch_load( netsnmp_cache netsnmp_cpu_info *cpu = netsnmp_cpu_get_byIdx( -1, 0 ); -- cgit v1.2.3