From owner-freebsd-ports-bugs@FreeBSD.ORG Thu Jan 16 18:40:00 2014 Return-Path: Delivered-To: freebsd-ports-bugs@smarthost.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B4B6DACE for ; Thu, 16 Jan 2014 18:40:00 +0000 (UTC) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 8F1811A85 for ; Thu, 16 Jan 2014 18:40:00 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.7/8.14.7) with ESMTP id s0GIe08f093439 for ; Thu, 16 Jan 2014 18:40:00 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.7/8.14.7/Submit) id s0GIe0Ec093438; Thu, 16 Jan 2014 18:40:00 GMT (envelope-from gnats) Resent-Date: Thu, 16 Jan 2014 18:40:00 GMT Resent-Message-Id: <201401161840.s0GIe0Ec093438@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-ports-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Francois Tigeot Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 38D2D470 for ; Thu, 16 Jan 2014 18:31:41 +0000 (UTC) Received: from oldred.freebsd.org (oldred.freebsd.org [IPv6:2001:1900:2254:206a::50:4]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 24C9C19E6 for ; Thu, 16 Jan 2014 18:31:41 +0000 (UTC) Received: from oldred.freebsd.org ([127.0.1.6]) by oldred.freebsd.org (8.14.5/8.14.7) with ESMTP id s0GIVeNC068421 for ; Thu, 16 Jan 2014 18:31:40 GMT (envelope-from nobody@oldred.freebsd.org) Received: (from nobody@localhost) by oldred.freebsd.org (8.14.5/8.14.5/Submit) id s0GIVeK5068412; Thu, 16 Jan 2014 18:31:40 GMT (envelope-from nobody) Message-Id: <201401161831.s0GIVeK5068412@oldred.freebsd.org> Date: Thu, 16 Jan 2014 18:31:40 GMT From: Francois Tigeot To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Subject: ports/185826: Programs using security/cryptopp crash with illegal instructions X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Jan 2014 18:40:00 -0000 >Number: 185826 >Category: ports >Synopsis: Programs using security/cryptopp crash with illegal instructions >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Thu Jan 16 18:40:00 UTC 2014 >Closed-Date: >Last-Modified: >Originator: Francois Tigeot >Release: DragonFly 3.7-DEVELOPMENT >Organization: >Environment: DragonFly sekishi.zefyris.com 3.7-DEVELOPMENT DragonFly v3.7.1.509.g52b954-DEVELOPMENT #375: Sun Jan 12 13:04:22 CET 2014 ftigeot@sekishi.zefyris.com:/usr/obj/usr/src/sys/X86_64_GENERIC x86_64 >Description: While investigating net-p2p/amule crashes, I found out the security/cryptopp package tried to use illegal instructions. This occurs in the CryptoPP::RandomNumberGenerator::GenerateWord32(unsigned int, unsigned int) method. And is caused by the use of the shrx x86 instruction: (gdb output) Program received signal SIGILL, Illegal instruction. 0x0000000000626b88 in CryptoPP::RandomNumberGenerator::GenerateWord32(unsigned int, unsigned int) () => 0x0000000000626b88 <_ZN8CryptoPP21RandomNumberGenerator14GenerateWord32Ejj+40>: c4 e2 73 f7 c3 shrx %ecx,%ebx,%eax shrx is a new Haswell instruction, which means programs using the cryptopp library will crash on all machines not using this latest Intel processor generation. >How-To-Repeat: Build a cryptopp package on a Haswell CPU and try to use it on a machine with a previous generation CPU. >Fix: The root of the issue comes from the CXXFLAGS line in GNUmakefile. Changing it to stop generating instructions for a particular CPU model (removing "-native") will fix packages once and for all. The attached patch fixes the issue for me. Patch attached with submission follows: --- GNUmakefile.orig 2014-01-16 18:14:51.544855000 +0000 +++ GNUmakefile @@ -38,8 +38,6 @@ GAS219_OR_LATER = $(shell $(CXX) -xc -c ifneq ($(GCC42_OR_LATER),0) ifeq ($(UNAME),Darwin) CXXFLAGS += -arch x86_64 -arch i386 -else -CXXFLAGS += -march=native endif endif >Release-Note: >Audit-Trail: >Unformatted: