diff --git a/.SRCINFO b/.SRCINFO index 5fa8134..06a15af 100644 --- a/.SRCINFO +++ b/.SRCINFO @@ -1,7 +1,7 @@ # Generated by mksrcinfo v8 -# Wed Dec 13 22:27:02 UTC 2017 +# Sat Dec 23 16:38:20 UTC 2017 pkgbase = linux-vfio - pkgver = 4.14.5 + pkgver = 4.14.8 pkgrel = 1 url = http://www.kernel.org/ arch = x86_64 @@ -15,27 +15,33 @@ pkgbase = linux-vfio options = !strip source = https://www.kernel.org/pub/linux/kernel/v4.x/linux-4.14.tar.xz source = https://www.kernel.org/pub/linux/kernel/v4.x/linux-4.14.tar.sign - source = https://www.kernel.org/pub/linux/kernel/v4.x/patch-4.14.5.xz - source = https://www.kernel.org/pub/linux/kernel/v4.x/patch-4.14.5.sign + source = https://www.kernel.org/pub/linux/kernel/v4.x/patch-4.14.8.xz + source = https://www.kernel.org/pub/linux/kernel/v4.x/patch-4.14.8.sign source = config + source = 60-linux.hook source = 90-linux.hook source = linux.preset source = add-acs-overrides.patch source = i915-vga-arbiter.patch source = 0001-add-sysctl-to-disallow-unprivileged-CLONE_NEWUSER-by.patch + source = 0001-e1000e-Fix-e1000_check_for_copper_link_ich8lan-retur.patch + source = 0002-dccp-CVE-2017-8824-use-after-free-in-DCCP-code.patch sha256sums = f81d59477e90a130857ce18dc02f4fbe5725854911db1e7ba770c7cd350f96a7 sha256sums = SKIP - sha256sums = d86eb2fd1c424fec9fbb12afacf7b783756651f5d7d0cf7ac71c3fbbbedddc9c + sha256sums = 42eaed731b716244514b765c199e8f675d79287d7630e5c2911053ad52a1fa0a sha256sums = SKIP sha256sums = bfde21c325d39013463c38e9fa23d6d6481238b8509eea4ae38906127017e47d + sha256sums = ae2e95db94ef7176207c690224169594d49445e04249d2499e9d2fbc117a0b21 sha256sums = 8f407ad5ff6eff106562ba001c36a281134ac9aa468a596aea660a4fe1fd60b5 sha256sums = 99d0102c8065793096b8ea2ccc01c41fa3dcb96855f9f6f2c583b2372208c6f9 sha256sums = c238969a3c3a44b41c868a883880d8c4dc475e457427e91c649e9f24170b2c7d sha256sums = eaf70cd805cdb43cf6227d354a6d54f67645b6df99e06136a8055d7494d7439c sha256sums = 37b86ca3de148a34258e3176dbf41488d9dbd19e93adbd22a062b3c41332ce85 + sha256sums = c6e7db7dfd6a07e1fd0e20c3a5f0f315f9c2a366fe42214918b756f9a1c9bfa3 + sha256sums = 1d69940c6bf1731fa1d1da29b32ec4f594fa360118fe7b128c9810285ebf13e2 pkgname = linux-vfio - pkgdesc = The Linux kernel and modules with patches to enable GPU passthrough with KVM + pkgdesc = The Linux-vfio kernel and modules install = linux.install depends = coreutils depends = linux-firmware diff --git a/0001-e1000e-Fix-e1000_check_for_copper_link_ich8lan-retur.patch b/0001-e1000e-Fix-e1000_check_for_copper_link_ich8lan-retur.patch new file mode 100644 index 0000000..7e3ecbd --- /dev/null +++ b/0001-e1000e-Fix-e1000_check_for_copper_link_ich8lan-retur.patch @@ -0,0 +1,73 @@ +From c3c1af44db713ac6624e729ea4832d0ce70685e0 Mon Sep 17 00:00:00 2001 +Message-Id: +From: Benjamin Poirier +Date: Mon, 11 Dec 2017 16:26:40 +0900 +Subject: [PATCH 1/2] e1000e: Fix e1000_check_for_copper_link_ich8lan return + value. + +e1000e_check_for_copper_link() and e1000_check_for_copper_link_ich8lan() +are the two functions that may be assigned to mac.ops.check_for_link when +phy.media_type == e1000_media_type_copper. Commit 19110cfbb34d ("e1000e: +Separate signaling for link check/link up") changed the meaning of the +return value of check_for_link for copper media but only adjusted the first +function. This patch adjusts the second function likewise. + +Reported-by: Christian Hesse +Reported-by: Gabriel C +Link: https://bugzilla.kernel.org/show_bug.cgi?id=198047 +Fixes: 19110cfbb34d ("e1000e: Separate signaling for link check/link up") +Tested-by: Christian Hesse +Signed-off-by: Benjamin Poirier +--- + drivers/net/ethernet/intel/e1000e/ich8lan.c | 11 ++++++++--- + 1 file changed, 8 insertions(+), 3 deletions(-) + +diff --git a/drivers/net/ethernet/intel/e1000e/ich8lan.c b/drivers/net/ethernet/intel/e1000e/ich8lan.c +index d6d4ed7acf031172..31277d3bb7dc1241 100644 +--- a/drivers/net/ethernet/intel/e1000e/ich8lan.c ++++ b/drivers/net/ethernet/intel/e1000e/ich8lan.c +@@ -1367,22 +1367,25 @@ static s32 e1000_disable_ulp_lpt_lp(struct e1000_hw *hw, bool force) + * Checks to see of the link status of the hardware has changed. If a + * change in link status has been detected, then we read the PHY registers + * to get the current speed/duplex if link exists. ++ * ++ * Returns a negative error code (-E1000_ERR_*) or 0 (link down) or 1 (link ++ * up). + **/ + static s32 e1000_check_for_copper_link_ich8lan(struct e1000_hw *hw) + { + struct e1000_mac_info *mac = &hw->mac; + s32 ret_val, tipg_reg = 0; + u16 emi_addr, emi_val = 0; + bool link; + u16 phy_reg; + + /* We only want to go out to the PHY registers to see if Auto-Neg + * has completed and/or if our link status has changed. The + * get_link_status flag is set upon receiving a Link Status + * Change or Rx Sequence Error interrupt. + */ + if (!mac->get_link_status) +- return 0; ++ return 1; + + /* First we want to see if the MII Status Register reports + * link. If so, then we want to get the current speed/duplex +@@ -1613,10 +1616,12 @@ static s32 e1000_check_for_copper_link_ich8lan(struct e1000_hw *hw) + * different link partner. + */ + ret_val = e1000e_config_fc_after_link_up(hw); +- if (ret_val) ++ if (ret_val) { + e_dbg("Error configuring flow control\n"); ++ return ret_val; ++ } + +- return ret_val; ++ return 1; + } + + static s32 e1000_get_variants_ich8lan(struct e1000_adapter *adapter) +-- +2.15.1 + diff --git a/0002-dccp-CVE-2017-8824-use-after-free-in-DCCP-code.patch b/0002-dccp-CVE-2017-8824-use-after-free-in-DCCP-code.patch new file mode 100644 index 0000000..26311bf --- /dev/null +++ b/0002-dccp-CVE-2017-8824-use-after-free-in-DCCP-code.patch @@ -0,0 +1,57 @@ +From 80d3e994e0631d9135cadf20a0b5ad483d7e9bbb Mon Sep 17 00:00:00 2001 +Message-Id: <80d3e994e0631d9135cadf20a0b5ad483d7e9bbb.1513282811.git.jan.steffens@gmail.com> +In-Reply-To: +References: +From: Mohamed Ghannam +Date: Tue, 5 Dec 2017 20:58:35 +0000 +Subject: [PATCH 2/2] dccp: CVE-2017-8824: use-after-free in DCCP code + +Whenever the sock object is in DCCP_CLOSED state, +dccp_disconnect() must free dccps_hc_tx_ccid and +dccps_hc_rx_ccid and set to NULL. + +Signed-off-by: Mohamed Ghannam +Reviewed-by: Eric Dumazet +Signed-off-by: David S. Miller +--- + net/dccp/proto.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/net/dccp/proto.c b/net/dccp/proto.c +index b68168fcc06aa198..9d43c1f4027408f3 100644 +--- a/net/dccp/proto.c ++++ b/net/dccp/proto.c +@@ -259,25 +259,30 @@ int dccp_disconnect(struct sock *sk, int flags) + { + struct inet_connection_sock *icsk = inet_csk(sk); + struct inet_sock *inet = inet_sk(sk); ++ struct dccp_sock *dp = dccp_sk(sk); + int err = 0; + const int old_state = sk->sk_state; + + if (old_state != DCCP_CLOSED) + dccp_set_state(sk, DCCP_CLOSED); + + /* + * This corresponds to the ABORT function of RFC793, sec. 3.8 + * TCP uses a RST segment, DCCP a Reset packet with Code 2, "Aborted". + */ + if (old_state == DCCP_LISTEN) { + inet_csk_listen_stop(sk); + } else if (dccp_need_reset(old_state)) { + dccp_send_reset(sk, DCCP_RESET_CODE_ABORTED); + sk->sk_err = ECONNRESET; + } else if (old_state == DCCP_REQUESTING) + sk->sk_err = ECONNRESET; + + dccp_clear_xmit_timers(sk); ++ ccid_hc_rx_delete(dp->dccps_hc_rx_ccid, sk); ++ ccid_hc_tx_delete(dp->dccps_hc_tx_ccid, sk); ++ dp->dccps_hc_rx_ccid = NULL; ++ dp->dccps_hc_tx_ccid = NULL; + + __skb_queue_purge(&sk->sk_receive_queue); + __skb_queue_purge(&sk->sk_write_queue); +-- +2.15.1 + diff --git a/60-linux.hook b/60-linux.hook new file mode 100644 index 0000000..b33873c --- /dev/null +++ b/60-linux.hook @@ -0,0 +1,12 @@ +[Trigger] +Type = File +Operation = Install +Operation = Upgrade +Operation = Remove +Target = usr/lib/modules/%KERNVER%/* +Target = usr/lib/modules/%EXTRAMODULES%/* + +[Action] +Description = Updating %PKGBASE% module dependencies... +When = PostTransaction +Exec = /usr/bin/depmod %KERNVER% diff --git a/PKGBUILD b/PKGBUILD index 7324fad..4a854ea 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -3,7 +3,7 @@ pkgbase=linux-vfio _srcname=linux-4.14 -pkgver=4.14.5 +pkgver=4.14.8 pkgrel=1 arch=('x86_64') url="http://www.kernel.org/" @@ -16,6 +16,8 @@ source=("https://www.kernel.org/pub/linux/kernel/v4.x/${_srcname}.tar.xz" "https://www.kernel.org/pub/linux/kernel/v4.x/patch-${pkgver}.sign" # the main kernel config files 'config' + # pacman hook for depmod + '60-linux.hook' # pacman hook for initramfs regeneration '90-linux.hook' # standard config files for mkinitcpio ramdisk @@ -23,17 +25,22 @@ source=("https://www.kernel.org/pub/linux/kernel/v4.x/${_srcname}.tar.xz" # patches for pci passthrough 'add-acs-overrides.patch' 'i915-vga-arbiter.patch' - 0001-add-sysctl-to-disallow-unprivileged-CLONE_NEWUSER-by.patch) + 0001-add-sysctl-to-disallow-unprivileged-CLONE_NEWUSER-by.patch + 0001-e1000e-Fix-e1000_check_for_copper_link_ich8lan-retur.patch + 0002-dccp-CVE-2017-8824-use-after-free-in-DCCP-code.patch) sha256sums=('f81d59477e90a130857ce18dc02f4fbe5725854911db1e7ba770c7cd350f96a7' 'SKIP' - 'd86eb2fd1c424fec9fbb12afacf7b783756651f5d7d0cf7ac71c3fbbbedddc9c' + '42eaed731b716244514b765c199e8f675d79287d7630e5c2911053ad52a1fa0a' 'SKIP' 'bfde21c325d39013463c38e9fa23d6d6481238b8509eea4ae38906127017e47d' + 'ae2e95db94ef7176207c690224169594d49445e04249d2499e9d2fbc117a0b21' '8f407ad5ff6eff106562ba001c36a281134ac9aa468a596aea660a4fe1fd60b5' '99d0102c8065793096b8ea2ccc01c41fa3dcb96855f9f6f2c583b2372208c6f9' 'c238969a3c3a44b41c868a883880d8c4dc475e457427e91c649e9f24170b2c7d' 'eaf70cd805cdb43cf6227d354a6d54f67645b6df99e06136a8055d7494d7439c' - '37b86ca3de148a34258e3176dbf41488d9dbd19e93adbd22a062b3c41332ce85') + '37b86ca3de148a34258e3176dbf41488d9dbd19e93adbd22a062b3c41332ce85' + 'c6e7db7dfd6a07e1fd0e20c3a5f0f315f9c2a366fe42214918b756f9a1c9bfa3' + '1d69940c6bf1731fa1d1da29b32ec4f594fa360118fe7b128c9810285ebf13e2') validpgpkeys=( 'ABAF11C65A2970B130ABE3C479BE3E4300411886' # Linus Torvalds '647F28654894E3BD457199BE38DBBDC86092693E' # Greg Kroah-Hartman @@ -42,10 +49,12 @@ validpgpkeys=( _kernelname=${pkgbase#linux} prepare() { - cd "${srcdir}/${_srcname}" + cd ${_srcname} # add upstream patch - patch -p1 -i "${srcdir}/patch-${pkgver}" + patch -p1 -i ../patch-${pkgver} + + # security patches # add latest fixes from stable queue, if needed # http://git.kernel.org/?p=linux/kernel/git/stable/stable-queue.git @@ -53,16 +62,20 @@ prepare() { # disable USER_NS for non-root users by default patch -Np1 -i ../0001-add-sysctl-to-disallow-unprivileged-CLONE_NEWUSER-by.patch - cat "${srcdir}/config" > ./.config + # https://bugs.archlinux.org/task/56575 + patch -Np1 -i ../0001-e1000e-Fix-e1000_check_for_copper_link_ich8lan-retur.patch + + # https://nvd.nist.gov/vuln/detail/CVE-2017-8824 + patch -Np1 -i ../0002-dccp-CVE-2017-8824-use-after-free-in-DCCP-code.patch # patches for vga arbiter fix in intel systems - echo '==> Applying i915 VGA arbitration patch' patch -p1 -i "${srcdir}/i915-vga-arbiter.patch" # Overrides for missing acs capabilities - echo '==> Applying ACS override patch' patch -p1 -i "${srcdir}/add-acs-overrides.patch" + cp -Tf ../config .config + if [ "${_kernelname}" != "" ]; then sed -i "s|CONFIG_LOCALVERSION=.*|CONFIG_LOCALVERSION=\"${_kernelname}\"|g" ./.config sed -i "s|CONFIG_LOCALVERSION_AUTO=.*|CONFIG_LOCALVERSION_AUTO=n|" ./.config @@ -90,73 +103,73 @@ prepare() { } build() { - cd "${srcdir}/${_srcname}" + cd ${_srcname} make ${MAKEFLAGS} LOCALVERSION= bzImage modules } -_common_package() { - cd "${srcdir}/${_srcname}" - - KARCH=x86 - - # get kernel version - _kernver="$(make LOCALVERSION= kernelrelease)" - _basekernel=${_kernver%%-*} - _basekernel=${_basekernel%.*} -} - _package() { - pkgdesc="The Linux kernel and modules with patches to enable GPU passthrough with KVM" + pkgdesc="The ${pkgbase/linux/Linux} kernel and modules" [ "${pkgbase}" = "linux" ] && groups=('base') depends=('coreutils' 'linux-firmware' 'kmod' 'mkinitcpio>=0.7') optdepends=('crda: to set the correct wireless channels of your country') backup=("etc/mkinitcpio.d/${pkgbase}.preset") install=linux.install -mkdir -p "${pkgdir}"/{lib/modules,lib/firmware,boot} - make LOCALVERSION= INSTALL_MOD_PATH="${pkgdir}" modules_install - cp arch/$KARCH/boot/bzImage "${pkgdir}/boot/vmlinuz-${pkgbase}" + cd ${_srcname} - # set correct depmod command for install - sed -e "s|%PKGBASE%|${pkgbase}|g;s|%KERNVER%|${_kernver}|g" \ - "${startdir}/${install}" > "${startdir}/${install}.pkg" - true && install=${install}.pkg + # get kernel version + _kernver="$(make LOCALVERSION= kernelrelease)" + _basekernel=${_kernver%%-*} + _basekernel=${_basekernel%.*} - # install mkinitcpio preset file for kernel - sed "s|%PKGBASE%|${pkgbase}|g" ../linux.preset | - install -Dm644 /dev/stdin "${pkgdir}/etc/mkinitcpio.d/${pkgbase}.preset" - - # install pacman hook for initramfs regeneration - sed "s|%PKGBASE%|${pkgbase}|g" ../90-linux.hook | - install -Dm644 /dev/stdin "${pkgdir}/usr/share/libalpm/hooks/90-${pkgbase}.hook" - - # remove build and source links - rm "${pkgdir}"/lib/modules/${_kernver}/{source,build} - - # remove the firmware - rm -r "${pkgdir}/lib/firmware" + mkdir -p "${pkgdir}"/{boot,usr/lib/modules} + make LOCALVERSION= INSTALL_MOD_PATH="${pkgdir}/usr" modules_install + cp arch/x86/boot/bzImage "${pkgdir}/boot/vmlinuz-${pkgbase}" # make room for external modules - ln -s "../extramodules-${_basekernel}${_kernelname:--ARCH}" "${pkgdir}/lib/modules/${_kernver}/extramodules" + local _extramodules="extramodules-${_basekernel}${_kernelname:--ARCH}" + ln -s "../${_extramodules}" "${pkgdir}/usr/lib/modules/${_kernver}/extramodules" - # add real version for building modules and running depmod from post_install/upgrade + # add real version for building modules and running depmod from hook echo "${_kernver}" | - install -Dm644 /dev/stdin "${pkgdir}/lib/modules/extramodules-${_basekernel}${_kernelname:--ARCH}/version" + install -Dm644 /dev/stdin "${pkgdir}/usr/lib/modules/${_extramodules}/version" - # Now we call depmod... - depmod -b "${pkgdir}" -F System.map "${_kernver}" + # remove build and source links + rm "${pkgdir}"/usr/lib/modules/${_kernver}/{source,build} - # move module tree /lib -> /usr/lib - mv -t "${pkgdir}/usr" "${pkgdir}/lib" + # now we call depmod... + depmod -b "${pkgdir}/usr" -F System.map "${_kernver}" # add vmlinux - install -Dm644 vmlinux "${pkgdir}/usr/lib/modules/${_kernver}/build/vmlinux" + install -Dt "${pkgdir}/usr/lib/modules/${_kernver}/build" -m644 vmlinux + + # sed expression for following substitutions + local _subst=" + s|%PKGBASE%|${pkgbase}|g + s|%KERNVER%|${_kernver}|g + s|%EXTRAMODULES%|${_extramodules}|g + " + + # hack to allow specifying an initially nonexisting install file + sed "${_subst}" "${startdir}/${install}" > "${startdir}/${install}.pkg" + true && install=${install}.pkg + + # install mkinitcpio preset file + sed "${_subst}" ../linux.preset | + install -Dm644 /dev/stdin "${pkgdir}/etc/mkinitcpio.d/${pkgbase}.preset" + + # install pacman hooks + sed "${_subst}" ../60-linux.hook | + install -Dm644 /dev/stdin "${pkgdir}/usr/share/libalpm/hooks/60-${pkgbase}.hook" + sed "${_subst}" ../90-linux.hook | + install -Dm644 /dev/stdin "${pkgdir}/usr/share/libalpm/hooks/90-${pkgbase}.hook" } _package-headers() { pkgdesc="Header files and scripts for building modules for ${pkgbase/linux/Linux} kernel" + cd ${_srcname} local _builddir="${pkgdir}/usr/lib/modules/${_kernver}/build" install -Dt "${_builddir}" -m644 Makefile .config Module.symvers @@ -166,14 +179,10 @@ _package-headers() { cp -t "${_builddir}" -a include scripts - install -Dt "${_builddir}/arch/${KARCH}" -m644 arch/${KARCH}/Makefile - install -Dt "${_builddir}/arch/${KARCH}/kernel" -m644 arch/${KARCH}/kernel/asm-offsets.s + install -Dt "${_builddir}/arch/x86" -m644 arch/x86/Makefile + install -Dt "${_builddir}/arch/x86/kernel" -m644 arch/x86/kernel/asm-offsets.s - if [[ ${CARCH} = i686 ]]; then - install -t "${_builddir}/arch/${KARCH}" -m644 arch/${KARCH}/Makefile_32.cpu - fi - - cp -t "${_builddir}/arch/${KARCH}" -a arch/${KARCH}/include + cp -t "${_builddir}/arch/x86" -a arch/x86/include install -Dt "${_builddir}/drivers/md" -m644 drivers/md/*.h install -Dt "${_builddir}/net/mac80211" -m644 net/mac80211/*.h @@ -182,7 +191,6 @@ _package-headers() { install -Dt "${_builddir}/drivers/media/dvb-core" -m644 drivers/media/dvb-core/*.h # http://bugs.archlinux.org/task/13146 - install -Dt "${_builddir}/drivers/media/dvb-frontends" -m644 drivers/media/dvb-frontends/lgdt330x.h install -Dt "${_builddir}/drivers/media/i2c" -m644 drivers/media/i2c/msp3400-driver.h # http://bugs.archlinux.org/task/20402 @@ -197,16 +205,13 @@ _package-headers() { find . -name Kconfig\* -exec install -Dm644 {} "${_builddir}/{}" \; # add objtool for external module building and enabled VALIDATION_STACK option - if [[ -e tools/objtool/objtool ]]; then - install -Dt "${_builddir}/tools/objtool" tools/objtool/objtool - fi + install -Dt "${_builddir}/tools/objtool" tools/objtool/objtool # remove unneeded architectures local _arch for _arch in "${_builddir}"/arch/*/; do - if [[ ${_arch} != */${KARCH}/ ]]; then - rm -r "${_arch}" - fi + [[ ${_arch} == */x86/ ]] && continue + rm -r "${_arch}" done # remove files already in linux-docs package @@ -231,6 +236,7 @@ _package-headers() { _package-docs() { pkgdesc="Kernel hackers manual - HTML documentation that comes with the ${pkgbase/linux/Linux} kernel" + cd ${_srcname} local _builddir="${pkgdir}/usr/lib/modules/${_kernver}/build" mkdir -p "${_builddir}" @@ -244,7 +250,6 @@ pkgname=("${pkgbase}" "${pkgbase}-headers" "${pkgbase}-docs") for _p in ${pkgname[@]}; do eval "package_${_p}() { $(declare -f "_package${_p#${pkgbase}}") - _common_package _package${_p#${pkgbase}} }" done diff --git a/linux.install b/linux.install index 0462775..37ba374 100644 --- a/linux.install +++ b/linux.install @@ -1,27 +1,10 @@ -post_install () { - # updating module dependencies - echo ">>> Updating module dependencies. Please wait ..." - depmod %KERNVER% -} - post_upgrade() { if findmnt --fstab -uno SOURCE /boot &>/dev/null && ! mountpoint -q /boot; then echo "WARNING: /boot appears to be a separate partition but is not mounted." fi - - # updating module dependencies - echo ">>> Updating module dependencies. Please wait ..." - depmod %KERNVER% - - if [ $(vercmp $2 3.13) -lt 0 ]; then - echo ">>> WARNING: AT keyboard support is no longer built into the kernel." - echo ">>> In order to use your keyboard during early init, you MUST" - echo ">>> include the 'keyboard' hook in your mkinitcpio.conf." - fi } post_remove() { - # also remove the compat symlinks rm -f boot/initramfs-%PKGBASE%.img rm -f boot/initramfs-%PKGBASE%-fallback.img }