From owner-svn-src-stable@freebsd.org Sun Apr 8 20:54:14 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 44D4DFA24E5; Sun, 8 Apr 2018 20:54:14 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DD3827E9CC; Sun, 8 Apr 2018 20:54:13 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D6169151C4; Sun, 8 Apr 2018 20:54:13 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w38KsDOt036301; Sun, 8 Apr 2018 20:54:13 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w38KsDeB036297; Sun, 8 Apr 2018 20:54:13 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201804082054.w38KsDeB036297@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Sun, 8 Apr 2018 20:54:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r332306 - in stable/11: sys/conf tools/build/options X-SVN-Group: stable-11 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: in stable/11: sys/conf tools/build/options X-SVN-Commit-Revision: 332306 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Apr 2018 20:54:14 -0000 Author: emaste Date: Sun Apr 8 20:54:13 2018 New Revision: 332306 URL: https://svnweb.freebsd.org/changeset/base/332306 Log: MFC r330110: Add kernel retpoline option for amd64 Retpoline is a compiler-based mitigation for CVE-2017-5715, also known as Spectre V2, that protects against speculative execution branch target injection attacks. In this commit it is disabled by default, but will be changed in a followup commit. MFC r330962: Remove KERNEL_RETPOLINE from BROKEN_OPTIONS on i386 Clang will compile both amd64 and i386 with retpoline. Sponsored by: The FreeBSD Foundation Added: stable/11/tools/build/options/WITHOUT_KERNEL_RETPOLINE - copied unchanged from r330110, head/tools/build/options/WITHOUT_KERNEL_RETPOLINE stable/11/tools/build/options/WITH_KERNEL_RETPOLINE - copied unchanged from r330110, head/tools/build/options/WITH_KERNEL_RETPOLINE Modified: stable/11/sys/conf/kern.mk stable/11/sys/conf/kern.opts.mk Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/conf/kern.mk ============================================================================== --- stable/11/sys/conf/kern.mk Sun Apr 8 20:53:00 2018 (r332305) +++ stable/11/sys/conf/kern.mk Sun Apr 8 20:54:13 2018 (r332306) @@ -192,7 +192,7 @@ CFLAGS+= -ffreestanding # gcc and clang opimizers take advantage of this. The kernel makes # use of signed integer wraparound mechanics so we need the compiler # to treat it as a wraparound and not take shortcuts. -# +# CFLAGS+= -fwrapv # @@ -201,6 +201,14 @@ CFLAGS+= -fwrapv .if ${MK_SSP} != "no" && \ ${MACHINE_CPUARCH} != "arm" && ${MACHINE_CPUARCH} != "mips" CFLAGS+= -fstack-protector +.endif + +# +# Retpoline speculative execution vulnerability mitigation (CVE-2017-5715) +# +.if defined(COMPILER_FEATURES) && ${COMPILER_FEATURES:Mretpoline} != "" && \ + ${MK_KERNEL_RETPOLINE} != "no" +CFLAGS+= -mretpoline .endif # Modified: stable/11/sys/conf/kern.opts.mk ============================================================================== --- stable/11/sys/conf/kern.opts.mk Sun Apr 8 20:53:00 2018 (r332305) +++ stable/11/sys/conf/kern.opts.mk Sun Apr 8 20:54:13 2018 (r332306) @@ -48,6 +48,7 @@ __DEFAULT_YES_OPTIONS = \ __DEFAULT_NO_OPTIONS = \ EISA \ EXTRA_TCP_STACKS \ + KERNEL_RETPOLINE \ NAND \ OFED \ REPRODUCIBLE_BUILD @@ -83,6 +84,11 @@ BROKEN_OPTIONS+= EISA .if ${MACHINE} != "i386" && ${MACHINE} != "amd64" BROKEN_OPTIONS+= OFED +.endif + +# Things that don't work based on toolchain support. +.if ${MACHINE} != "i386" && ${MACHINE} != "amd64" +BROKEN_OPTIONS+= KERNEL_RETPOLINE .endif # expanded inline from bsd.mkopt.mk to avoid share/mk dependency Copied: stable/11/tools/build/options/WITHOUT_KERNEL_RETPOLINE (from r330110, head/tools/build/options/WITHOUT_KERNEL_RETPOLINE) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/tools/build/options/WITHOUT_KERNEL_RETPOLINE Sun Apr 8 20:54:13 2018 (r332306, copy of r330110, head/tools/build/options/WITHOUT_KERNEL_RETPOLINE) @@ -0,0 +1,3 @@ +.\" $FreeBSD$ +Set to disable the "retpoline" mitigation for CVE-2017-5715 in the kernel +build. Copied: stable/11/tools/build/options/WITH_KERNEL_RETPOLINE (from r330110, head/tools/build/options/WITH_KERNEL_RETPOLINE) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/tools/build/options/WITH_KERNEL_RETPOLINE Sun Apr 8 20:54:13 2018 (r332306, copy of r330110, head/tools/build/options/WITH_KERNEL_RETPOLINE) @@ -0,0 +1,3 @@ +.\" $FreeBSD$ +Set to enable the "retpoline" mitigation for CVE-2017-5715 in the kernel +build.