From 8e5662d5a3024a86eeccec5f4dae6a5b8793ced3 Mon Sep 17 00:00:00 2001 From: Tianling Shen Date: Thu, 17 Mar 2022 19:59:49 +0800 Subject: [PATCH 01/20] scripts/download.pl: drop cqu mirror Signed-off-by: Tianling Shen (cherry picked from commit 7807fb01194e29936cdac7cb84790624c3f4cc81) --- scripts/download.pl | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/download.pl b/scripts/download.pl index bd2ce99e9b..cb105cc916 100755 --- a/scripts/download.pl +++ b/scripts/download.pl @@ -258,7 +258,6 @@ foreach my $mirror (@ARGV) { push @extra, "$extra[0]/longterm/v$1"; } foreach my $dir (@extra) { - # push @mirrors, "https://mirrors.cqu.edu.cn/kernel/$dir"; # push @mirrors, "https://mirrors.ustc.edu.cn/kernel.org/$dir"; push @mirrors, "https://cdn.kernel.org/pub/$dir"; push @mirrors, "https://download.xs4all.nl/ftp.kernel.org/pub/$dir"; From 13fc2b911a3d381f1909f2dd0352c087df1047a7 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Sun, 6 Mar 2022 20:58:29 -0800 Subject: [PATCH 02/20] tools/expat: update to 2.4.7 Mostly a bug fix to the bug fix to CVE-2022-25236 Signed-off-by: Rosen Penev --- tools/expat/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/expat/Makefile b/tools/expat/Makefile index 0bc54a3d48..82d0fb14f9 100644 --- a/tools/expat/Makefile +++ b/tools/expat/Makefile @@ -9,10 +9,10 @@ include $(TOPDIR)/rules.mk PKG_NAME:=expat PKG_CPE_ID:=cpe:/a:libexpat:expat -PKG_VERSION:=2.4.6 +PKG_VERSION:=2.4.7 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 -PKG_HASH:=ce317706b07cae150f90cddd4253f5b4fba929607488af5ac47bf2bc08e31f09 +PKG_HASH:=e149bdd8b90254c62b3d195da53a09bd531a4d63a963b0d8a5268d48dd2f6a65 PKG_SOURCE_URL:=https://github.com/libexpat/libexpat/releases/download/R_$(subst .,_,$(PKG_VERSION)) include $(INCLUDE_DIR)/host-build.mk From 8af634c7b928ef2cc676d3c8d7dd0224c1d33465 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Sat, 12 Mar 2022 14:58:10 -0800 Subject: [PATCH 03/20] tools/expat: enable DTD Fixes gdb usage, which depends on it. Signed-off-by: Rosen Penev --- tools/expat/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/expat/Makefile b/tools/expat/Makefile index 82d0fb14f9..fc339f818a 100644 --- a/tools/expat/Makefile +++ b/tools/expat/Makefile @@ -26,7 +26,7 @@ CMAKE_HOST_OPTIONS += \ -DEXPAT_BUILD_DOCS=OFF \ -DEXPAT_WITH_LIBBSD=OFF \ -DEXPAT_ENABLE_INSTALL=ON \ - -DEXPAT_DTD=OFF \ + -DEXPAT_DTD=ON \ -DEXPAT_NS=OFF \ -DEXPAT_DEV_URANDOM=OFF From f01b6cd71264265715493127a1002a6e34918f48 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Sun, 6 Mar 2022 21:02:33 -0800 Subject: [PATCH 04/20] tools/mtools: update to 4.0.38 No real changelog available. Signed-off-by: Rosen Penev --- tools/mtools/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/mtools/Makefile b/tools/mtools/Makefile index c10e887b36..90a4119af4 100644 --- a/tools/mtools/Makefile +++ b/tools/mtools/Makefile @@ -7,11 +7,11 @@ include $(TOPDIR)/rules.mk PKG_NAME:=mtools -PKG_VERSION:=4.0.37 +PKG_VERSION:=4.0.38 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:=@GNU/$(PKG_NAME) -PKG_HASH:=799b197e23e47b61259628810b27790efb7a1fe36037ef1da8a27b0ae4fa8342 +PKG_HASH:=7b94485f486e7df08cca68b00a164a13cd38f4c63cb8684d188759ee7bc5e729 HOST_BUILD_PARALLEL:=1 From ecff6654d5dc01c9cf2f7ec4189538bae7b7ae63 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Sun, 6 Mar 2022 20:30:53 -0800 Subject: [PATCH 05/20] tools/cmake: update to 3.22.3 Seems to be mostly pthread fixes. Signed-off-by: Rosen Penev --- tools/cmake/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/cmake/Makefile b/tools/cmake/Makefile index d1d5b58a47..f0af6dfeaa 100644 --- a/tools/cmake/Makefile +++ b/tools/cmake/Makefile @@ -7,14 +7,14 @@ include $(TOPDIR)/rules.mk PKG_NAME:=cmake -PKG_VERSION:=3.22.2 +PKG_VERSION:=3.22.3 PKG_RELEASE:=1 PKG_CPE_ID:=cpe:/a:kitware:cmake PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://github.com/Kitware/CMake/releases/download/v$(PKG_VERSION)/ \ https://cmake.org/files/v3.19/ -PKG_HASH:=3c1c478b9650b107d452c5bd545c72e2fad4e37c09b89a1984b9a2f46df6aced +PKG_HASH:=9f8469166f94553b6978a16ee29227ec49a2eb5ceb608275dec40d8ae0d1b5a0 HOST_BUILD_PARALLEL:=1 HOST_CONFIGURE_PARALLEL:=1 From ddd42c876e3e2348579dae612116e6a1e2fba3c5 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Sun, 6 Mar 2022 20:53:47 -0800 Subject: [PATCH 06/20] tools/fakeroot: update to 1.28 Refreshed patches. Upstream says there's only a bugfix for GNU Hurd. Signed-off-by: Rosen Penev --- tools/fakeroot/Makefile | 4 ++-- tools/fakeroot/patches/400-alpine-libc.musl-fix.patch | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/fakeroot/Makefile b/tools/fakeroot/Makefile index adae332099..c29f51e77f 100644 --- a/tools/fakeroot/Makefile +++ b/tools/fakeroot/Makefile @@ -5,12 +5,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=fakeroot -PKG_VERSION:=1.27 +PKG_VERSION:=1.28 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)_$(PKG_VERSION).orig.tar.gz PKG_SOURCE_URL:=@DEBIAN/pool/main/f/fakeroot -PKG_HASH:=3c45eb2d1802a2762069e2e9d21bdd6fb533592bc0cda74c9aff066ab01caddc +PKG_HASH:=56d405e36ff685f83879be08fdd654255ab9aa38632b4605a98e896ad63990c2 PKG_LICENSE:=GPL-3.0-or-later PKG_LICENSE_FILES:=COPYING PKG_FIXUP:=autoreconf diff --git a/tools/fakeroot/patches/400-alpine-libc.musl-fix.patch b/tools/fakeroot/patches/400-alpine-libc.musl-fix.patch index 730732db2e..530c96842e 100644 --- a/tools/fakeroot/patches/400-alpine-libc.musl-fix.patch +++ b/tools/fakeroot/patches/400-alpine-libc.musl-fix.patch @@ -21,7 +21,7 @@ Error relocating openwrt/staging_dir/host/lib/libfakeroot.so: SEND_GET_XATTR: sy #define SEND_GET_XATTR64(a,b,c) send_get_xattr64(a,b) #endif -@@ -136,8 +138,9 @@ +@@ -140,8 +142,9 @@ /* 10.10 uses id_t in getpriority/setpriority calls, so pretend id_t is used everywhere, just happens to be int on some OSes */ From c76bce60f8e36b5f8143a7ffc78d12b2b0e83673 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Sun, 6 Mar 2022 20:46:22 -0800 Subject: [PATCH 07/20] tools/ccache: update to 4.6 Full changelog: https://ccache.dev/releasenotes.html#_ccache_4_6 Signed-off-by: Rosen Penev --- tools/ccache/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/ccache/Makefile b/tools/ccache/Makefile index 1031fdec99..9b2937dccd 100644 --- a/tools/ccache/Makefile +++ b/tools/ccache/Makefile @@ -8,11 +8,11 @@ include $(TOPDIR)/rules.mk include $(INCLUDE_DIR)/target.mk PKG_NAME:=ccache -PKG_VERSION:=4.5.1 +PKG_VERSION:=4.6 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=https://github.com/ccache/ccache/releases/download/v$(PKG_VERSION) -PKG_HASH:=51186ebe0326365f4e6131e1caa8911de7da4aa6718efc00680322d63a759517 +PKG_HASH:=3d2bb860f4359169e640f60cf7cc11da5fab5fb9aed55230d78141e49c3945e9 include $(INCLUDE_DIR)/host-build.mk include $(INCLUDE_DIR)/cmake.mk From 02cefc8ec7c992e3c9779a879eeeda0d24c5c53f Mon Sep 17 00:00:00 2001 From: Tianling Shen Date: Fri, 18 Mar 2022 12:04:00 +0800 Subject: [PATCH 08/20] tools: drop orphan llvm-bpf dependency Signed-off-by: Tianling Shen --- tools/Makefile | 1 - 1 file changed, 1 deletion(-) diff --git a/tools/Makefile b/tools/Makefile index 0fd94866be..960fba137a 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -59,7 +59,6 @@ $(curdir)/isl/compile := $(curdir)/gmp/compile $(curdir)/libressl/compile := $(curdir)/pkgconf/compile $(curdir)/libtool/compile := $(curdir)/m4/compile $(curdir)/autoconf/compile $(curdir)/automake/compile $(curdir)/missing-macros/compile $(curdir)/lzma-old/compile := $(curdir)/zlib/compile -$(curdir)/llvm-bpf/compile := $(curdir)/cmake/compile $(curdir)/make-ext4fs/compile := $(curdir)/zlib/compile $(curdir)/meson/compile := $(curdir)/ninja/compile $(curdir)/missing-macros/compile := $(curdir)/autoconf/compile From 3adf1d9bbe00ddee274e62a1a2a03a5711066ca5 Mon Sep 17 00:00:00 2001 From: Tianling Shen Date: Fri, 18 Mar 2022 13:46:43 +0800 Subject: [PATCH 09/20] kernel/modules: inet-diag: fix build with kernel < 4.10 Signed-off-by: Tianling Shen --- package/kernel/linux/modules/netsupport.mk | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/kernel/linux/modules/netsupport.mk b/package/kernel/linux/modules/netsupport.mk index 2b25942b7f..92ccb1d160 100644 --- a/package/kernel/linux/modules/netsupport.mk +++ b/package/kernel/linux/modules/netsupport.mk @@ -1315,13 +1315,13 @@ define KernelPackage/inet-diag $(LINUX_DIR)/net/ipv4/inet_diag.ko \ $(LINUX_DIR)/net/ipv4/tcp_diag.ko \ $(LINUX_DIR)/net/ipv4/udp_diag.ko \ - $(LINUX_DIR)/net/ipv4/raw_diag.ko + $(LINUX_DIR)/net/ipv4/raw_diag.ko@ge4.10 AUTOLOAD:=$(call AutoLoad,31,inet_diag tcp_diag udp_diag raw_diag) endef define KernelPackage/inet-diag/description -Support for INET (TCP, DCCP, etc) socket monitoring interface used by -native Linux tools such as ss. + Support for INET (TCP, DCCP, etc) socket monitoring interface used by + native Linux tools such as ss. endef $(eval $(call KernelPackage,inet-diag)) From cd1e95514e90f4f291cac2ed0d6fc61c9a88efb1 Mon Sep 17 00:00:00 2001 From: Tianling Shen Date: Sat, 19 Mar 2022 12:59:51 +0800 Subject: [PATCH 10/20] eeautocore: ethinfo: rewritten in lua Signed-off-by: Tianling Shen --- package/emortal/autocore/Makefile | 5 +- .../emortal/autocore/files/generic/ethinfo | 52 ++++++++++++------- .../emortal/autocore/files/generic/index.htm | 2 +- 3 files changed, 36 insertions(+), 23 deletions(-) diff --git a/package/emortal/autocore/Makefile b/package/emortal/autocore/Makefile index de35530e81..552b50196e 100644 --- a/package/emortal/autocore/Makefile +++ b/package/emortal/autocore/Makefile @@ -20,15 +20,14 @@ define Package/autocore-arm MAINTAINER:=CN_SZTL DEPENDS:=@(arm||aarch64) \ +TARGET_bcm27xx:bcm27xx-userland \ - +TARGET_bcm53xx:nvram \ - +ethtool + +TARGET_bcm53xx:nvram VARIANT:=arm endef define Package/autocore-x86 TITLE:=x86/x64 auto core loadbalance script MAINTAINER:=Lean - DEPENDS:=@TARGET_x86 +lm-sensors +ethtool + DEPENDS:=@TARGET_x86 +lm-sensors VARIANT:=x86 endef diff --git a/package/emortal/autocore/files/generic/ethinfo b/package/emortal/autocore/files/generic/ethinfo index c43ff800de..db457e80bf 100755 --- a/package/emortal/autocore/files/generic/ethinfo +++ b/package/emortal/autocore/files/generic/ethinfo @@ -1,25 +1,39 @@ -#!/bin/sh +#!/usr/bin/lua +-- Copyright (C) 2022 Tianling Shen -for i in $(ip address | grep -E 'eth[0-9]+' | awk -F ': ' '{print $2}' | xargs) -do - device_info="$(ethtool "$i" 2>"/dev/null")" || continue +local util = require "luci.util" +local jsonc = require "luci.jsonc" - if echo -e "$device_info" | grep -Eq 'Link detected.*yes'; then - link_stat=1 - else - link_stat=0 - fi - link_speed="$(echo -e "$device_info" | grep 'Speed' | awk -F ': ' '{print $2}' | tr -d 'Unknown!')" - [ -n "$link_speed" ] || link_speed=" - " +local eth_info = {} +local ifname, stat +for ifname, stat in pairs(util.ubus("network.device", "status")) do + if ifname:match("^(eth[0-9]+)$") == ifname then + local status, speed, duplex - if echo -e "$device_info" | grep -Eq 'Duplex.*Full'; then - link_mode=1 - else - link_mode=0 - fi + status = stat.carrier and 1 or 0 - json_body="${json_body:+$json_body,}{\"name\": \"$i\", \"status\": $link_stat, \"speed\": \"$link_speed\", \"duplex\": $link_mode}" -done + if stat.speed:sub(1, 1) == "-" then + speed = " - " + else + speed = stat.speed:sub(1, -2) .. "Mb/s" + end -echo "[$json_body]" + if stat.carrier and stat.speed:sub(-1) == "F" then + duplex = 1 + else + duplex = 0 + end + + eth_info[#eth_info+1] = { name = ifname, status = status, + speed = speed, duplex = duplex } + end +end + +table.sort(eth_info, + function(a, b) + return tonumber(a.name:match("eth([0-9]+)$")) < + tonumber(b.name:match("eth([0-9]+)$")) + end) + +print(jsonc.stringify(eth_info)) diff --git a/package/emortal/autocore/files/generic/index.htm b/package/emortal/autocore/files/generic/index.htm index 800eea1d97..cc155ce920 100644 --- a/package/emortal/autocore/files/generic/index.htm +++ b/package/emortal/autocore/files/generic/index.htm @@ -62,7 +62,7 @@ local eth_info = "" if not has_switch then - eth_info = luci.sys.exec("ethinfo") + eth_info = luci.sys.exec("/sbin/ethinfo") end local rv = { From 30bcdfd2b99d9083f6c4e0b8fbc13872bb13754d Mon Sep 17 00:00:00 2001 From: Tianling Shen Date: Sat, 19 Mar 2022 19:13:28 +0800 Subject: [PATCH 11/20] kernel: bump to 4.9.307, 4.14.272, 4.19.235 Added new Kconfig `HARDEN_BRANCH_HISTORY`. Manually-rebased patches: - generic/hack-4.9/204-module_strip.patch - generic/hack-4.9/220-gc_sections.patch - generic/hack-4.14/220-gc_sections.patch - generic/hack-4.19/220-gc_sections.patch - generic/backport-4.14/306-v4.16-netfilter-remove-saveroute-indirection-in-struct-nf_.patch Refreshed all patches. Signed-off-by: Tianling Shen --- include/kernel-version.mk | 12 ++--- .../910-unaligned_access_hacks.patch | 4 +- .../910-unaligned_access_hacks.patch | 4 +- .../910-unaligned_access_hacks.patch | 4 +- .../910-unaligned_access_hacks.patch | 4 +- ...0-0028-i2c-bcm2835-Add-debug-support.patch | 14 +++--- ...446-i2c-bcm2835-Model-Divider-in-CCF.patch | 20 ++++----- ...hci_fixup_endpoint-for-interval-adju.patch | 4 +- ...-IRQ-request-after-clock-code-in-pro.patch | 4 +- ...835-Ensure-clock-exists-when-probing.patch | 6 +-- ...35-Set-clock-stretch-timeout-to-35ms.patch | 4 +- ...-arm_introduce-dma-fiq-irq-broadcast.patch | 2 +- .../patches-4.14/040-fiq_support.patch | 2 +- ...-arm_introduce-dma-fiq-irq-broadcast.patch | 2 +- .../patches-4.19/040-fiq_support.patch | 2 +- ...ption-fix-dwm-158-3g-modem-interface.patch | 2 +- ...ake-nf_unregister_net_hooks-simple-w.patch | 2 +- ...emove-synchronize_net-call-if-nfqueu.patch | 8 ++-- ...filter-core-free-hooks-with-call_rcu.patch | 4 +- ...e-size-of-hook-entry-point-locations.patch | 6 +-- ...e-hook-array-sizes-to-what-is-needed.patch | 2 +- ...allocate-space-for-decnet-hooks-unle.patch | 2 +- ...allocate-space-for-arp-bridge-hooks-.patch | 4 +- ...ass-hook-number-family-and-device-to.patch | 2 +- ...etfilter-core-add-nf_remove_net_hook.patch | 6 +-- ...ass-family-as-parameter-to-nf_remove.patch | 6 +-- ...upport-for-NFPROTO_INET-hook-registr.patch | 10 ++--- ...-saveroute-indirection-in-struct-nf_.patch | 8 ++-- ...eroute-indirection-to-struct-nf_ipv6.patch | 4 +- ...-route_key_size-field-in-struct-nf_a.patch | 8 ++-- ...tfilter-exit_net-cleanup-check-added.patch | 2 +- ...90-net-generalize-napi_complete_done.patch | 2 +- target/linux/generic/config-4.14 | 1 + target/linux/generic/config-4.19 | 1 + target/linux/generic/config-4.9 | 1 + .../generic/hack-4.14/220-gc_sections.patch | 45 +++++++++++-------- .../generic/hack-4.14/930-crashlog.patch | 4 +- .../998-usb-serial-option-add-u9300.patch | 6 +-- .../generic/hack-4.19/204-module_strip.patch | 2 +- .../generic/hack-4.19/220-gc_sections.patch | 43 +++++++++++------- .../generic/hack-4.19/930-crashlog.patch | 6 +-- .../998-usb-serial-option-add-u9300.patch | 6 +-- .../generic/hack-4.9/204-module_strip.patch | 2 +- .../generic/hack-4.9/220-gc_sections.patch | 45 +++++++++++-------- .../linux/generic/hack-4.9/930-crashlog.patch | 4 +- .../601-add-kernel-imq-support.patch | 10 ++--- ...leton-for-Aquantia-AQtionUSB-to-5GbE.patch | 2 +- .../203-kallsyms_uncompressed.patch | 2 +- .../601-add-kernel-imq-support.patch | 10 ++--- ...leton-for-Aquantia-AQtionUSB-to-5GbE.patch | 2 +- .../pending-4.19/920-mangle_bootargs.patch | 2 +- .../601-add-kernel-imq-support.patch | 8 ++-- .../301-arch-support-layerscape.patch | 6 +-- .../805-qe-support-layerscape.patch | 6 +-- .../807-usb-support-layerscape.patch | 6 +-- .../823-pm-support-layerscape.patch | 4 +- 56 files changed, 211 insertions(+), 179 deletions(-) diff --git a/include/kernel-version.mk b/include/kernel-version.mk index 14db2a9693..4ae7831ee3 100644 --- a/include/kernel-version.mk +++ b/include/kernel-version.mk @@ -6,13 +6,13 @@ ifdef CONFIG_TESTING_KERNEL KERNEL_PATCHVER:=$(KERNEL_TESTING_PATCHVER) endif -LINUX_VERSION-4.9 = .303 -LINUX_VERSION-4.14 = .268 -LINUX_VERSION-4.19 = .231 +LINUX_VERSION-4.9 = .307 +LINUX_VERSION-4.14 = .272 +LINUX_VERSION-4.19 = .235 -LINUX_KERNEL_HASH-4.9.303 = 45e9050fc13df0fe2fe291512d261a07a7649b82a00c134eda0abc3a19121ae5 -LINUX_KERNEL_HASH-4.14.268 = cf62422aaa7f5a888ed3e5baeb89b90ba697cb712e653e52fd7dd8220f11b6f5 -LINUX_KERNEL_HASH-4.19.231 = 673123b3b3b05e2d8586c82a342ff2556e0b1f2caaadd643fefb9d91d58d8131 +LINUX_KERNEL_HASH-4.9.307 = 47470f83aa64e0098830a53176c959740742973663fead7ca7cc7b84e1f9d0f7 +LINUX_KERNEL_HASH-4.14.272 = 9b6178099cf33c534c971f3f065c0debe92788f0f504d54badb2f8c2ee089d69 +LINUX_KERNEL_HASH-4.19.235 = 530c5ac848111bbf7d1ad407a4ce8173ef8f9a4554477a32c695c5a4eaf02598 remove_uri_prefix=$(subst git://,,$(subst http://,,$(subst https://,,$(1)))) sanitize_uri=$(call qstrip,$(subst @,_,$(subst :,_,$(subst .,_,$(subst -,_,$(subst /,_,$(1))))))) diff --git a/target/linux/ar71xx/patches-4.14/910-unaligned_access_hacks.patch b/target/linux/ar71xx/patches-4.14/910-unaligned_access_hacks.patch index b007ee859a..31f1ed779d 100644 --- a/target/linux/ar71xx/patches-4.14/910-unaligned_access_hacks.patch +++ b/target/linux/ar71xx/patches-4.14/910-unaligned_access_hacks.patch @@ -312,7 +312,7 @@ #endif /* _LINUX_TYPES_H */ --- a/net/ipv4/af_inet.c +++ b/net/ipv4/af_inet.c -@@ -1352,8 +1352,8 @@ struct sk_buff **inet_gro_receive(struct +@@ -1355,8 +1355,8 @@ struct sk_buff **inet_gro_receive(struct if (unlikely(ip_fast_csum((u8 *)iph, 5))) goto out_unlock; @@ -576,7 +576,7 @@ goto next_ht; --- a/net/ipv6/ip6_offload.c +++ b/net/ipv6/ip6_offload.c -@@ -221,7 +221,7 @@ static struct sk_buff **ipv6_gro_receive +@@ -223,7 +223,7 @@ static struct sk_buff **ipv6_gro_receive continue; iph2 = (struct ipv6hdr *)(p->data + off); diff --git a/target/linux/ar71xx/patches-4.9/910-unaligned_access_hacks.patch b/target/linux/ar71xx/patches-4.9/910-unaligned_access_hacks.patch index e0bb5521bb..e6a299708b 100644 --- a/target/linux/ar71xx/patches-4.9/910-unaligned_access_hacks.patch +++ b/target/linux/ar71xx/patches-4.9/910-unaligned_access_hacks.patch @@ -303,7 +303,7 @@ #endif /* _LINUX_TYPES_H */ --- a/net/ipv4/af_inet.c +++ b/net/ipv4/af_inet.c -@@ -1319,8 +1319,8 @@ struct sk_buff **inet_gro_receive(struct +@@ -1322,8 +1322,8 @@ struct sk_buff **inet_gro_receive(struct if (unlikely(ip_fast_csum((u8 *)iph, 5))) goto out_unlock; @@ -567,7 +567,7 @@ goto next_ht; --- a/net/ipv6/ip6_offload.c +++ b/net/ipv6/ip6_offload.c -@@ -221,7 +221,7 @@ static struct sk_buff **ipv6_gro_receive +@@ -223,7 +223,7 @@ static struct sk_buff **ipv6_gro_receive continue; iph2 = (struct ipv6hdr *)(p->data + off); diff --git a/target/linux/ath79/patches-4.14/910-unaligned_access_hacks.patch b/target/linux/ath79/patches-4.14/910-unaligned_access_hacks.patch index b122dd848f..c758458fa6 100644 --- a/target/linux/ath79/patches-4.14/910-unaligned_access_hacks.patch +++ b/target/linux/ath79/patches-4.14/910-unaligned_access_hacks.patch @@ -303,7 +303,7 @@ #endif /* _LINUX_TYPES_H */ --- a/net/ipv4/af_inet.c +++ b/net/ipv4/af_inet.c -@@ -1352,8 +1352,8 @@ struct sk_buff **inet_gro_receive(struct +@@ -1355,8 +1355,8 @@ struct sk_buff **inet_gro_receive(struct if (unlikely(ip_fast_csum((u8 *)iph, 5))) goto out_unlock; @@ -556,7 +556,7 @@ goto next_ht; --- a/net/ipv6/ip6_offload.c +++ b/net/ipv6/ip6_offload.c -@@ -221,7 +221,7 @@ static struct sk_buff **ipv6_gro_receive +@@ -223,7 +223,7 @@ static struct sk_buff **ipv6_gro_receive continue; iph2 = (struct ipv6hdr *)(p->data + off); diff --git a/target/linux/ath79/patches-4.19/910-unaligned_access_hacks.patch b/target/linux/ath79/patches-4.19/910-unaligned_access_hacks.patch index 57e8a5f209..1ba65d78e8 100644 --- a/target/linux/ath79/patches-4.19/910-unaligned_access_hacks.patch +++ b/target/linux/ath79/patches-4.19/910-unaligned_access_hacks.patch @@ -303,7 +303,7 @@ #endif /* _LINUX_TYPES_H */ --- a/net/ipv4/af_inet.c +++ b/net/ipv4/af_inet.c -@@ -1422,8 +1422,8 @@ struct sk_buff *inet_gro_receive(struct +@@ -1425,8 +1425,8 @@ struct sk_buff *inet_gro_receive(struct if (unlikely(ip_fast_csum((u8 *)iph, 5))) goto out_unlock; @@ -556,7 +556,7 @@ goto next_ht; --- a/net/ipv6/ip6_offload.c +++ b/net/ipv6/ip6_offload.c -@@ -223,7 +223,7 @@ static struct sk_buff *ipv6_gro_receive( +@@ -225,7 +225,7 @@ static struct sk_buff *ipv6_gro_receive( continue; iph2 = (struct ipv6hdr *)(p->data + off); diff --git a/target/linux/bcm27xx/patches-4.19/950-0028-i2c-bcm2835-Add-debug-support.patch b/target/linux/bcm27xx/patches-4.19/950-0028-i2c-bcm2835-Add-debug-support.patch index d6372ec7cb..637b414234 100644 --- a/target/linux/bcm27xx/patches-4.19/950-0028-i2c-bcm2835-Add-debug-support.patch +++ b/target/linux/bcm27xx/patches-4.19/950-0028-i2c-bcm2835-Add-debug-support.patch @@ -37,7 +37,7 @@ Signed-off-by: Noralf Trønnes --- a/drivers/i2c/busses/i2c-bcm2835.c +++ b/drivers/i2c/busses/i2c-bcm2835.c -@@ -56,6 +56,18 @@ +@@ -61,6 +61,18 @@ #define BCM2835_I2C_CDIV_MIN 0x0002 #define BCM2835_I2C_CDIV_MAX 0xFFFE @@ -56,7 +56,7 @@ Signed-off-by: Noralf Trønnes struct bcm2835_i2c_dev { struct device *dev; void __iomem *regs; -@@ -69,8 +81,78 @@ struct bcm2835_i2c_dev { +@@ -74,8 +86,78 @@ struct bcm2835_i2c_dev { u32 msg_err; u8 *msg_buf; size_t msg_buf_remaining; @@ -135,7 +135,7 @@ Signed-off-by: Noralf Trønnes static inline void bcm2835_i2c_writel(struct bcm2835_i2c_dev *i2c_dev, u32 reg, u32 val) { -@@ -189,6 +271,7 @@ static void bcm2835_i2c_start_transfer(s +@@ -194,6 +276,7 @@ static void bcm2835_i2c_start_transfer(s bcm2835_i2c_writel(i2c_dev, BCM2835_I2C_A, msg->addr); bcm2835_i2c_writel(i2c_dev, BCM2835_I2C_DLEN, msg->len); bcm2835_i2c_writel(i2c_dev, BCM2835_I2C_C, c); @@ -143,7 +143,7 @@ Signed-off-by: Noralf Trønnes } static void bcm2835_i2c_finish_transfer(struct bcm2835_i2c_dev *i2c_dev) -@@ -215,6 +298,7 @@ static irqreturn_t bcm2835_i2c_isr(int t +@@ -220,6 +303,7 @@ static irqreturn_t bcm2835_i2c_isr(int t u32 val, err; val = bcm2835_i2c_readl(i2c_dev, BCM2835_I2C_S); @@ -151,7 +151,7 @@ Signed-off-by: Noralf Trønnes err = val & (BCM2835_I2C_S_CLKT | BCM2835_I2C_S_ERR); if (err) { -@@ -281,6 +365,13 @@ static int bcm2835_i2c_xfer(struct i2c_a +@@ -286,6 +370,13 @@ static int bcm2835_i2c_xfer(struct i2c_a unsigned long time_left; int i, ret; @@ -165,7 +165,7 @@ Signed-off-by: Noralf Trønnes for (i = 0; i < (num - 1); i++) if (msgs[i].flags & I2C_M_RD) { dev_warn_once(i2c_dev->dev, -@@ -303,6 +394,10 @@ static int bcm2835_i2c_xfer(struct i2c_a +@@ -308,6 +399,10 @@ static int bcm2835_i2c_xfer(struct i2c_a bcm2835_i2c_finish_transfer(i2c_dev); @@ -176,7 +176,7 @@ Signed-off-by: Noralf Trønnes if (!time_left) { bcm2835_i2c_writel(i2c_dev, BCM2835_I2C_C, BCM2835_I2C_C_CLEAR); -@@ -313,7 +408,9 @@ static int bcm2835_i2c_xfer(struct i2c_a +@@ -318,7 +413,9 @@ static int bcm2835_i2c_xfer(struct i2c_a if (!i2c_dev->msg_err) return num; diff --git a/target/linux/bcm27xx/patches-4.19/950-0446-i2c-bcm2835-Model-Divider-in-CCF.patch b/target/linux/bcm27xx/patches-4.19/950-0446-i2c-bcm2835-Model-Divider-in-CCF.patch index dc251a60c4..c26f28378e 100644 --- a/target/linux/bcm27xx/patches-4.19/950-0446-i2c-bcm2835-Model-Divider-in-CCF.patch +++ b/target/linux/bcm27xx/patches-4.19/950-0446-i2c-bcm2835-Model-Divider-in-CCF.patch @@ -45,7 +45,7 @@ Signed-off-by: Wolfram Sang #include #include #include -@@ -71,9 +73,7 @@ struct bcm2835_debug { +@@ -76,9 +78,7 @@ struct bcm2835_debug { struct bcm2835_i2c_dev { struct device *dev; void __iomem *regs; @@ -55,7 +55,7 @@ Signed-off-by: Wolfram Sang struct i2c_adapter adapter; struct completion completion; struct i2c_msg *curr_msg; -@@ -164,12 +164,17 @@ static inline u32 bcm2835_i2c_readl(stru +@@ -169,12 +169,17 @@ static inline u32 bcm2835_i2c_readl(stru return readl(i2c_dev->regs + reg); } @@ -77,7 +77,7 @@ Signed-off-by: Wolfram Sang /* * Per the datasheet, the register is always interpreted as an even * number, by rounding down. In other words, the LSB is ignored. So, -@@ -178,12 +183,23 @@ static int bcm2835_i2c_set_divider(struc +@@ -183,12 +188,23 @@ static int bcm2835_i2c_set_divider(struc if (divider & 1) divider++; if ((divider < BCM2835_I2C_CDIV_MIN) || @@ -105,7 +105,7 @@ Signed-off-by: Wolfram Sang /* * Number of core clocks to wait after falling edge before -@@ -198,12 +214,62 @@ static int bcm2835_i2c_set_divider(struc +@@ -203,12 +219,62 @@ static int bcm2835_i2c_set_divider(struc */ redl = max(divider / 4, 1u); @@ -169,7 +169,7 @@ Signed-off-by: Wolfram Sang static void bcm2835_fill_txfifo(struct bcm2835_i2c_dev *i2c_dev) { u32 val; -@@ -363,7 +429,7 @@ static int bcm2835_i2c_xfer(struct i2c_a +@@ -368,7 +434,7 @@ static int bcm2835_i2c_xfer(struct i2c_a { struct bcm2835_i2c_dev *i2c_dev = i2c_get_adapdata(adap); unsigned long time_left; @@ -178,7 +178,7 @@ Signed-off-by: Wolfram Sang if (debug) i2c_dev->debug_num_msgs = num; -@@ -379,10 +445,6 @@ static int bcm2835_i2c_xfer(struct i2c_a +@@ -384,10 +450,6 @@ static int bcm2835_i2c_xfer(struct i2c_a return -EOPNOTSUPP; } @@ -189,7 +189,7 @@ Signed-off-by: Wolfram Sang i2c_dev->curr_msg = msgs; i2c_dev->num_msgs = num; reinit_completion(&i2c_dev->completion); -@@ -443,6 +505,9 @@ static int bcm2835_i2c_probe(struct plat +@@ -448,6 +510,9 @@ static int bcm2835_i2c_probe(struct plat struct resource *mem, *irq; int ret; struct i2c_adapter *adap; @@ -199,7 +199,7 @@ Signed-off-by: Wolfram Sang i2c_dev = devm_kzalloc(&pdev->dev, sizeof(*i2c_dev), GFP_KERNEL); if (!i2c_dev) -@@ -456,21 +521,6 @@ static int bcm2835_i2c_probe(struct plat +@@ -461,21 +526,6 @@ static int bcm2835_i2c_probe(struct plat if (IS_ERR(i2c_dev->regs)) return PTR_ERR(i2c_dev->regs); @@ -221,7 +221,7 @@ Signed-off-by: Wolfram Sang irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0); if (!irq) { dev_err(&pdev->dev, "No IRQ resource\n"); -@@ -485,6 +535,35 @@ static int bcm2835_i2c_probe(struct plat +@@ -490,6 +540,35 @@ static int bcm2835_i2c_probe(struct plat return -ENODEV; } @@ -257,7 +257,7 @@ Signed-off-by: Wolfram Sang adap = &i2c_dev->adapter; i2c_set_adapdata(adap, i2c_dev); adap->owner = THIS_MODULE; -@@ -507,6 +586,10 @@ static int bcm2835_i2c_probe(struct plat +@@ -518,6 +597,10 @@ static int bcm2835_i2c_probe(struct plat static int bcm2835_i2c_remove(struct platform_device *pdev) { struct bcm2835_i2c_dev *i2c_dev = platform_get_drvdata(pdev); diff --git a/target/linux/bcm27xx/patches-4.19/950-0573-xhci-implement-xhci_fixup_endpoint-for-interval-adju.patch b/target/linux/bcm27xx/patches-4.19/950-0573-xhci-implement-xhci_fixup_endpoint-for-interval-adju.patch index a1841d37bc..5b6193faae 100644 --- a/target/linux/bcm27xx/patches-4.19/950-0573-xhci-implement-xhci_fixup_endpoint-for-interval-adju.patch +++ b/target/linux/bcm27xx/patches-4.19/950-0573-xhci-implement-xhci_fixup_endpoint-for-interval-adju.patch @@ -15,7 +15,7 @@ Signed-off-by: Jonathan Bell --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c -@@ -1445,6 +1445,103 @@ command_cleanup: +@@ -1452,6 +1452,103 @@ command_cleanup: } /* @@ -119,7 +119,7 @@ Signed-off-by: Jonathan Bell * non-error returns are a promise to giveback() the urb later * we drop ownership so next owner (or urb unlink) can get it */ -@@ -5261,6 +5358,7 @@ static const struct hc_driver xhci_hc_dr +@@ -5271,6 +5368,7 @@ static const struct hc_driver xhci_hc_dr .endpoint_reset = xhci_endpoint_reset, .check_bandwidth = xhci_check_bandwidth, .reset_bandwidth = xhci_reset_bandwidth, diff --git a/target/linux/bcm27xx/patches-4.19/950-0605-i2c-bcm2835-Move-IRQ-request-after-clock-code-in-pro.patch b/target/linux/bcm27xx/patches-4.19/950-0605-i2c-bcm2835-Move-IRQ-request-after-clock-code-in-pro.patch index b363e753ea..3ea7b0a71b 100644 --- a/target/linux/bcm27xx/patches-4.19/950-0605-i2c-bcm2835-Move-IRQ-request-after-clock-code-in-pro.patch +++ b/target/linux/bcm27xx/patches-4.19/950-0605-i2c-bcm2835-Move-IRQ-request-after-clock-code-in-pro.patch @@ -22,7 +22,7 @@ Signed-off-by: Wolfram Sang --- a/drivers/i2c/busses/i2c-bcm2835.c +++ b/drivers/i2c/busses/i2c-bcm2835.c -@@ -521,20 +521,6 @@ static int bcm2835_i2c_probe(struct plat +@@ -526,20 +526,6 @@ static int bcm2835_i2c_probe(struct plat if (IS_ERR(i2c_dev->regs)) return PTR_ERR(i2c_dev->regs); @@ -43,7 +43,7 @@ Signed-off-by: Wolfram Sang mclk_name = of_clk_get_parent_name(pdev->dev.of_node, 0); bus_clk = bcm2835_i2c_register_div(&pdev->dev, mclk_name, i2c_dev); -@@ -564,6 +550,20 @@ static int bcm2835_i2c_probe(struct plat +@@ -569,6 +555,20 @@ static int bcm2835_i2c_probe(struct plat return ret; } diff --git a/target/linux/bcm27xx/patches-4.19/950-0606-i2c-bcm2835-Ensure-clock-exists-when-probing.patch b/target/linux/bcm27xx/patches-4.19/950-0606-i2c-bcm2835-Ensure-clock-exists-when-probing.patch index 4a468f0291..4737c2e634 100644 --- a/target/linux/bcm27xx/patches-4.19/950-0606-i2c-bcm2835-Ensure-clock-exists-when-probing.patch +++ b/target/linux/bcm27xx/patches-4.19/950-0606-i2c-bcm2835-Ensure-clock-exists-when-probing.patch @@ -23,7 +23,7 @@ Signed-off-by: Wolfram Sang --- a/drivers/i2c/busses/i2c-bcm2835.c +++ b/drivers/i2c/busses/i2c-bcm2835.c -@@ -244,15 +244,18 @@ static const struct clk_ops clk_bcm2835_ +@@ -249,15 +249,18 @@ static const struct clk_ops clk_bcm2835_ }; static struct clk *bcm2835_i2c_register_div(struct device *dev, @@ -43,7 +43,7 @@ Signed-off-by: Wolfram Sang init.ops = &clk_bcm2835_i2c_ops; init.name = name; init.parent_names = (const char* []) { mclk_name }; -@@ -505,8 +508,8 @@ static int bcm2835_i2c_probe(struct plat +@@ -510,8 +513,8 @@ static int bcm2835_i2c_probe(struct plat struct resource *mem, *irq; int ret; struct i2c_adapter *adap; @@ -53,7 +53,7 @@ Signed-off-by: Wolfram Sang u32 bus_clk_rate; i2c_dev = devm_kzalloc(&pdev->dev, sizeof(*i2c_dev), GFP_KERNEL); -@@ -521,9 +524,14 @@ static int bcm2835_i2c_probe(struct plat +@@ -526,9 +529,14 @@ static int bcm2835_i2c_probe(struct plat if (IS_ERR(i2c_dev->regs)) return PTR_ERR(i2c_dev->regs); diff --git a/target/linux/bcm27xx/patches-4.19/950-0610-i2c-bcm2835-Set-clock-stretch-timeout-to-35ms.patch b/target/linux/bcm27xx/patches-4.19/950-0610-i2c-bcm2835-Set-clock-stretch-timeout-to-35ms.patch index 280cddf9f2..c0d6d5a3f1 100644 --- a/target/linux/bcm27xx/patches-4.19/950-0610-i2c-bcm2835-Set-clock-stretch-timeout-to-35ms.patch +++ b/target/linux/bcm27xx/patches-4.19/950-0610-i2c-bcm2835-Set-clock-stretch-timeout-to-35ms.patch @@ -19,7 +19,7 @@ Signed-off-by: Phil Elwell --- a/drivers/i2c/busses/i2c-bcm2835.c +++ b/drivers/i2c/busses/i2c-bcm2835.c -@@ -194,6 +194,7 @@ static int clk_bcm2835_i2c_set_rate(stru +@@ -199,6 +199,7 @@ static int clk_bcm2835_i2c_set_rate(stru { struct clk_bcm2835_i2c *div = to_clk_bcm2835_i2c(hw); u32 redl, fedl; @@ -27,7 +27,7 @@ Signed-off-by: Phil Elwell u32 divider = clk_bcm2835_i2c_calc_divider(rate, parent_rate); if (divider == -EINVAL) -@@ -217,6 +218,17 @@ static int clk_bcm2835_i2c_set_rate(stru +@@ -222,6 +223,17 @@ static int clk_bcm2835_i2c_set_rate(stru bcm2835_i2c_writel(div->i2c_dev, BCM2835_I2C_DEL, (fedl << BCM2835_I2C_FEDL_SHIFT) | (redl << BCM2835_I2C_REDL_SHIFT)); diff --git a/target/linux/cns3xxx/patches-4.14/010-arm_introduce-dma-fiq-irq-broadcast.patch b/target/linux/cns3xxx/patches-4.14/010-arm_introduce-dma-fiq-irq-broadcast.patch index 3841ca032b..c067be634f 100644 --- a/target/linux/cns3xxx/patches-4.14/010-arm_introduce-dma-fiq-irq-broadcast.patch +++ b/target/linux/cns3xxx/patches-4.14/010-arm_introduce-dma-fiq-irq-broadcast.patch @@ -20,7 +20,7 @@ #endif --- a/arch/arm/mm/Kconfig +++ b/arch/arm/mm/Kconfig -@@ -922,6 +922,17 @@ config DMA_CACHE_RWFO +@@ -933,6 +933,17 @@ config DMA_CACHE_RWFO in hardware, other workarounds are needed (e.g. cache maintenance broadcasting in software via FIQ). diff --git a/target/linux/cns3xxx/patches-4.14/040-fiq_support.patch b/target/linux/cns3xxx/patches-4.14/040-fiq_support.patch index 5a62eb38ac..184e271791 100644 --- a/target/linux/cns3xxx/patches-4.14/040-fiq_support.patch +++ b/target/linux/cns3xxx/patches-4.14/040-fiq_support.patch @@ -29,7 +29,7 @@ */ --- a/arch/arm/mm/Kconfig +++ b/arch/arm/mm/Kconfig -@@ -905,7 +905,7 @@ config VDSO +@@ -916,7 +916,7 @@ config VDSO config DMA_CACHE_RWFO bool "Enable read/write for ownership DMA cache maintenance" diff --git a/target/linux/cns3xxx/patches-4.19/010-arm_introduce-dma-fiq-irq-broadcast.patch b/target/linux/cns3xxx/patches-4.19/010-arm_introduce-dma-fiq-irq-broadcast.patch index 45f8feead4..63276d1571 100644 --- a/target/linux/cns3xxx/patches-4.19/010-arm_introduce-dma-fiq-irq-broadcast.patch +++ b/target/linux/cns3xxx/patches-4.19/010-arm_introduce-dma-fiq-irq-broadcast.patch @@ -20,7 +20,7 @@ #endif --- a/arch/arm/mm/Kconfig +++ b/arch/arm/mm/Kconfig -@@ -916,6 +916,17 @@ config DMA_CACHE_RWFO +@@ -927,6 +927,17 @@ config DMA_CACHE_RWFO in hardware, other workarounds are needed (e.g. cache maintenance broadcasting in software via FIQ). diff --git a/target/linux/cns3xxx/patches-4.19/040-fiq_support.patch b/target/linux/cns3xxx/patches-4.19/040-fiq_support.patch index bee8c1ef24..5fbe156b68 100644 --- a/target/linux/cns3xxx/patches-4.19/040-fiq_support.patch +++ b/target/linux/cns3xxx/patches-4.19/040-fiq_support.patch @@ -29,7 +29,7 @@ */ --- a/arch/arm/mm/Kconfig +++ b/arch/arm/mm/Kconfig -@@ -899,7 +899,7 @@ config VDSO +@@ -910,7 +910,7 @@ config VDSO config DMA_CACHE_RWFO bool "Enable read/write for ownership DMA cache maintenance" diff --git a/target/linux/generic/backport-4.14/030-USB-serial-option-fix-dwm-158-3g-modem-interface.patch b/target/linux/generic/backport-4.14/030-USB-serial-option-fix-dwm-158-3g-modem-interface.patch index 7e96f20a51..81574d8684 100644 --- a/target/linux/generic/backport-4.14/030-USB-serial-option-fix-dwm-158-3g-modem-interface.patch +++ b/target/linux/generic/backport-4.14/030-USB-serial-option-fix-dwm-158-3g-modem-interface.patch @@ -30,7 +30,7 @@ Signed-off-by: Johan Hovold --- a/drivers/usb/serial/option.c +++ b/drivers/usb/serial/option.c -@@ -2060,7 +2060,8 @@ static const struct usb_device_id option +@@ -2072,7 +2072,8 @@ static const struct usb_device_id option { USB_DEVICE_INTERFACE_CLASS(0x2001, 0x7d01, 0xff) }, /* D-Link DWM-156 (variant) */ { USB_DEVICE_INTERFACE_CLASS(0x2001, 0x7d02, 0xff) }, { USB_DEVICE_INTERFACE_CLASS(0x2001, 0x7d03, 0xff) }, diff --git a/target/linux/generic/backport-4.14/290-v4.16-netfilter-core-make-nf_unregister_net_hooks-simple-w.patch b/target/linux/generic/backport-4.14/290-v4.16-netfilter-core-make-nf_unregister_net_hooks-simple-w.patch index 35800c4acf..0d8bd4c176 100644 --- a/target/linux/generic/backport-4.14/290-v4.16-netfilter-core-make-nf_unregister_net_hooks-simple-w.patch +++ b/target/linux/generic/backport-4.14/290-v4.16-netfilter-core-make-nf_unregister_net_hooks-simple-w.patch @@ -22,7 +22,7 @@ Signed-off-by: Pablo Neira Ayuso --- a/net/netfilter/core.c +++ b/net/netfilter/core.c -@@ -395,63 +395,10 @@ EXPORT_SYMBOL(nf_register_net_hooks); +@@ -396,63 +396,10 @@ EXPORT_SYMBOL(nf_register_net_hooks); void nf_unregister_net_hooks(struct net *net, const struct nf_hook_ops *reg, unsigned int hookcount) { diff --git a/target/linux/generic/backport-4.14/291-v4.16-netfilter-core-remove-synchronize_net-call-if-nfqueu.patch b/target/linux/generic/backport-4.14/291-v4.16-netfilter-core-remove-synchronize_net-call-if-nfqueu.patch index cbaaaa619a..305a58c120 100644 --- a/target/linux/generic/backport-4.14/291-v4.16-netfilter-core-remove-synchronize_net-call-if-nfqueu.patch +++ b/target/linux/generic/backport-4.14/291-v4.16-netfilter-core-remove-synchronize_net-call-if-nfqueu.patch @@ -32,7 +32,7 @@ Signed-off-by: Pablo Neira Ayuso void nf_register_queue_handler(struct net *net, const struct nf_queue_handler *qh); --- a/net/netfilter/core.c +++ b/net/netfilter/core.c -@@ -341,7 +341,6 @@ void nf_unregister_net_hook(struct net * +@@ -342,7 +342,6 @@ void nf_unregister_net_hook(struct net * { struct nf_hook_entries __rcu **pp; struct nf_hook_entries *p; @@ -40,7 +40,7 @@ Signed-off-by: Pablo Neira Ayuso pp = nf_hook_entry_head(net, reg); if (!pp) -@@ -364,10 +363,7 @@ void nf_unregister_net_hook(struct net * +@@ -365,10 +364,7 @@ void nf_unregister_net_hook(struct net * synchronize_net(); @@ -65,7 +65,7 @@ Signed-off-by: Pablo Neira Ayuso int __init netfilter_log_init(void); --- a/net/netfilter/nf_queue.c +++ b/net/netfilter/nf_queue.c -@@ -96,18 +96,15 @@ void nf_queue_entry_get_refs(struct nf_q +@@ -109,18 +109,15 @@ bool nf_queue_entry_get_refs(struct nf_q } EXPORT_SYMBOL_GPL(nf_queue_entry_get_refs); @@ -88,7 +88,7 @@ Signed-off-by: Pablo Neira Ayuso --- a/net/netfilter/nfnetlink_queue.c +++ b/net/netfilter/nfnetlink_queue.c -@@ -942,23 +942,18 @@ static struct notifier_block nfqnl_dev_n +@@ -948,23 +948,18 @@ static struct notifier_block nfqnl_dev_n .notifier_call = nfqnl_rcv_dev_event, }; diff --git a/target/linux/generic/backport-4.14/292-v4.16-netfilter-core-free-hooks-with-call_rcu.patch b/target/linux/generic/backport-4.14/292-v4.16-netfilter-core-free-hooks-with-call_rcu.patch index 5eca73552b..500b4409af 100644 --- a/target/linux/generic/backport-4.14/292-v4.16-netfilter-core-free-hooks-with-call_rcu.patch +++ b/target/linux/generic/backport-4.14/292-v4.16-netfilter-core-free-hooks-with-call_rcu.patch @@ -107,7 +107,7 @@ Signed-off-by: Pablo Neira Ayuso static unsigned int accept_all(void *priv, struct sk_buff *skb, const struct nf_hook_state *state) -@@ -291,9 +316,8 @@ int nf_register_net_hook(struct net *net +@@ -292,9 +317,8 @@ int nf_register_net_hook(struct net *net #ifdef HAVE_JUMP_LABEL static_key_slow_inc(&nf_hooks_needed[reg->pf][reg->hooknum]); #endif @@ -118,7 +118,7 @@ Signed-off-by: Pablo Neira Ayuso return 0; } EXPORT_SYMBOL(nf_register_net_hook); -@@ -361,10 +385,8 @@ void nf_unregister_net_hook(struct net * +@@ -362,10 +386,8 @@ void nf_unregister_net_hook(struct net * if (!p) return; diff --git a/target/linux/generic/backport-4.14/293-v4.16-netfilter-reduce-size-of-hook-entry-point-locations.patch b/target/linux/generic/backport-4.14/293-v4.16-netfilter-reduce-size-of-hook-entry-point-locations.patch index 90e3500f0e..eaa4feca2c 100644 --- a/target/linux/generic/backport-4.14/293-v4.16-netfilter-reduce-size-of-hook-entry-point-locations.patch +++ b/target/linux/generic/backport-4.14/293-v4.16-netfilter-reduce-size-of-hook-entry-point-locations.patch @@ -129,7 +129,7 @@ Signed-off-by: Pablo Neira Ayuso #ifdef CONFIG_NETFILTER_INGRESS if (reg->hooknum == NF_NETDEV_INGRESS) { -@@ -534,14 +549,21 @@ void (*nf_nat_decode_session_hook)(struc +@@ -535,14 +550,21 @@ void (*nf_nat_decode_session_hook)(struc EXPORT_SYMBOL(nf_nat_decode_session_hook); #endif @@ -159,7 +159,7 @@ Signed-off-by: Pablo Neira Ayuso net->nf.proc_netfilter = proc_net_mkdir(net, "netfilter", --- a/net/netfilter/nf_queue.c +++ b/net/netfilter/nf_queue.c -@@ -206,6 +206,23 @@ repeat: +@@ -223,6 +223,23 @@ repeat: return NF_ACCEPT; } @@ -183,7 +183,7 @@ Signed-off-by: Pablo Neira Ayuso /* Caller must hold rcu read-side lock */ void nf_reinject(struct nf_queue_entry *entry, unsigned int verdict) { -@@ -221,12 +238,12 @@ void nf_reinject(struct nf_queue_entry * +@@ -238,12 +255,12 @@ void nf_reinject(struct nf_queue_entry * net = entry->state.net; pf = entry->state.pf; diff --git a/target/linux/generic/backport-4.14/294-v4.16-netfilter-reduce-hook-array-sizes-to-what-is-needed.patch b/target/linux/generic/backport-4.14/294-v4.16-netfilter-reduce-hook-array-sizes-to-what-is-needed.patch index d9009b8e1f..2a9a6d94c5 100644 --- a/target/linux/generic/backport-4.14/294-v4.16-netfilter-reduce-hook-array-sizes-to-what-is-needed.patch +++ b/target/linux/generic/backport-4.14/294-v4.16-netfilter-reduce-hook-array-sizes-to-what-is-needed.patch @@ -64,7 +64,7 @@ Signed-off-by: Pablo Neira Ayuso return net->nf.hooks_decnet + reg->hooknum; default: WARN_ON_ONCE(1); -@@ -549,21 +559,21 @@ void (*nf_nat_decode_session_hook)(struc +@@ -550,21 +560,21 @@ void (*nf_nat_decode_session_hook)(struc EXPORT_SYMBOL(nf_nat_decode_session_hook); #endif diff --git a/target/linux/generic/backport-4.14/295-v4.16-netfilter-don-t-allocate-space-for-decnet-hooks-unle.patch b/target/linux/generic/backport-4.14/295-v4.16-netfilter-don-t-allocate-space-for-decnet-hooks-unle.patch index 26a93c40ae..0019802f2c 100644 --- a/target/linux/generic/backport-4.14/295-v4.16-netfilter-don-t-allocate-space-for-decnet-hooks-unle.patch +++ b/target/linux/generic/backport-4.14/295-v4.16-netfilter-don-t-allocate-space-for-decnet-hooks-unle.patch @@ -55,7 +55,7 @@ Signed-off-by: Pablo Neira Ayuso default: WARN_ON_ONCE(1); return NULL; -@@ -573,7 +575,9 @@ static int __net_init netfilter_net_init +@@ -574,7 +576,9 @@ static int __net_init netfilter_net_init __netfilter_net_init(net->nf.hooks_ipv6, ARRAY_SIZE(net->nf.hooks_ipv6)); __netfilter_net_init(net->nf.hooks_arp, ARRAY_SIZE(net->nf.hooks_arp)); __netfilter_net_init(net->nf.hooks_bridge, ARRAY_SIZE(net->nf.hooks_bridge)); diff --git a/target/linux/generic/backport-4.14/296-v4.16-netfilter-don-t-allocate-space-for-arp-bridge-hooks-.patch b/target/linux/generic/backport-4.14/296-v4.16-netfilter-don-t-allocate-space-for-arp-bridge-hooks-.patch index 41675c3494..9e55dabdc9 100644 --- a/target/linux/generic/backport-4.14/296-v4.16-netfilter-don-t-allocate-space-for-arp-bridge-hooks-.patch +++ b/target/linux/generic/backport-4.14/296-v4.16-netfilter-don-t-allocate-space-for-arp-bridge-hooks-.patch @@ -137,7 +137,7 @@ Signed-off-by: Pablo Neira Ayuso case NFPROTO_IPV4: if (WARN_ON_ONCE(ARRAY_SIZE(net->nf.hooks_ipv4) <= reg->hooknum)) return NULL; -@@ -573,8 +577,12 @@ static int __net_init netfilter_net_init +@@ -574,8 +578,12 @@ static int __net_init netfilter_net_init { __netfilter_net_init(net->nf.hooks_ipv4, ARRAY_SIZE(net->nf.hooks_ipv4)); __netfilter_net_init(net->nf.hooks_ipv6, ARRAY_SIZE(net->nf.hooks_ipv6)); @@ -152,7 +152,7 @@ Signed-off-by: Pablo Neira Ayuso #endif --- a/net/netfilter/nf_queue.c +++ b/net/netfilter/nf_queue.c -@@ -209,8 +209,10 @@ repeat: +@@ -226,8 +226,10 @@ repeat: static struct nf_hook_entries *nf_hook_entries_head(const struct net *net, u8 pf, u8 hooknum) { switch (pf) { diff --git a/target/linux/generic/backport-4.14/297-v4.16-netfilter-core-pass-hook-number-family-and-device-to.patch b/target/linux/generic/backport-4.14/297-v4.16-netfilter-core-pass-hook-number-family-and-device-to.patch index 7d450f95f0..55bc7ec1e8 100644 --- a/target/linux/generic/backport-4.14/297-v4.16-netfilter-core-pass-hook-number-family-and-device-to.patch +++ b/target/linux/generic/backport-4.14/297-v4.16-netfilter-core-pass-hook-number-family-and-device-to.patch @@ -87,7 +87,7 @@ Signed-off-by: Pablo Neira Ayuso if (!pp) return -EINVAL; -@@ -397,7 +399,7 @@ void nf_unregister_net_hook(struct net * +@@ -398,7 +400,7 @@ void nf_unregister_net_hook(struct net * struct nf_hook_entries __rcu **pp; struct nf_hook_entries *p; diff --git a/target/linux/generic/backport-4.14/298-v4.16-netfilter-core-add-nf_remove_net_hook.patch b/target/linux/generic/backport-4.14/298-v4.16-netfilter-core-add-nf_remove_net_hook.patch index 8fea44b359..30d5c5843b 100644 --- a/target/linux/generic/backport-4.14/298-v4.16-netfilter-core-add-nf_remove_net_hook.patch +++ b/target/linux/generic/backport-4.14/298-v4.16-netfilter-core-add-nf_remove_net_hook.patch @@ -13,7 +13,7 @@ Signed-off-by: Pablo Neira Ayuso --- a/net/netfilter/core.c +++ b/net/netfilter/core.c -@@ -356,7 +356,7 @@ int nf_register_net_hook(struct net *net +@@ -357,7 +357,7 @@ int nf_register_net_hook(struct net *net EXPORT_SYMBOL(nf_register_net_hook); /* @@ -22,7 +22,7 @@ Signed-off-by: Pablo Neira Ayuso * * @oldp: current address of hook blob * @unreg: hook to unregister -@@ -364,8 +364,8 @@ EXPORT_SYMBOL(nf_register_net_hook); +@@ -365,8 +365,8 @@ EXPORT_SYMBOL(nf_register_net_hook); * This cannot fail, hook unregistration must always succeed. * Therefore replace the to-be-removed hook with a dummy hook. */ @@ -33,7 +33,7 @@ Signed-off-by: Pablo Neira Ayuso { struct nf_hook_ops **orig_ops; bool found = false; -@@ -411,7 +411,7 @@ void nf_unregister_net_hook(struct net * +@@ -412,7 +412,7 @@ void nf_unregister_net_hook(struct net * return; } diff --git a/target/linux/generic/backport-4.14/298-v4.16-netfilter-core-pass-family-as-parameter-to-nf_remove.patch b/target/linux/generic/backport-4.14/298-v4.16-netfilter-core-pass-family-as-parameter-to-nf_remove.patch index 4c52635c13..49e856b70e 100644 --- a/target/linux/generic/backport-4.14/298-v4.16-netfilter-core-pass-family-as-parameter-to-nf_remove.patch +++ b/target/linux/generic/backport-4.14/298-v4.16-netfilter-core-pass-family-as-parameter-to-nf_remove.patch @@ -13,7 +13,7 @@ Signed-off-by: Pablo Neira Ayuso --- a/net/netfilter/core.c +++ b/net/netfilter/core.c -@@ -365,7 +365,7 @@ EXPORT_SYMBOL(nf_register_net_hook); +@@ -366,7 +366,7 @@ EXPORT_SYMBOL(nf_register_net_hook); * Therefore replace the to-be-removed hook with a dummy hook. */ static void nf_remove_net_hook(struct nf_hook_entries *old, @@ -22,7 +22,7 @@ Signed-off-by: Pablo Neira Ayuso { struct nf_hook_ops **orig_ops; bool found = false; -@@ -383,14 +383,14 @@ static void nf_remove_net_hook(struct nf +@@ -384,14 +384,14 @@ static void nf_remove_net_hook(struct nf if (found) { #ifdef CONFIG_NETFILTER_INGRESS @@ -40,7 +40,7 @@ Signed-off-by: Pablo Neira Ayuso } } -@@ -411,7 +411,7 @@ void nf_unregister_net_hook(struct net * +@@ -412,7 +412,7 @@ void nf_unregister_net_hook(struct net * return; } diff --git a/target/linux/generic/backport-4.14/299-v4.16-netfilter-core-support-for-NFPROTO_INET-hook-registr.patch b/target/linux/generic/backport-4.14/299-v4.16-netfilter-core-support-for-NFPROTO_INET-hook-registr.patch index b112855132..722ba9d4aa 100644 --- a/target/linux/generic/backport-4.14/299-v4.16-netfilter-core-support-for-NFPROTO_INET-hook-registr.patch +++ b/target/linux/generic/backport-4.14/299-v4.16-netfilter-core-support-for-NFPROTO_INET-hook-registr.patch @@ -39,9 +39,9 @@ Signed-off-by: Pablo Neira Ayuso if (!pp) return -EINVAL; -@@ -343,17 +344,16 @@ int nf_register_net_hook(struct net *net +@@ -344,17 +345,16 @@ int nf_register_net_hook(struct net *net + return PTR_ERR(new_hooks); - hooks_validate(new_hooks); #ifdef CONFIG_NETFILTER_INGRESS - if (reg->pf == NFPROTO_NETDEV && reg->hooknum == NF_NETDEV_INGRESS) + if (pf == NFPROTO_NETDEV && reg->hooknum == NF_NETDEV_INGRESS) @@ -59,7 +59,7 @@ Signed-off-by: Pablo Neira Ayuso /* * nf_remove_net_hook - remove a hook from blob -@@ -394,12 +394,13 @@ static void nf_remove_net_hook(struct nf +@@ -395,12 +395,13 @@ static void nf_remove_net_hook(struct nf } } @@ -75,7 +75,7 @@ Signed-off-by: Pablo Neira Ayuso if (!pp) return; -@@ -411,7 +412,7 @@ void nf_unregister_net_hook(struct net * +@@ -412,7 +413,7 @@ void nf_unregister_net_hook(struct net * return; } @@ -84,7 +84,7 @@ Signed-off-by: Pablo Neira Ayuso p = __nf_hook_entries_try_shrink(pp); mutex_unlock(&nf_hook_mutex); -@@ -421,8 +422,42 @@ void nf_unregister_net_hook(struct net * +@@ -422,8 +423,42 @@ void nf_unregister_net_hook(struct net * nf_queue_nf_hook_drop(net); nf_hook_entries_free(p); } diff --git a/target/linux/generic/backport-4.14/306-v4.16-netfilter-remove-saveroute-indirection-in-struct-nf_.patch b/target/linux/generic/backport-4.14/306-v4.16-netfilter-remove-saveroute-indirection-in-struct-nf_.patch index 943b3eed30..78c898b0b5 100644 --- a/target/linux/generic/backport-4.14/306-v4.16-netfilter-remove-saveroute-indirection-in-struct-nf_.patch +++ b/target/linux/generic/backport-4.14/306-v4.16-netfilter-remove-saveroute-indirection-in-struct-nf_.patch @@ -176,7 +176,7 @@ Signed-off-by: Pablo Neira Ayuso #include #include #include -@@ -108,6 +110,35 @@ void nf_queue_nf_hook_drop(struct net *n +@@ -121,6 +123,35 @@ void nf_queue_nf_hook_drop(struct net *n } EXPORT_SYMBOL_GPL(nf_queue_nf_hook_drop); @@ -212,10 +212,10 @@ Signed-off-by: Pablo Neira Ayuso static int __nf_queue(struct sk_buff *skb, const struct nf_hook_state *state, const struct nf_hook_entries *entries, unsigned int index, unsigned int queuenum) -@@ -148,7 +179,16 @@ static int __nf_queue(struct sk_buff *sk - }; +@@ -165,7 +196,16 @@ static int __nf_queue(struct sk_buff *sk + return -ENOTCONN; + } - nf_queue_entry_get_refs(entry); - afinfo->saveroute(skb, entry); + + switch (entry->state.pf) { diff --git a/target/linux/generic/backport-4.14/308-v4.16-netfilter-move-reroute-indirection-to-struct-nf_ipv6.patch b/target/linux/generic/backport-4.14/308-v4.16-netfilter-move-reroute-indirection-to-struct-nf_ipv6.patch index 810f57ca19..bf351a8b2a 100644 --- a/target/linux/generic/backport-4.14/308-v4.16-netfilter-move-reroute-indirection-to-struct-nf_ipv6.patch +++ b/target/linux/generic/backport-4.14/308-v4.16-netfilter-move-reroute-indirection-to-struct-nf_ipv6.patch @@ -171,7 +171,7 @@ Signed-off-by: Pablo Neira Ayuso --- a/net/netfilter/nf_queue.c +++ b/net/netfilter/nf_queue.c -@@ -271,7 +271,6 @@ void nf_reinject(struct nf_queue_entry * +@@ -288,7 +288,6 @@ void nf_reinject(struct nf_queue_entry * const struct nf_hook_entry *hook_entry; const struct nf_hook_entries *hooks; struct sk_buff *skb = entry->skb; @@ -179,7 +179,7 @@ Signed-off-by: Pablo Neira Ayuso const struct net *net; unsigned int i; int err; -@@ -298,8 +297,7 @@ void nf_reinject(struct nf_queue_entry * +@@ -315,8 +314,7 @@ void nf_reinject(struct nf_queue_entry * verdict = nf_hook_entry_hookfn(hook_entry, skb, &entry->state); if (verdict == NF_ACCEPT) { diff --git a/target/linux/generic/backport-4.14/309-v4.16-netfilter-remove-route_key_size-field-in-struct-nf_a.patch b/target/linux/generic/backport-4.14/309-v4.16-netfilter-remove-route_key_size-field-in-struct-nf_a.patch index 20820e40ca..9911416c39 100644 --- a/target/linux/generic/backport-4.14/309-v4.16-netfilter-remove-route_key_size-field-in-struct-nf_a.patch +++ b/target/linux/generic/backport-4.14/309-v4.16-netfilter-remove-route_key_size-field-in-struct-nf_a.patch @@ -48,7 +48,7 @@ Signed-off-by: Pablo Neira Ayuso #include #include #include -@@ -145,9 +147,9 @@ static int __nf_queue(struct sk_buff *sk +@@ -158,9 +160,9 @@ static int __nf_queue(struct sk_buff *sk { int status = -ENOENT; struct nf_queue_entry *entry = NULL; @@ -59,7 +59,7 @@ Signed-off-by: Pablo Neira Ayuso /* QUEUE == DROP if no one is waiting, to be safe. */ qh = rcu_dereference(net->nf.queue_handler); -@@ -156,11 +158,19 @@ static int __nf_queue(struct sk_buff *sk +@@ -169,11 +171,19 @@ static int __nf_queue(struct sk_buff *sk goto err; } @@ -83,7 +83,7 @@ Signed-off-by: Pablo Neira Ayuso if (!entry) { status = -ENOMEM; goto err; -@@ -175,7 +185,7 @@ static int __nf_queue(struct sk_buff *sk +@@ -188,7 +198,7 @@ static int __nf_queue(struct sk_buff *sk .skb = skb, .state = *state, .hook_index = index, @@ -91,4 +91,4 @@ Signed-off-by: Pablo Neira Ayuso + .size = sizeof(*entry) + route_key_size, }; - nf_queue_entry_get_refs(entry); + if (!nf_queue_entry_get_refs(entry)) { diff --git a/target/linux/generic/backport-4.14/336-v4.15-netfilter-exit_net-cleanup-check-added.patch b/target/linux/generic/backport-4.14/336-v4.15-netfilter-exit_net-cleanup-check-added.patch index bd26f2d163..698ddbc213 100644 --- a/target/linux/generic/backport-4.14/336-v4.15-netfilter-exit_net-cleanup-check-added.patch +++ b/target/linux/generic/backport-4.14/336-v4.15-netfilter-exit_net-cleanup-check-added.patch @@ -62,7 +62,7 @@ Signed-off-by: Pablo Neira Ayuso static struct pernet_operations nfnl_log_net_ops = { --- a/net/netfilter/nfnetlink_queue.c +++ b/net/netfilter/nfnetlink_queue.c -@@ -1511,10 +1511,15 @@ static int __net_init nfnl_queue_net_ini +@@ -1517,10 +1517,15 @@ static int __net_init nfnl_queue_net_ini static void __net_exit nfnl_queue_net_exit(struct net *net) { diff --git a/target/linux/generic/backport-4.9/090-net-generalize-napi_complete_done.patch b/target/linux/generic/backport-4.9/090-net-generalize-napi_complete_done.patch index 8bac270271..82a00543f1 100644 --- a/target/linux/generic/backport-4.9/090-net-generalize-napi_complete_done.patch +++ b/target/linux/generic/backport-4.9/090-net-generalize-napi_complete_done.patch @@ -1379,7 +1379,7 @@ Signed-off-by: David S. Miller */ --- a/drivers/net/xen-netfront.c +++ b/drivers/net/xen-netfront.c -@@ -1132,7 +1132,7 @@ err: +@@ -1138,7 +1138,7 @@ err: if (work_done < budget) { int more_to_do = 0; diff --git a/target/linux/generic/config-4.14 b/target/linux/generic/config-4.14 index 2bd2346a28..ba50b0051a 100644 --- a/target/linux/generic/config-4.14 +++ b/target/linux/generic/config-4.14 @@ -1656,6 +1656,7 @@ CONFIG_GENERIC_NET_UTILS=y # CONFIG_HAMACHI is not set # CONFIG_HAMRADIO is not set # CONFIG_HAPPYMEAL is not set +# CONFIG_HARDEN_BRANCH_HISTORY is not set # CONFIG_HARDENED_USERCOPY is not set # CONFIG_HARDENED_USERCOPY_PAGESPAN is not set # CONFIG_HARDLOCKUP_DETECTOR is not set diff --git a/target/linux/generic/config-4.19 b/target/linux/generic/config-4.19 index dffb130266..eef43c9f67 100644 --- a/target/linux/generic/config-4.19 +++ b/target/linux/generic/config-4.19 @@ -1737,6 +1737,7 @@ CONFIG_GPIOLIB_FASTPATH_LIMIT=512 # CONFIG_HAMACHI is not set # CONFIG_HAMRADIO is not set # CONFIG_HAPPYMEAL is not set +# CONFIG_HARDEN_BRANCH_HISTORY is not set CONFIG_HARDENED_USERCOPY=y # CONFIG_HARDENED_USERCOPY_FALLBACK is not set # CONFIG_HARDENED_USERCOPY_PAGESPAN is not set diff --git a/target/linux/generic/config-4.9 b/target/linux/generic/config-4.9 index c8e530dd13..e3935582c0 100644 --- a/target/linux/generic/config-4.9 +++ b/target/linux/generic/config-4.9 @@ -1465,6 +1465,7 @@ CONFIG_GENERIC_NET_UTILS=y # CONFIG_HAMACHI is not set # CONFIG_HAMRADIO is not set # CONFIG_HAPPYMEAL is not set +# CONFIG_HARDEN_BRANCH_HISTORY is not set # CONFIG_HARDENED_USERCOPY is not set # CONFIG_HARDLOCKUP_DETECTOR is not set # CONFIG_HAVE_AOUT is not set diff --git a/target/linux/generic/hack-4.14/220-gc_sections.patch b/target/linux/generic/hack-4.14/220-gc_sections.patch index 2605d7f78f..cf493a2574 100644 --- a/target/linux/generic/hack-4.14/220-gc_sections.patch +++ b/target/linux/generic/hack-4.14/220-gc_sections.patch @@ -67,7 +67,7 @@ Signed-off-by: Gabor Juhos # but it is being used too early to link to meaningful stack_chk logic. --- a/arch/arm/kernel/vmlinux.lds.S +++ b/arch/arm/kernel/vmlinux.lds.S -@@ -18,7 +18,7 @@ +@@ -31,7 +31,7 @@ #define PROC_INFO \ . = ALIGN(4); \ VMLINUX_SYMBOL(__proc_info_begin) = .; \ @@ -76,7 +76,7 @@ Signed-off-by: Gabor Juhos VMLINUX_SYMBOL(__proc_info_end) = .; #define HYPERVISOR_TEXT \ -@@ -29,11 +29,11 @@ +@@ -42,11 +42,11 @@ #define IDMAP_TEXT \ ALIGN_FUNCTION(); \ VMLINUX_SYMBOL(__idmap_text_start) = .; \ @@ -90,7 +90,7 @@ Signed-off-by: Gabor Juhos VMLINUX_SYMBOL(__hyp_idmap_text_end) = .; #ifdef CONFIG_HOTPLUG_CPU -@@ -106,7 +106,7 @@ SECTIONS +@@ -119,7 +119,7 @@ SECTIONS _stext = .; /* Text and read-only data */ IDMAP_TEXT __exception_text_start = .; @@ -99,7 +99,7 @@ Signed-off-by: Gabor Juhos __exception_text_end = .; IRQENTRY_TEXT SOFTIRQENTRY_TEXT -@@ -135,7 +135,7 @@ SECTIONS +@@ -148,7 +148,7 @@ SECTIONS __ex_table : AT(ADDR(__ex_table) - LOAD_OFFSET) { __start___ex_table = .; #ifdef CONFIG_MMU @@ -108,7 +108,7 @@ Signed-off-by: Gabor Juhos #endif __stop___ex_table = .; } -@@ -147,12 +147,12 @@ SECTIONS +@@ -160,12 +160,12 @@ SECTIONS . = ALIGN(8); .ARM.unwind_idx : { __start_unwind_idx = .; @@ -123,24 +123,33 @@ Signed-off-by: Gabor Juhos __stop_unwind_tab = .; } #endif -@@ -172,14 +172,14 @@ SECTIONS - */ - __vectors_start = .; - .vectors 0xffff0000 : AT(__vectors_start) { -- *(.vectors) -+ KEEP(*(.vectors)) +@@ -186,13 +186,13 @@ SECTIONS + __vectors_lma = .; + OVERLAY 0xffff0000 : NOCROSSREFS AT(__vectors_lma) { + .vectors { +- *(.vectors) ++ KEEP(*(.vectors)) + } + .vectors.bhb.loop8 { +- *(.vectors.bhb.loop8) ++ KEEP(*(.vectors.bhb.loop8)) + } + .vectors.bhb.bpiall { +- *(.vectors.bhb.bpiall) ++ KEEP(*(.vectors.bhb.bpiall)) + } } - . = __vectors_start + SIZEOF(.vectors); - __vectors_end = .; + ARM_LMA(__vectors, .vectors); +@@ -204,7 +204,7 @@ SECTIONS - __stubs_start = .; - .stubs ADDR(.vectors) + 0x1000 : AT(__stubs_start) { + __stubs_lma = .; + .stubs ADDR(.vectors) + 0x1000 : AT(__stubs_lma) { - *(.stubs) + KEEP(*(.stubs)) } - . = __stubs_start + SIZEOF(.stubs); - __stubs_end = .; -@@ -195,24 +195,24 @@ SECTIONS + ARM_LMA(__stubs, .stubs); + . = __stubs_lma + SIZEOF(.stubs); +@@ -220,24 +220,24 @@ SECTIONS } .init.arch.info : { __arch_info_begin = .; diff --git a/target/linux/generic/hack-4.14/930-crashlog.patch b/target/linux/generic/hack-4.14/930-crashlog.patch index fd58841af0..3fa29a62a7 100644 --- a/target/linux/generic/hack-4.14/930-crashlog.patch +++ b/target/linux/generic/hack-4.14/930-crashlog.patch @@ -318,7 +318,7 @@ Signed-off-by: Felix Fietkau #include #include -@@ -447,6 +448,8 @@ static void __init_memblock memblock_ins +@@ -453,6 +454,8 @@ static void __init_memblock memblock_ins memblock_set_region_node(rgn, nid); type->cnt++; type->total_size += size; @@ -327,7 +327,7 @@ Signed-off-by: Felix Fietkau } /** -@@ -486,6 +489,8 @@ int __init_memblock memblock_add_range(s +@@ -492,6 +495,8 @@ int __init_memblock memblock_add_range(s type->regions[0].flags = flags; memblock_set_region_node(&type->regions[0], nid); type->total_size = size; diff --git a/target/linux/generic/hack-4.14/998-usb-serial-option-add-u9300.patch b/target/linux/generic/hack-4.14/998-usb-serial-option-add-u9300.patch index b98e21d3d8..c57a1342e5 100644 --- a/target/linux/generic/hack-4.14/998-usb-serial-option-add-u9300.patch +++ b/target/linux/generic/hack-4.14/998-usb-serial-option-add-u9300.patch @@ -10,7 +10,7 @@ {QMI_QUIRK_SET_DTR(0x2c7c, 0x0195, 4)}, /* Quectel EG95 */ --- a/drivers/usb/serial/option.c +++ b/drivers/usb/serial/option.c -@@ -389,6 +389,7 @@ static void option_instat_callback(struc +@@ -391,6 +391,7 @@ static void option_instat_callback(struc * Mobidata, etc sell under their own brand names. */ #define LONGCHEER_VENDOR_ID 0x1c9e @@ -18,7 +18,7 @@ /* 4G Systems products */ /* This is the 4G XS Stick W14 a.k.a. Mobilcom Debitel Surf-Stick * -@@ -586,6 +587,16 @@ static void option_instat_callback(struc +@@ -588,6 +589,16 @@ static void option_instat_callback(struc /* Device needs ZLP */ #define ZLP BIT(17) @@ -35,7 +35,7 @@ static const struct usb_device_id option_ids[] = { { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) }, -@@ -620,6 +631,8 @@ static const struct usb_device_id option +@@ -622,6 +633,8 @@ static const struct usb_device_id option { USB_DEVICE(QUANTA_VENDOR_ID, QUANTA_PRODUCT_GLE) }, { USB_DEVICE(QUANTA_VENDOR_ID, 0xea42), .driver_info = RSVD(4) }, diff --git a/target/linux/generic/hack-4.19/204-module_strip.patch b/target/linux/generic/hack-4.19/204-module_strip.patch index 6c94301e14..39b93c5a99 100644 --- a/target/linux/generic/hack-4.19/204-module_strip.patch +++ b/target/linux/generic/hack-4.19/204-module_strip.patch @@ -98,7 +98,7 @@ Signed-off-by: Felix Fietkau --- a/init/Kconfig +++ b/init/Kconfig -@@ -2007,6 +2007,13 @@ config TRIM_UNUSED_KSYMS +@@ -2010,6 +2010,13 @@ config TRIM_UNUSED_KSYMS If unsure, or if you need to build out-of-tree modules, say N. diff --git a/target/linux/generic/hack-4.19/220-gc_sections.patch b/target/linux/generic/hack-4.19/220-gc_sections.patch index 823b7bee21..bc2a65d9d0 100644 --- a/target/linux/generic/hack-4.19/220-gc_sections.patch +++ b/target/linux/generic/hack-4.19/220-gc_sections.patch @@ -98,7 +98,7 @@ Signed-off-by: Gabor Juhos --- a/arch/arm/kernel/vmlinux.lds.h +++ b/arch/arm/kernel/vmlinux.lds.h -@@ -22,13 +22,13 @@ +@@ -22,7 +22,7 @@ #define ARM_MMU_DISCARD(x) #else #define ARM_MMU_KEEP(x) @@ -106,15 +106,17 @@ Signed-off-by: Gabor Juhos +#define ARM_MMU_DISCARD(x) KEEP(x) #endif + /* +@@ -41,7 +41,7 @@ #define PROC_INFO \ . = ALIGN(4); \ __proc_info_begin = .; \ - *(.proc.info.init) \ -+ KEEP(*(.proc.info.init)) \ ++ KEEP(*(.proc.info.init)) \ __proc_info_end = .; #define HYPERVISOR_TEXT \ -@@ -39,11 +39,11 @@ +@@ -52,11 +52,11 @@ #define IDMAP_TEXT \ ALIGN_FUNCTION(); \ __idmap_text_start = .; \ @@ -128,7 +130,7 @@ Signed-off-by: Gabor Juhos __hyp_idmap_text_end = .; #define ARM_DISCARD \ -@@ -86,12 +86,12 @@ +@@ -99,12 +99,12 @@ . = ALIGN(8); \ .ARM.unwind_idx : { \ __start_unwind_idx = .; \ @@ -143,23 +145,32 @@ Signed-off-by: Gabor Juhos __stop_unwind_tab = .; \ } -@@ -102,14 +102,14 @@ - #define ARM_VECTORS \ - __vectors_start = .; \ - .vectors 0xffff0000 : AT(__vectors_start) { \ -- *(.vectors) \ -+ KEEP(*(.vectors)) \ +@@ -116,13 +116,13 @@ + __vectors_lma = .; \ + OVERLAY 0xffff0000 : NOCROSSREFS AT(__vectors_lma) { \ + .vectors { \ +- *(.vectors) \ ++ KEEP(*(.vectors)) \ + } \ + .vectors.bhb.loop8 { \ +- *(.vectors.bhb.loop8) \ ++ KEEP(*(.vectors.bhb.loop8)) \ + } \ + .vectors.bhb.bpiall { \ +- *(.vectors.bhb.bpiall) \ ++ KEEP(*(.vectors.bhb.bpiall)) \ + } \ } \ - . = __vectors_start + SIZEOF(.vectors); \ - __vectors_end = .; \ + ARM_LMA(__vectors, .vectors); \ +@@ -134,7 +134,7 @@ \ - __stubs_start = .; \ - .stubs ADDR(.vectors) + 0x1000 : AT(__stubs_start) { \ + __stubs_lma = .; \ + .stubs ADDR(.vectors) + 0x1000 : AT(__stubs_lma) { \ - *(.stubs) \ + KEEP(*(.stubs)) \ } \ - . = __stubs_start + SIZEOF(.stubs); \ - __stubs_end = .; \ + ARM_LMA(__stubs, .stubs); \ + . = __stubs_lma + SIZEOF(.stubs); \ --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig @@ -43,6 +43,7 @@ config MIPS diff --git a/target/linux/generic/hack-4.19/930-crashlog.patch b/target/linux/generic/hack-4.19/930-crashlog.patch index b9d0d048b4..574f31ae21 100644 --- a/target/linux/generic/hack-4.19/930-crashlog.patch +++ b/target/linux/generic/hack-4.19/930-crashlog.patch @@ -41,7 +41,7 @@ Signed-off-by: Felix Fietkau +#endif --- a/init/Kconfig +++ b/init/Kconfig -@@ -1049,6 +1049,10 @@ config RELAY +@@ -1052,6 +1052,10 @@ config RELAY If unsure, say N. @@ -318,7 +318,7 @@ Signed-off-by: Felix Fietkau #include #include -@@ -510,6 +511,8 @@ static void __init_memblock memblock_ins +@@ -516,6 +517,8 @@ static void __init_memblock memblock_ins memblock_set_region_node(rgn, nid); type->cnt++; type->total_size += size; @@ -327,7 +327,7 @@ Signed-off-by: Felix Fietkau } /** -@@ -549,6 +552,8 @@ int __init_memblock memblock_add_range(s +@@ -555,6 +558,8 @@ int __init_memblock memblock_add_range(s type->regions[0].flags = flags; memblock_set_region_node(&type->regions[0], nid); type->total_size = size; diff --git a/target/linux/generic/hack-4.19/998-usb-serial-option-add-u9300.patch b/target/linux/generic/hack-4.19/998-usb-serial-option-add-u9300.patch index 09b166e8c4..0908aae72d 100644 --- a/target/linux/generic/hack-4.19/998-usb-serial-option-add-u9300.patch +++ b/target/linux/generic/hack-4.19/998-usb-serial-option-add-u9300.patch @@ -10,7 +10,7 @@ {QMI_QUIRK_SET_DTR(0x2c7c, 0x0195, 4)}, /* Quectel EG95 */ --- a/drivers/usb/serial/option.c +++ b/drivers/usb/serial/option.c -@@ -386,6 +386,7 @@ static void option_instat_callback(struc +@@ -388,6 +388,7 @@ static void option_instat_callback(struc * Mobidata, etc sell under their own brand names. */ #define LONGCHEER_VENDOR_ID 0x1c9e @@ -18,7 +18,7 @@ /* 4G Systems products */ /* This is the 4G XS Stick W14 a.k.a. Mobilcom Debitel Surf-Stick * -@@ -583,6 +584,16 @@ static void option_instat_callback(struc +@@ -585,6 +586,16 @@ static void option_instat_callback(struc /* Device needs ZLP */ #define ZLP BIT(17) @@ -35,7 +35,7 @@ static const struct usb_device_id option_ids[] = { { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) }, -@@ -617,6 +628,8 @@ static const struct usb_device_id option +@@ -619,6 +630,8 @@ static const struct usb_device_id option { USB_DEVICE(QUANTA_VENDOR_ID, QUANTA_PRODUCT_GLE) }, { USB_DEVICE(QUANTA_VENDOR_ID, 0xea42), .driver_info = RSVD(4) }, diff --git a/target/linux/generic/hack-4.9/204-module_strip.patch b/target/linux/generic/hack-4.9/204-module_strip.patch index 7996c8b5cb..994cf6e3b5 100644 --- a/target/linux/generic/hack-4.9/204-module_strip.patch +++ b/target/linux/generic/hack-4.9/204-module_strip.patch @@ -171,7 +171,7 @@ Signed-off-by: Felix Fietkau static void add_retpoline(struct buffer *b) { +#ifndef CONFIG_MODULE_STRIPPED - buf_printf(b, "\n#ifdef RETPOLINE\n"); + buf_printf(b, "\n#ifdef CONFIG_RETPOLINE\n"); buf_printf(b, "MODULE_INFO(retpoline, \"Y\");\n"); buf_printf(b, "#endif\n"); +#endif diff --git a/target/linux/generic/hack-4.9/220-gc_sections.patch b/target/linux/generic/hack-4.9/220-gc_sections.patch index 4e512262a2..b649d1f362 100644 --- a/target/linux/generic/hack-4.9/220-gc_sections.patch +++ b/target/linux/generic/hack-4.9/220-gc_sections.patch @@ -67,7 +67,7 @@ Signed-off-by: Gabor Juhos # but it is being used too early to link to meaningful stack_chk logic. --- a/arch/arm/kernel/vmlinux.lds.S +++ b/arch/arm/kernel/vmlinux.lds.S -@@ -17,7 +17,7 @@ +@@ -30,7 +30,7 @@ #define PROC_INFO \ . = ALIGN(4); \ VMLINUX_SYMBOL(__proc_info_begin) = .; \ @@ -76,7 +76,7 @@ Signed-off-by: Gabor Juhos VMLINUX_SYMBOL(__proc_info_end) = .; #define HYPERVISOR_TEXT \ -@@ -28,11 +28,11 @@ +@@ -41,11 +41,11 @@ #define IDMAP_TEXT \ ALIGN_FUNCTION(); \ VMLINUX_SYMBOL(__idmap_text_start) = .; \ @@ -90,7 +90,7 @@ Signed-off-by: Gabor Juhos VMLINUX_SYMBOL(__hyp_idmap_text_end) = .; #ifdef CONFIG_HOTPLUG_CPU -@@ -105,7 +105,7 @@ SECTIONS +@@ -118,7 +118,7 @@ SECTIONS _stext = .; /* Text and read-only data */ IDMAP_TEXT __exception_text_start = .; @@ -99,7 +99,7 @@ Signed-off-by: Gabor Juhos __exception_text_end = .; IRQENTRY_TEXT SOFTIRQENTRY_TEXT -@@ -134,7 +134,7 @@ SECTIONS +@@ -147,7 +147,7 @@ SECTIONS __ex_table : AT(ADDR(__ex_table) - LOAD_OFFSET) { __start___ex_table = .; #ifdef CONFIG_MMU @@ -108,7 +108,7 @@ Signed-off-by: Gabor Juhos #endif __stop___ex_table = .; } -@@ -146,12 +146,12 @@ SECTIONS +@@ -159,12 +159,12 @@ SECTIONS . = ALIGN(8); .ARM.unwind_idx : { __start_unwind_idx = .; @@ -123,24 +123,33 @@ Signed-off-by: Gabor Juhos __stop_unwind_tab = .; } #endif -@@ -171,14 +171,14 @@ SECTIONS - */ - __vectors_start = .; - .vectors 0xffff0000 : AT(__vectors_start) { -- *(.vectors) -+ KEEP(*(.vectors)) +@@ -185,13 +185,13 @@ SECTIONS + __vectors_lma = .; + OVERLAY 0xffff0000 : NOCROSSREFS AT(__vectors_lma) { + .vectors { +- *(.vectors) ++ KEEP(*(.vectors)) + } + .vectors.bhb.loop8 { +- *(.vectors.bhb.loop8) ++ KEEP(*(.vectors.bhb.loop8)) + } + .vectors.bhb.bpiall { +- *(.vectors.bhb.bpiall) ++ KEEP(*(.vectors.bhb.bpiall)) + } } - . = __vectors_start + SIZEOF(.vectors); - __vectors_end = .; + ARM_LMA(__vectors, .vectors); +@@ -203,7 +203,7 @@ SECTIONS - __stubs_start = .; - .stubs ADDR(.vectors) + 0x1000 : AT(__stubs_start) { + __stubs_lma = .; + .stubs ADDR(.vectors) + 0x1000 : AT(__stubs_lma) { - *(.stubs) + KEEP(*(.stubs)) } - . = __stubs_start + SIZEOF(.stubs); - __stubs_end = .; -@@ -194,24 +194,24 @@ SECTIONS + ARM_LMA(__stubs, .stubs); + . = __stubs_lma + SIZEOF(.stubs); +@@ -219,24 +219,24 @@ SECTIONS } .init.arch.info : { __arch_info_begin = .; diff --git a/target/linux/generic/hack-4.9/930-crashlog.patch b/target/linux/generic/hack-4.9/930-crashlog.patch index 85f8bb5b35..419d147f5f 100644 --- a/target/linux/generic/hack-4.9/930-crashlog.patch +++ b/target/linux/generic/hack-4.9/930-crashlog.patch @@ -318,7 +318,7 @@ Signed-off-by: Felix Fietkau #include #include -@@ -459,6 +460,8 @@ static void __init_memblock memblock_ins +@@ -465,6 +466,8 @@ static void __init_memblock memblock_ins memblock_set_region_node(rgn, nid); type->cnt++; type->total_size += size; @@ -327,7 +327,7 @@ Signed-off-by: Felix Fietkau } /** -@@ -498,6 +501,8 @@ int __init_memblock memblock_add_range(s +@@ -504,6 +507,8 @@ int __init_memblock memblock_add_range(s type->regions[0].flags = flags; memblock_set_region_node(&type->regions[0], nid); type->total_size = size; diff --git a/target/linux/generic/pending-4.14/601-add-kernel-imq-support.patch b/target/linux/generic/pending-4.14/601-add-kernel-imq-support.patch index 2b7ec3a394..1e57fcf500 100644 --- a/target/linux/generic/pending-4.14/601-add-kernel-imq-support.patch +++ b/target/linux/generic/pending-4.14/601-add-kernel-imq-support.patch @@ -1596,7 +1596,7 @@ +void nf_unregister_queue_imq_handler(void); +#endif - void nf_queue_entry_get_refs(struct nf_queue_entry *entry); + bool nf_queue_entry_get_refs(struct nf_queue_entry *entry); void nf_queue_entry_release_refs(struct nf_queue_entry *entry); --- a/include/net/pkt_sched.h +++ b/include/net/pkt_sched.h @@ -1817,7 +1817,7 @@ static int --- a/net/netfilter/core.c +++ b/net/netfilter/core.c -@@ -490,6 +490,11 @@ int nf_hook_slow(struct sk_buff *skb, st +@@ -491,6 +491,11 @@ int nf_hook_slow(struct sk_buff *skb, st if (ret == 0) ret = -EPERM; return ret; @@ -1892,7 +1892,7 @@ /* return EBUSY when somebody else is registered, return EEXIST if the * same handler is registered, return 0 in case of success. */ void nf_register_queue_handler(struct net *net, const struct nf_queue_handler *qh) -@@ -141,16 +158,29 @@ static void nf_ip6_saveroute(const struc +@@ -154,16 +171,29 @@ static void nf_ip6_saveroute(const struc static int __nf_queue(struct sk_buff *skb, const struct nf_hook_state *state, const struct nf_hook_entries *entries, @@ -1924,7 +1924,7 @@ if (!qh) { status = -ESRCH; goto err; -@@ -218,8 +248,16 @@ int nf_queue(struct sk_buff *skb, struct +@@ -235,8 +265,16 @@ int nf_queue(struct sk_buff *skb, struct { int ret; @@ -1942,7 +1942,7 @@ if (ret == -ESRCH && (verdict & NF_VERDICT_FLAG_QUEUE_BYPASS)) return 1; -@@ -323,6 +361,7 @@ next_hook: +@@ -340,6 +378,7 @@ next_hook: local_bh_enable(); break; case NF_QUEUE: diff --git a/target/linux/generic/pending-4.14/760-net-usb-aqc111-Driver-skeleton-for-Aquantia-AQtionUSB-to-5GbE.patch b/target/linux/generic/pending-4.14/760-net-usb-aqc111-Driver-skeleton-for-Aquantia-AQtionUSB-to-5GbE.patch index db73592638..45b1c52458 100644 --- a/target/linux/generic/pending-4.14/760-net-usb-aqc111-Driver-skeleton-for-Aquantia-AQtionUSB-to-5GbE.patch +++ b/target/linux/generic/pending-4.14/760-net-usb-aqc111-Driver-skeleton-for-Aquantia-AQtionUSB-to-5GbE.patch @@ -1856,7 +1856,7 @@ static const struct usb_device_id products[] = { /* BLACKLIST !! -@@ -849,6 +851,30 @@ static const struct usb_device_id produc +@@ -861,6 +863,30 @@ static const struct usb_device_id produc .driver_info = 0, }, diff --git a/target/linux/generic/pending-4.19/203-kallsyms_uncompressed.patch b/target/linux/generic/pending-4.19/203-kallsyms_uncompressed.patch index 9230279fca..a7869fdddc 100644 --- a/target/linux/generic/pending-4.19/203-kallsyms_uncompressed.patch +++ b/target/linux/generic/pending-4.19/203-kallsyms_uncompressed.patch @@ -13,7 +13,7 @@ Signed-off-by: Felix Fietkau --- a/init/Kconfig +++ b/init/Kconfig -@@ -1149,6 +1149,17 @@ config SYSCTL_ARCH_UNALIGN_ALLOW +@@ -1152,6 +1152,17 @@ config SYSCTL_ARCH_UNALIGN_ALLOW the unaligned access emulation. see arch/parisc/kernel/unaligned.c for reference diff --git a/target/linux/generic/pending-4.19/601-add-kernel-imq-support.patch b/target/linux/generic/pending-4.19/601-add-kernel-imq-support.patch index 5ffe46c32b..4655051b75 100644 --- a/target/linux/generic/pending-4.19/601-add-kernel-imq-support.patch +++ b/target/linux/generic/pending-4.19/601-add-kernel-imq-support.patch @@ -1291,7 +1291,7 @@ +void nf_unregister_queue_imq_handler(void); +#endif - void nf_queue_entry_get_refs(struct nf_queue_entry *entry); + bool nf_queue_entry_get_refs(struct nf_queue_entry *entry); void nf_queue_entry_release_refs(struct nf_queue_entry *entry); --- a/include/net/pkt_sched.h +++ b/include/net/pkt_sched.h @@ -1513,7 +1513,7 @@ obj-$(CONFIG_NETFILTER_XT_TARGET_NETMAP) += xt_NETMAP.o --- a/net/netfilter/core.c +++ b/net/netfilter/core.c -@@ -518,6 +518,11 @@ int nf_hook_slow(struct sk_buff *skb, st +@@ -519,6 +519,11 @@ int nf_hook_slow(struct sk_buff *skb, st if (ret == 0) ret = -EPERM; return ret; @@ -1551,7 +1551,7 @@ /* return EBUSY when somebody else is registered, return EEXIST if the * same handler is registered, return 0 in case of success. */ void nf_register_queue_handler(struct net *net, const struct nf_queue_handler *qh) -@@ -141,16 +158,28 @@ static void nf_ip6_saveroute(const struc +@@ -154,16 +171,28 @@ static void nf_ip6_saveroute(const struc static int __nf_queue(struct sk_buff *skb, const struct nf_hook_state *state, const struct nf_hook_entries *entries, @@ -1582,7 +1582,7 @@ if (!qh) { status = -ESRCH; goto err; -@@ -218,8 +247,16 @@ int nf_queue(struct sk_buff *skb, struct +@@ -234,8 +263,16 @@ int nf_queue(struct sk_buff *skb, struct { int ret; @@ -1600,7 +1600,7 @@ if (ret == -ESRCH && (verdict & NF_VERDICT_FLAG_QUEUE_BYPASS)) return 1; -@@ -323,6 +360,7 @@ next_hook: +@@ -339,6 +376,7 @@ next_hook: local_bh_enable(); break; case NF_QUEUE: diff --git a/target/linux/generic/pending-4.19/760-net-usb-aqc111-Driver-skeleton-for-Aquantia-AQtionUSB-to-5GbE.patch b/target/linux/generic/pending-4.19/760-net-usb-aqc111-Driver-skeleton-for-Aquantia-AQtionUSB-to-5GbE.patch index 6b5608e31a..356b4dcd33 100644 --- a/target/linux/generic/pending-4.19/760-net-usb-aqc111-Driver-skeleton-for-Aquantia-AQtionUSB-to-5GbE.patch +++ b/target/linux/generic/pending-4.19/760-net-usb-aqc111-Driver-skeleton-for-Aquantia-AQtionUSB-to-5GbE.patch @@ -1856,7 +1856,7 @@ static const struct usb_device_id products[] = { /* BLACKLIST !! -@@ -849,6 +851,30 @@ static const struct usb_device_id produc +@@ -861,6 +863,30 @@ static const struct usb_device_id produc .driver_info = 0, }, diff --git a/target/linux/generic/pending-4.19/920-mangle_bootargs.patch b/target/linux/generic/pending-4.19/920-mangle_bootargs.patch index 85014cb9d8..d91bb0d98f 100644 --- a/target/linux/generic/pending-4.19/920-mangle_bootargs.patch +++ b/target/linux/generic/pending-4.19/920-mangle_bootargs.patch @@ -13,7 +13,7 @@ Signed-off-by: Imre Kaloz --- a/init/Kconfig +++ b/init/Kconfig -@@ -1541,6 +1541,15 @@ config EMBEDDED +@@ -1544,6 +1544,15 @@ config EMBEDDED an embedded system so certain expert options are available for configuration. diff --git a/target/linux/generic/pending-4.9/601-add-kernel-imq-support.patch b/target/linux/generic/pending-4.9/601-add-kernel-imq-support.patch index 741e631d9f..61fc785ace 100644 --- a/target/linux/generic/pending-4.9/601-add-kernel-imq-support.patch +++ b/target/linux/generic/pending-4.9/601-add-kernel-imq-support.patch @@ -1549,7 +1549,7 @@ +void nf_unregister_queue_imq_handler(void); +#endif - void nf_queue_entry_get_refs(struct nf_queue_entry *entry); + bool nf_queue_entry_get_refs(struct nf_queue_entry *entry); void nf_queue_entry_release_refs(struct nf_queue_entry *entry); --- a/include/net/pkt_sched.h +++ b/include/net/pkt_sched.h @@ -1866,7 +1866,7 @@ /* return EBUSY when somebody else is registered, return EEXIST if the * same handler is registered, return 0 in case of success. */ void nf_register_queue_handler(struct net *net, const struct nf_queue_handler *qh) -@@ -108,16 +125,28 @@ void nf_queue_nf_hook_drop(struct net *n +@@ -121,16 +138,28 @@ void nf_queue_nf_hook_drop(struct net *n } static int __nf_queue(struct sk_buff *skb, const struct nf_hook_state *state, @@ -1897,7 +1897,7 @@ if (!qh) { status = -ESRCH; goto err; -@@ -164,8 +193,14 @@ int nf_queue(struct sk_buff *skb, struct +@@ -181,8 +210,14 @@ int nf_queue(struct sk_buff *skb, struct int ret; RCU_INIT_POINTER(state->hook_entries, entry); @@ -1913,7 +1913,7 @@ if (ret == -ESRCH && (verdict & NF_VERDICT_FLAG_QUEUE_BYPASS)) { *entryp = rcu_dereference(entry->next); -@@ -218,6 +253,7 @@ okfn: +@@ -235,6 +270,7 @@ okfn: local_bh_enable(); break; case NF_QUEUE: diff --git a/target/linux/layerscape/patches-4.14/301-arch-support-layerscape.patch b/target/linux/layerscape/patches-4.14/301-arch-support-layerscape.patch index 27c7d864fa..4659414d4c 100644 --- a/target/linux/layerscape/patches-4.14/301-arch-support-layerscape.patch +++ b/target/linux/layerscape/patches-4.14/301-arch-support-layerscape.patch @@ -214,7 +214,7 @@ Signed-off-by: Zhao Qiang * address space as memory. Needed when the kernel wants to execute --- a/arch/arm/mm/mmu.c +++ b/arch/arm/mm/mmu.c -@@ -315,6 +315,13 @@ static struct mem_type mem_types[] __ro_ +@@ -317,6 +317,13 @@ static struct mem_type mem_types[] __ro_ .prot_sect = PMD_TYPE_SECT | PMD_SECT_AP_WRITE, .domain = DOMAIN_KERNEL, }, @@ -228,7 +228,7 @@ Signed-off-by: Zhao Qiang [MT_ROM] = { .prot_sect = PMD_TYPE_SECT, .domain = DOMAIN_KERNEL, -@@ -651,6 +658,7 @@ static void __init build_mem_type_table( +@@ -653,6 +660,7 @@ static void __init build_mem_type_table( } kern_pgprot |= PTE_EXT_AF; vecs_pgprot |= PTE_EXT_AF; @@ -236,7 +236,7 @@ Signed-off-by: Zhao Qiang /* * Set PXN for user mappings -@@ -679,6 +687,7 @@ static void __init build_mem_type_table( +@@ -681,6 +689,7 @@ static void __init build_mem_type_table( mem_types[MT_MEMORY_RWX].prot_pte |= kern_pgprot; mem_types[MT_MEMORY_RW].prot_sect |= ecc_mask | cp->pmd; mem_types[MT_MEMORY_RW].prot_pte |= kern_pgprot; diff --git a/target/linux/layerscape/patches-4.14/805-qe-support-layerscape.patch b/target/linux/layerscape/patches-4.14/805-qe-support-layerscape.patch index 0a6ad579ff..fc733c4b85 100644 --- a/target/linux/layerscape/patches-4.14/805-qe-support-layerscape.patch +++ b/target/linux/layerscape/patches-4.14/805-qe-support-layerscape.patch @@ -1482,7 +1482,7 @@ Signed-off-by: Zhao Qiang #undef DEBUG -@@ -61,16 +59,16 @@ void __par_io_config_pin(struct qe_pio_r +@@ -63,16 +61,16 @@ void __par_io_config_pin(struct qe_pio_r pin_mask1bit = (u32) (1 << (QE_PIO_PINS - (pin + 1))); /* Set open drain, if required */ @@ -1504,7 +1504,7 @@ Signed-off-by: Zhao Qiang /* get all bits mask for 2 bit per port */ pin_mask2bits = (u32) (0x3 << (QE_PIO_PINS - -@@ -82,34 +80,30 @@ void __par_io_config_pin(struct qe_pio_r +@@ -84,34 +82,30 @@ void __par_io_config_pin(struct qe_pio_r /* clear and set 2 bits mask */ if (pin > (QE_PIO_PINS / 2) - 1) { @@ -1549,7 +1549,7 @@ Signed-off-by: Zhao Qiang } } EXPORT_SYMBOL(__par_io_config_pin); -@@ -137,12 +131,12 @@ int par_io_data_set(u8 port, u8 pin, u8 +@@ -139,12 +133,12 @@ int par_io_data_set(u8 port, u8 pin, u8 /* calculate pin location */ pin_mask = (u32) (1 << (QE_PIO_PINS - 1 - pin)); diff --git a/target/linux/layerscape/patches-4.14/807-usb-support-layerscape.patch b/target/linux/layerscape/patches-4.14/807-usb-support-layerscape.patch index 47525dd8ec..e215ceb2dc 100644 --- a/target/linux/layerscape/patches-4.14/807-usb-support-layerscape.patch +++ b/target/linux/layerscape/patches-4.14/807-usb-support-layerscape.patch @@ -528,7 +528,7 @@ Signed-off-by: Zhao Chenhui reg &= ~DWC3_DCTL_INITU2ENA; --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c -@@ -3257,6 +3257,7 @@ int dwc3_gadget_init(struct dwc3 *dwc) +@@ -3259,6 +3259,7 @@ int dwc3_gadget_init(struct dwc3 *dwc) { int ret; int irq; @@ -536,7 +536,7 @@ Signed-off-by: Zhao Chenhui irq = dwc3_gadget_get_irq(dwc); if (irq < 0) { -@@ -3335,6 +3336,12 @@ int dwc3_gadget_init(struct dwc3 *dwc) +@@ -3337,6 +3338,12 @@ int dwc3_gadget_init(struct dwc3 *dwc) dwc3_gadget_set_speed(&dwc->gadget, dwc->maximum_speed); @@ -1340,7 +1340,7 @@ Signed-off-by: Zhao Chenhui while (ep_ring->dequeue != td->last_trb) --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c -@@ -1615,13 +1615,38 @@ static int xhci_urb_dequeue(struct usb_h +@@ -1625,13 +1625,38 @@ static int xhci_urb_dequeue(struct usb_h ret = -ENOMEM; goto done; } diff --git a/target/linux/layerscape/patches-4.14/823-pm-support-layerscape.patch b/target/linux/layerscape/patches-4.14/823-pm-support-layerscape.patch index 99863c47a0..01665febf4 100644 --- a/target/linux/layerscape/patches-4.14/823-pm-support-layerscape.patch +++ b/target/linux/layerscape/patches-4.14/823-pm-support-layerscape.patch @@ -25,7 +25,7 @@ Signed-off-by: Zhao Chenhui --- a/drivers/firmware/psci.c +++ b/drivers/firmware/psci.c -@@ -437,8 +437,18 @@ CPUIDLE_METHOD_OF_DECLARE(psci, "psci", +@@ -452,8 +452,18 @@ CPUIDLE_METHOD_OF_DECLARE(psci, "psci", static int psci_system_suspend(unsigned long unused) { @@ -46,7 +46,7 @@ Signed-off-by: Zhao Chenhui } static int psci_system_suspend_enter(suspend_state_t state) -@@ -562,6 +572,8 @@ static void __init psci_0_2_set_function +@@ -577,6 +587,8 @@ static void __init psci_0_2_set_function arm_pm_restart = psci_sys_reset; pm_power_off = psci_sys_poweroff; From 6ebc95add10b53f6a673df5529e7f4bfce95a61c Mon Sep 17 00:00:00 2001 From: Florian Eckert Date: Tue, 30 Nov 2021 16:01:14 +0100 Subject: [PATCH 12/20] procd: move service command to procd The service command belongs to the procd and does not belong in the shinit. In the course of the move, the script was also checked with shellcheck and cleaned up. Signed-off-by: Florian Eckert (cherry picked from commit b9017384cae7bbc47186fdf35a80207844876a0d) --- package/base-files/files/etc/profile | 9 --------- package/base-files/files/etc/shinit | 21 ------------------- package/system/procd/Makefile | 1 + package/system/procd/files/service | 30 ++++++++++++++++++++++++++++ 4 files changed, 31 insertions(+), 30 deletions(-) create mode 100644 package/system/procd/files/service diff --git a/package/base-files/files/etc/profile b/package/base-files/files/etc/profile index 9a3ac069a2..0d5a425c3c 100644 --- a/package/base-files/files/etc/profile +++ b/package/base-files/files/etc/profile @@ -48,12 +48,3 @@ in order to prevent unauthorized SSH logins. -------------------------------------------------- EOF fi - -service() { - [ -f "/etc/init.d/$1" ] || { - echo "service "'"'"$1"'"'" not found, the following services are available:" - ls "/etc/init.d" - return 1 - } - /etc/init.d/$@ -} diff --git a/package/base-files/files/etc/shinit b/package/base-files/files/etc/shinit index 6b682d8769..8df9771e65 100755 --- a/package/base-files/files/etc/shinit +++ b/package/base-files/files/etc/shinit @@ -8,26 +8,5 @@ alias ll='ls -alF --color=auto' [ -x /usr/bin/arp -o -x /sbin/arp ] || arp() { cat /proc/net/arp; } [ -x /usr/bin/ldd ] || ldd() { LD_TRACE_LOADED_OBJECTS=1 $*; } -service() { - if [ -f "/etc/init.d/$1" ]; then - /etc/init.d/$@ - else - echo "Usage: service [command]" - if [ -n "$1" ]; then - echo "Service "'"'"$1"'"'" not found, the following services are available:" - else - echo "The following services are available:" - fi - for F in /etc/init.d/* ; do - printf "%-30s\t%10s\t%10s\n" "$F" \ - $( $($F enabled) && echo "enabled" || echo "disabled" ) \ - $( [ "$(ubus call service list "{ 'verbose': true, 'name': '$(basename $F)' }" \ - | jsonfilter -q -e "@['$(basename $F)'].instances[*].running" | uniq)" = "true" ] \ - && echo "running" || echo "stopped" ) - done; - return 1 - fi -} - [ -n "$KSH_VERSION" -o \! -s "$HOME/.shinit" ] || . "$HOME/.shinit" [ -z "$KSH_VERSION" -o \! -s "$HOME/.mkshrc" ] || . "$HOME/.mkshrc" diff --git a/package/system/procd/Makefile b/package/system/procd/Makefile index 5c6a9e8be6..2fc264c366 100644 --- a/package/system/procd/Makefile +++ b/package/system/procd/Makefile @@ -138,6 +138,7 @@ define Package/procd/install $(INSTALL_BIN) ./files/reload_config $(1)/sbin/ $(INSTALL_CONF) ./files/hotplug*.json $(1)/etc/ $(INSTALL_DATA) ./files/procd.sh $(1)/lib/functions/ + $(INSTALL_BIN) ./files/service $(1)/sbin/service endef Package/procd-selinux/install = $(Package/procd/install) diff --git a/package/system/procd/files/service b/package/system/procd/files/service new file mode 100644 index 0000000000..1ceacfe5ad --- /dev/null +++ b/package/system/procd/files/service @@ -0,0 +1,30 @@ +#!/bin/sh + +main() { + local service="$1" + local cmd="$2" + + local boot status + + if [ -f "/etc/init.d/${service}" ]; then + /etc/init.d/"${service}" "${cmd}" + exit "$?" + fi + + if [ -n "$service" ]; then + echo "Service \"$1\" not found:" + exit 1 + fi + + echo "Usage: $(basename "$0") [command]" + for service in /etc/init.d/* ; do + boot="$($service enabled && echo "enabled" || echo "disabled" )" + status="$( [ "$(ubus call service list "{ 'verbose': true, 'name': '$(basename "$service")' }" \ + | jsonfilter -q -e "@['$(basename "$service")'].instances[*].running" | uniq)" = "true" ] \ + && echo "running" || echo "stopped" )" + + printf "%-30s\\t%10s\\t%10s\\n" "$service" "$boot" "$status" + done +} + +main "$@" From cfd093809f78164ed356323e794e6e029697447c Mon Sep 17 00:00:00 2001 From: Florian Eckert Date: Wed, 22 Dec 2021 08:59:43 +0100 Subject: [PATCH 13/20] base-files: add wrapper for procd service list command A service managed by procd does have a json object with usefull information. This information could by dumped with the following command. ubus call service list "{ 'verbose':true, 'name': ')'". }" This line is long and complicated to enter. This commit adds a wrapper call to the procd service section tool to simplify the input and get the output faster. We could now enter the command /etc/initd/ info to get the info faster. Signed-off-by: Florian Eckert (cherry picked from commit 09c41ea6792a86cfcacb13f6727f5049c3f87cd6) --- package/base-files/files/etc/rc.common | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/package/base-files/files/etc/rc.common b/package/base-files/files/etc/rc.common index 5dcbf5138d..4c67b0b985 100755 --- a/package/base-files/files/etc/rc.common +++ b/package/base-files/files/etc/rc.common @@ -126,6 +126,7 @@ extra_command "enabled" "Check if service is started on boot" extra_command "running" "Check if service is running" extra_command "status" "Service status" extra_command "trace" "Start with syscall trace" + extra_command "info" "Dump procd service info" . $IPKG_INSTROOT/lib/functions/procd.sh basescript=$(readlink "$initscript") @@ -149,6 +150,13 @@ extra_command "enabled" "Check if service is started on boot" start "$@" } + info() { + json_init + json_add_string name "$(basename ${basescript:-$initscript})" + json_add_boolean verbose "1" + _procd_ubus_call list + } + stop() { procd_lock stop_service "$@" From 944917d34e1155146ea087388368a3f66e57de49 Mon Sep 17 00:00:00 2001 From: Josef Schlehofer Date: Wed, 16 Mar 2022 13:14:57 +0100 Subject: [PATCH 14/20] cypress-firmware: update it to version 5.4.18-2021_0812 - Binary files were renamed to cyfmac from brcmfmac, but the files needs to be on the router with the previous naming [ 6.656165] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac43455-sdio for chip BCM4345/6 [ 6.665182] brcmfmac mmc1:0001:1: Direct firmware load for brcm/brcmfmac43455-sdio.bin failed with error -2 [ 6.674928] brcmfmac mmc1:0001:1: Falling back to sysfs fallback for: brcm/brcmfmac43455-sdio.bin - Cypress were acquired by Infineon Technologies Thus change the project URL and switch to download files from their GitHub repository. This is much better than the previous solution, which requires finding new threads on their community forum about new driver updates, and it will be necessary to change the URL each time. Unfortunately, it seems that there is not published changelog, but according to this forum thread [1], be careful by opening the link from solution since it contains ending bracket ), it brings fixes for various security vulnerabilities, which were fixed in 7_45_234. Fixes: - FragAttacks - Kr00k Also add LICENSE file Run tested on Seeedstudio router powered by Raspberry Pi 4 CM with package cypress-firmware-43455-sdio. Before: root@OpenWrt:~# dmesg | grep 'Firmware: BCM4345/6' [ 6.895050] brcmfmac: brcmf_c_preinit_dcmds: Firmware: BCM4345/6 wl0: Mar 23 2020 02:20:01 version 7.45.206 (r725000 CY) FWID 01-febaba43 After: root@OpenWrt:~# dmesg | grep 'Firmware: BCM4345/6' [ 6.829805] brcmfmac: brcmf_c_preinit_dcmds: Firmware: BCM4345/6 wl0: Apr 15 2021 03:03:20 version 7.45.234 (4ca95bb CY) FWID 01-996384e2 [1] https://community.infineon.com/t5/Wi-Fi-Bluetooth-for-Linux/Outdated-brcmfmac-firmware-for-Raspberry-Pi-4-in-OpenWrt-21-02-1/m-p/331593#M2269 Signed-off-by: Josef Schlehofer (cherry picked from commit 7ca7e0b22de6e629f5df12b8a935a168073bcca3) --- package/firmware/cypress-firmware/Makefile | 68 +++++++++++++++++++--- 1 file changed, 60 insertions(+), 8 deletions(-) diff --git a/package/firmware/cypress-firmware/Makefile b/package/firmware/cypress-firmware/Makefile index 31887280c3..4fef8522cd 100644 --- a/package/firmware/cypress-firmware/Makefile +++ b/package/firmware/cypress-firmware/Makefile @@ -7,25 +7,24 @@ include $(TOPDIR)/rules.mk -UNPACK_CMD=unzip -q -p $(DL_DIR)/$(PKG_SOURCE) $(PKG_SOURCE_UNZIP) | gzip -dc | $(HOST_TAR) -C $(1) $(TAR_OPTIONS) - PKG_NAME:=cypress-firmware -PKG_VERSION:=v5.4.18-2021_0527 +PKG_VERSION:=5.4.18-2021_0812 PKG_RELEASE:=1 -PKG_SOURCE_UNZIP:=cypress-firmware-$(PKG_VERSION).tar.gz -PKG_SOURCE:=cypress-fmac-$(PKG_VERSION).zip -PKG_SOURCE_URL:=https://community.cypress.com/gfawx74859/attachments/gfawx74859/WiFiBluetoothLinux/1911/2/ -PKG_HASH:=6dd1fe42791cb56fa4162d0a384cdca4052a428a259200afdc1eb2caa53543aa +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=https://github.com/Infineon/ifx-linux-firmware/ +PKG_MIRROR_HASH:=ac882b482dd401b53cdecc6004cd2bd3d65e888c19206dcf10931a28033ada4d +PKG_SOURCE_VERSION:=release-v$(PKG_VERSION) PKG_MAINTAINER:=Álvaro Fernández Rojas +PKG_LICENSE_FILES:=LICENCE include $(INCLUDE_DIR)/package.mk define Package/cypress-firmware-default SECTION:=firmware CATEGORY:=Firmware - URL:=https://community.cypress.com/community/linux + URL:=https://community.infineon.com/ endef define Build/Compile @@ -209,6 +208,42 @@ endef $(eval $(call BuildPackage,cypress-firmware-43570-pcie)) +# Cypress 4359 PCIe Firmware +define Package/cypress-firmware-4359-pcie + $(Package/cypress-firmware-default) + TITLE:=CYW4359 FullMac PCIe firmware +endef + +define Package/cypress-firmware-4359-pcie/install + $(INSTALL_DIR) $(1)/lib/firmware/brcm + $(INSTALL_DATA) \ + $(PKG_BUILD_DIR)/firmware/cyfmac4359-pcie.bin \ + $(1)/lib/firmware/brcm/brcmfmac4359-pcie.bin + $(INSTALL_DATA) \ + $(PKG_BUILD_DIR)/firmware/cyfmac4359-pcie.clm_blob \ + $(1)/lib/firmware/brcm/brcmfmac4359-pcie.clm_blob +endef + +$(eval $(call BuildPackage,cypress-firmware-4359-pcie)) + +# Cypress 4359 SDIO Firmware +define Package/cypress-firmware-4359-sdio + $(Package/cypress-firmware-default) + TITLE:=CYW4359 FullMac SDIO firmware +endef + +define Package/cypress-firmware-4359-sdio/install + $(INSTALL_DIR) $(1)/lib/firmware/brcm + $(INSTALL_DATA) \ + $(PKG_BUILD_DIR)/firmware/cyfmac4359-sdio.bin \ + $(1)/lib/firmware/brcm/brcmfmac4359-sdio.bin + $(INSTALL_DATA) \ + $(PKG_BUILD_DIR)/firmware/cyfmac4359-sdio.clm_blob \ + $(1)/lib/firmware/brcm/brcmfmac4359-sdio.clm_blob +endef + +$(eval $(call BuildPackage,cypress-firmware-4359-sdio)) + # Cypress 4373 SDIO Firmware define Package/cypress-firmware-4373-sdio $(Package/cypress-firmware-default) @@ -263,3 +298,20 @@ endef $(eval $(call BuildPackage,cypress-firmware-54591-pcie)) +# Cypress 89459 PCIe Firmware +define Package/cypress-firmware-89459-pcie + $(Package/cypress-firmware-default) + TITLE:=CYW89459 FullMac PCIe firmware +endef + +define Package/cypress-firmware-89459-pcie/install + $(INSTALL_DIR) $(1)/lib/firmware/brcm + $(INSTALL_DATA) \ + $(PKG_BUILD_DIR)/firmware/cyfmac89459-pcie.bin \ + $(1)/lib/firmware/brcm/brcmfmac89459-pcie.bin + $(INSTALL_DATA) \ + $(PKG_BUILD_DIR)/firmware/cyfmac89459-pcie.clm_blob \ + $(1)/lib/firmware/brcm/brcmfmac89459-pcie.clm_blob +endef + +$(eval $(call BuildPackage,cypress-firmware-89459-pcie)) From 771deecb70137d1742fa3ae7258f8ef165ac26e1 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Fri, 26 Mar 2021 03:09:34 -0700 Subject: [PATCH 15/20] quilt.mk: fix typo in the Host section HOST_PATCH_DIR is used for host patches, not PATCH_DIR. Fixes refreshing patches with a custom HOST_PATCH_DIR. Signed-off-by: Rosen Penev (cherry picked from commit 9586a270a06aa8305f066a07ca35ca4883035eed) --- include/quilt.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/quilt.mk b/include/quilt.mk index 6d25469daf..18cafe60a2 100644 --- a/include/quilt.mk +++ b/include/quilt.mk @@ -116,7 +116,7 @@ define Quilt/RefreshDir endef define Quilt/Refresh/Host - $(call Quilt/RefreshDir,$(HOST_BUILD_DIR),$(PATCH_DIR)) + $(call Quilt/RefreshDir,$(HOST_BUILD_DIR),$(HOST_PATCH_DIR)) endef define Quilt/Refresh/Package From fb77c8a51af310855c5e91d976263881efbca8a2 Mon Sep 17 00:00:00 2001 From: Tianling Shen Date: Tue, 22 Mar 2022 01:26:41 +0800 Subject: [PATCH 16/20] autocore: add ethtool back for x86 Signed-off-by: Tianling Shen --- package/emortal/autocore/Makefile | 2 +- package/emortal/autocore/files/generic/ethinfo | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/package/emortal/autocore/Makefile b/package/emortal/autocore/Makefile index 552b50196e..1ec08a91f8 100644 --- a/package/emortal/autocore/Makefile +++ b/package/emortal/autocore/Makefile @@ -27,7 +27,7 @@ endef define Package/autocore-x86 TITLE:=x86/x64 auto core loadbalance script MAINTAINER:=Lean - DEPENDS:=@TARGET_x86 +lm-sensors + DEPENDS:=@TARGET_x86 +lm-sensors +ethtool VARIANT:=x86 endef diff --git a/package/emortal/autocore/files/generic/ethinfo b/package/emortal/autocore/files/generic/ethinfo index db457e80bf..336676349c 100755 --- a/package/emortal/autocore/files/generic/ethinfo +++ b/package/emortal/autocore/files/generic/ethinfo @@ -4,11 +4,10 @@ local util = require "luci.util" local jsonc = require "luci.jsonc" - local eth_info = {} local ifname, stat for ifname, stat in pairs(util.ubus("network.device", "status")) do - if ifname:match("^(eth[0-9]+)$") == ifname then + if ifname:match("^(eth%d+)$") == ifname then local status, speed, duplex status = stat.carrier and 1 or 0 @@ -32,8 +31,7 @@ end table.sort(eth_info, function(a, b) - return tonumber(a.name:match("eth([0-9]+)$")) < - tonumber(b.name:match("eth([0-9]+)$")) + return a.name < b.name end) print(jsonc.stringify(eth_info)) From 6a6ab02e6b4fe590e30ca6e677cac56d6e4da68a Mon Sep 17 00:00:00 2001 From: Huangbin Zhan Date: Mon, 15 Nov 2021 22:03:45 +0800 Subject: [PATCH 17/20] ncurses: update to 6.3 release notes: https://invisible-island.net/ncurses/announce-6.3.html Signed-off-by: Huangbin Zhan --- package/libs/ncurses/Makefile | 6 ++-- .../100-ncurses-5.6-20080112-urxvt.patch | 2 +- .../101-ncurses-5.6-20080628-kbs.patch | 28 ++++++++-------- .../patches/102-ncurses-5.9-gcc-5.patch | 4 +-- .../patches/103-ncurses-ar-determinism.patch | 32 +++++++++---------- .../libs/ncurses/patches/900-terminfo.patch | 2 +- 6 files changed, 37 insertions(+), 37 deletions(-) diff --git a/package/libs/ncurses/Makefile b/package/libs/ncurses/Makefile index a6bc135b2d..b21dd2b0ab 100644 --- a/package/libs/ncurses/Makefile +++ b/package/libs/ncurses/Makefile @@ -8,12 +8,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=ncurses -PKG_VERSION:=6.2 -PKG_RELEASE:=3 +PKG_VERSION:=6.3 +PKG_RELEASE:=$(AUTORELEASE) PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=@GNU/$(PKG_NAME) -PKG_HASH:=30306e0c76e0f9f1f0de987cf1c82a5c21e1ce6568b9227f7da5b71cbea86c9d +PKG_HASH:=97fc51ac2b085d4cde31ef4d2c3122c21abc217e9090a43a30fc5ec21684e059 PKG_LICENSE:=MIT PKG_LICENSE_FILES:=README diff --git a/package/libs/ncurses/patches/100-ncurses-5.6-20080112-urxvt.patch b/package/libs/ncurses/patches/100-ncurses-5.6-20080112-urxvt.patch index d654eb28f0..2fdbb7b0be 100644 --- a/package/libs/ncurses/patches/100-ncurses-5.6-20080112-urxvt.patch +++ b/package/libs/ncurses/patches/100-ncurses-5.6-20080112-urxvt.patch @@ -1,6 +1,6 @@ --- a/misc/terminfo.src +++ b/misc/terminfo.src -@@ -6145,6 +6145,172 @@ rxvt-cygwin-native|rxvt terminal emulato +@@ -6616,6 +6616,172 @@ rxvt-cygwin-native|rxvt terminal emulato rxvt-16color|rxvt with 16 colors like aixterm, ncv#32, use=ibm+16color, use=rxvt, diff --git a/package/libs/ncurses/patches/101-ncurses-5.6-20080628-kbs.patch b/package/libs/ncurses/patches/101-ncurses-5.6-20080628-kbs.patch index 835c0c53d6..2d299197b0 100644 --- a/package/libs/ncurses/patches/101-ncurses-5.6-20080628-kbs.patch +++ b/package/libs/ncurses/patches/101-ncurses-5.6-20080628-kbs.patch @@ -1,22 +1,22 @@ --- a/misc/terminfo.src +++ b/misc/terminfo.src -@@ -4513,6 +4513,7 @@ xterm-xfree86|xterm terminal emulator (X +@@ -4815,6 +4815,7 @@ xterm+nofkeys|building block for xterm f # This version reflects the current xterm features. xterm-new|modern xterm terminal emulator, npc, + kbs=\177, - kcbt=\E[Z, kent=\EOM, use=ecma+index, use=ansi+rep, - use=ecma+strikeout, use=xterm+keypad, use=vt420+lrmm, - use=xterm+sm+1006, use=xterm+pcfkeys, use=xterm+tmux, -@@ -5943,6 +5944,7 @@ mlterm-256color|mlterm 3.0 with xterm 25 + kcbt=\E[Z, kent=\EOM, nel=\EE, use=ecma+index, + use=ansi+rep, use=ecma+strikeout, use=xterm+pcfkeys, + use=xterm+nofkeys, +@@ -6416,6 +6417,7 @@ mlterm-256color|mlterm 3.0 with xterm 25 rxvt-basic|rxvt terminal base (X Window System), OTbs, am, bce, eo, mir, msgr, xenl, xon, XT, cols#80, it#8, lines#24, + kbs=\177, acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, - bel=^G, blink=\E[5m, bold=\E[1m, civis=\E[?25l, - clear=\E[H\E[2J, cnorm=\E[?25h, cr=\r, -@@ -5953,7 +5955,7 @@ rxvt-basic|rxvt terminal base (X Window + bel=^G, blink=\E[5m, bold=\E[1m, clear=\E[H\E[2J, cr=\r, + csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, +@@ -6425,7 +6427,7 @@ rxvt-basic|rxvt terminal base (X Window enacs=\E(B\E)0, flash=\E[?5h$<100/>\E[?5l, home=\E[H, ht=^I, hts=\EH, ich=\E[%p1%d@, il=\E[%p1%dL, il1=\E[L, ind=\n, is1=\E[?47l\E=\E[?1l, @@ -25,7 +25,7 @@ kcbt=\E[Z, kmous=\E[M, rc=\E8, rev=\E[7m, ri=\EM, rmacs=^O, rmcup=\E[2J\E[?47l\E8, rmir=\E[4l, rmkx=\E>, rmso=\E[27m, rmul=\E[24m, -@@ -7454,6 +7456,7 @@ dumb-emacs-ansi|Emacs dumb terminal with +@@ -8060,6 +8062,7 @@ dumb-emacs-ansi|Emacs dumb terminal with screen|VT 100/ANSI X3.64 virtual terminal, OTbs, OTpt, am, km, mir, msgr, xenl, G0, colors#8, cols#80, it#8, lines#24, ncv@, pairs#64, U8#1, @@ -33,16 +33,16 @@ acsc=++\,\,--..00``aaffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxy yzz{{||}}~~, bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, civis=\E[?25l, -@@ -7465,7 +7468,7 @@ screen|VT 100/ANSI X3.64 virtual termina +@@ -8071,7 +8074,7 @@ screen|VT 100/ANSI X3.64 virtual termina dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, el=\E[K, el1=\E[1K, enacs=\E(B\E)0, flash=\Eg, home=\E[H, hpa=\E[%i%p1%dG, ht=^I, hts=\EH, ich=\E[%p1%d@, il=\E[%p1%dL, il1=\E[L, - ind=\n, indn=\E[%p1%dS, is2=\E)0, kbs=^H, kcbt=\E[Z, + ind=\n, indn=\E[%p1%dS, is2=\E)0, kcbt=\E[Z, - kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, - kdch1=\E[3~, kend=\E[4~, kf1=\EOP, kf10=\E[21~, - kf11=\E[23~, kf12=\E[24~, kf2=\EOQ, kf3=\EOR, kf4=\EOS, -@@ -7594,6 +7597,7 @@ screen.xterm-r6|screen customized for X1 + kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, kf1=\EOP, + kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, kf2=\EOQ, kf3=\EOR, + kf4=\EOS, kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, +@@ -8199,6 +8202,7 @@ screen.xterm-r6|screen customized for X1 # on Solaris because Sun's curses implementation gets confused. screen.teraterm|disable ncv in teraterm, ncv#127, diff --git a/package/libs/ncurses/patches/102-ncurses-5.9-gcc-5.patch b/package/libs/ncurses/patches/102-ncurses-5.9-gcc-5.patch index 972b64977d..a6398acf8e 100644 --- a/package/libs/ncurses/patches/102-ncurses-5.9-gcc-5.patch +++ b/package/libs/ncurses/patches/102-ncurses-5.9-gcc-5.patch @@ -15,7 +15,7 @@ Subject: [PATCH] ncurses 5.9 - patch 20141206 --- a/ncurses/base/MKlib_gen.sh +++ b/ncurses/base/MKlib_gen.sh -@@ -502,11 +502,22 @@ sed -n -f $ED1 \ +@@ -511,11 +511,22 @@ sed -n -f $ED1 \ -e 's/gen_$//' \ -e 's/ / /g' >>$TMP @@ -39,6 +39,6 @@ Subject: [PATCH] ncurses 5.9 - patch 20141206 - -e 's/^ //' \ - -e 's/_Bool/NCURSES_BOOL/g' \ +| sed -f $ED1 \ - | $AWK -f $AW2 \ + | "$AWK" -f $AW2 \ | sed -f $ED3 \ | sed \ diff --git a/package/libs/ncurses/patches/103-ncurses-ar-determinism.patch b/package/libs/ncurses/patches/103-ncurses-ar-determinism.patch index 1bfa93e3aa..5ef8ab7ab0 100644 --- a/package/libs/ncurses/patches/103-ncurses-ar-determinism.patch +++ b/package/libs/ncurses/patches/103-ncurses-ar-determinism.patch @@ -1,22 +1,22 @@ --- a/aclocal.m4 +++ b/aclocal.m4 -@@ -454,7 +454,7 @@ AC_REQUIRE([CF_PROG_AR]) +@@ -505,7 +505,7 @@ AC_CACHE_CHECK(for options to update arc + ;; + (*) + cf_cv_ar_flags=unknown +- for cf_ar_flags in -curvU -curv curv -crv crv -cqv cqv -rv rv ++ for cf_ar_flags in -curvD -curv curv -crv crv -cqv cqv -rv rv + do - AC_CACHE_CHECK(for options to update archives, cf_cv_ar_flags,[ - cf_cv_ar_flags=unknown -- for cf_ar_flags in -curvU -curv curv -crv crv -cqv cqv -rv rv -+ for cf_ar_flags in -curvD -curv curv -crv crv -cqv cqv -rv rv - do - - # check if $ARFLAGS already contains this choice + # check if $ARFLAGS already contains this choice --- a/configure +++ b/configure -@@ -4751,7 +4751,7 @@ if test "${cf_cv_ar_flags+set}" = set; t - else +@@ -5072,7 +5072,7 @@ else + ;; + (*) + cf_cv_ar_flags=unknown +- for cf_ar_flags in -curvU -curv curv -crv crv -cqv cqv -rv rv ++ for cf_ar_flags in -curvD -curv curv -crv crv -cqv cqv -rv rv + do - cf_cv_ar_flags=unknown -- for cf_ar_flags in -curvU -curv curv -crv crv -cqv cqv -rv rv -+ for cf_ar_flags in -curvD -curv curv -crv crv -cqv cqv -rv rv - do - - # check if $ARFLAGS already contains this choice + # check if $ARFLAGS already contains this choice diff --git a/package/libs/ncurses/patches/900-terminfo.patch b/package/libs/ncurses/patches/900-terminfo.patch index 3c37183f28..96d78cde34 100644 --- a/package/libs/ncurses/patches/900-terminfo.patch +++ b/package/libs/ncurses/patches/900-terminfo.patch @@ -1,6 +1,6 @@ --- a/misc/terminfo.src +++ b/misc/terminfo.src -@@ -5802,12 +5802,11 @@ konsole-xf3x|KDE console window with key +@@ -6240,12 +6240,11 @@ konsole-xf3x|KDE console window with key # The value for kbs (see konsole-vt100) reflects local customization rather # than the settings used for XFree86 xterm. konsole-xf4x|KDE console window with keyboard for XFree86 4.x xterm, From 6b358941120abed187b44b05a8c0e0bc9c993253 Mon Sep 17 00:00:00 2001 From: Eneas U de Queiroz Date: Tue, 22 Mar 2022 14:03:30 -0300 Subject: [PATCH 18/20] openssl: move engine.mk to INCLUDE_DIR engine.mk is supposed to be included by engine packages, but it will not be present in the SDK in the same place as in the main repository. Move it to include/openssl-engine.mk to avoid this. Signed-off-by: Eneas U de Queiroz --- package/libs/openssl/engine.mk => include/openssl-engine.mk | 4 ++++ package/libs/openssl/Makefile | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) rename package/libs/openssl/engine.mk => include/openssl-engine.mk (93%) diff --git a/package/libs/openssl/engine.mk b/include/openssl-engine.mk similarity index 93% rename from package/libs/openssl/engine.mk rename to include/openssl-engine.mk index 973a989904..d8baba482e 100644 --- a/package/libs/openssl/engine.mk +++ b/include/openssl-engine.mk @@ -1,3 +1,7 @@ +# SPDX-License-Identifier: GPL-2.0-only +# +# Copyright (C) 2022 Enéas Ulir de Queiroz + ENGINES_DIR=engines-1.1 define Package/openssl/engine/Default diff --git a/package/libs/openssl/Makefile b/package/libs/openssl/Makefile index 4f1dd5931c..a8ec5d015d 100644 --- a/package/libs/openssl/Makefile +++ b/package/libs/openssl/Makefile @@ -11,7 +11,7 @@ PKG_NAME:=openssl PKG_BASE:=1.1.1 PKG_BUGFIX:=n PKG_VERSION:=$(PKG_BASE)$(PKG_BUGFIX) -PKG_RELEASE:=1 +PKG_RELEASE:=$(AUTORELEASE) PKG_USE_MIPS16:=0 PKG_BUILD_PARALLEL:=1 @@ -66,7 +66,7 @@ PKG_CONFIG_DEPENDS:= \ CONFIG_OPENSSL_WITH_WHIRLPOOL include $(INCLUDE_DIR)/package.mk -include engine.mk +include $(INCLUDE_DIR)/openssl-engine.mk ifneq ($(CONFIG_CCACHE),) HOSTCC=$(HOSTCC_NOCACHE) From 3b17680462dc6773899f124acefabfc910c75d9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20=C5=A0tetiar?= Date: Thu, 24 Mar 2022 06:45:04 +0100 Subject: [PATCH 19/20] zlib: backport security fix for a reproducible crash in compressor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Tavis has just reported, that he was recently trying to track down a reproducible crash in a compressor. Believe it or not, it really was a bug in zlib-1.2.11 when compressing (not decompressing!) certain inputs. Tavis has reported it upstream, but it turns out the issue has been public since 2018, but the patch never made it into a release. As far as he knows, nobody ever assigned it a CVE. Suggested-by: Tavis Ormandy References: https://www.openwall.com/lists/oss-security/2022/03/24/1 Signed-off-by: Petr Štetiar --- package/libs/zlib/Makefile | 2 +- ...x-compressor-crash-on-certain-inputs.patch | 343 ++++++++++++++++++ tools/zlib/Makefile | 2 +- ...x-compressor-crash-on-certain-inputs.patch | 343 ++++++++++++++++++ 4 files changed, 688 insertions(+), 2 deletions(-) create mode 100644 package/libs/zlib/patches/006-fix-compressor-crash-on-certain-inputs.patch create mode 100644 tools/zlib/patches/006-fix-compressor-crash-on-certain-inputs.patch diff --git a/package/libs/zlib/Makefile b/package/libs/zlib/Makefile index c7a8415c79..7321ec51c5 100644 --- a/package/libs/zlib/Makefile +++ b/package/libs/zlib/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=zlib PKG_VERSION:=1.2.11 -PKG_RELEASE:=3 +PKG_RELEASE:=4 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@SF/libpng http://www.zlib.net diff --git a/package/libs/zlib/patches/006-fix-compressor-crash-on-certain-inputs.patch b/package/libs/zlib/patches/006-fix-compressor-crash-on-certain-inputs.patch new file mode 100644 index 0000000000..9f37ba5c58 --- /dev/null +++ b/package/libs/zlib/patches/006-fix-compressor-crash-on-certain-inputs.patch @@ -0,0 +1,343 @@ +From 5c44459c3b28a9bd3283aaceab7c615f8020c531 Mon Sep 17 00:00:00 2001 +From: Mark Adler +Date: Tue, 17 Apr 2018 22:09:22 -0700 +Subject: [PATCH] Fix a bug that can crash deflate on some input when using + Z_FIXED. + +This bug was reported by Danilo Ramos of Eideticom, Inc. It has +lain in wait 13 years before being found! The bug was introduced +in zlib 1.2.2.2, with the addition of the Z_FIXED option. That +option forces the use of fixed Huffman codes. For rare inputs with +a large number of distant matches, the pending buffer into which +the compressed data is written can overwrite the distance symbol +table which it overlays. That results in corrupted output due to +invalid distances, and can result in out-of-bound accesses, +crashing the application. + +The fix here combines the distance buffer and literal/length +buffers into a single symbol buffer. Now three bytes of pending +buffer space are opened up for each literal or length/distance +pair consumed, instead of the previous two bytes. This assures +that the pending buffer cannot overwrite the symbol table, since +the maximum fixed code compressed length/distance is 31 bits, and +since there are four bytes of pending space for every three bytes +of symbol space. +--- + deflate.c | 74 ++++++++++++++++++++++++++++++++++++++++--------------- + deflate.h | 25 +++++++++---------- + trees.c | 50 +++++++++++-------------------------- + 3 files changed, 79 insertions(+), 70 deletions(-) + +diff --git a/deflate.c b/deflate.c +index 425babc00..19cba873a 100644 +--- a/deflate.c ++++ b/deflate.c +@@ -255,11 +255,6 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy, + int wrap = 1; + static const char my_version[] = ZLIB_VERSION; + +- ushf *overlay; +- /* We overlay pending_buf and d_buf+l_buf. This works since the average +- * output size for (length,distance) codes is <= 24 bits. +- */ +- + if (version == Z_NULL || version[0] != my_version[0] || + stream_size != sizeof(z_stream)) { + return Z_VERSION_ERROR; +@@ -329,9 +324,47 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy, + + s->lit_bufsize = 1 << (memLevel + 6); /* 16K elements by default */ + +- overlay = (ushf *) ZALLOC(strm, s->lit_bufsize, sizeof(ush)+2); +- s->pending_buf = (uchf *) overlay; +- s->pending_buf_size = (ulg)s->lit_bufsize * (sizeof(ush)+2L); ++ /* We overlay pending_buf and sym_buf. This works since the average size ++ * for length/distance pairs over any compressed block is assured to be 31 ++ * bits or less. ++ * ++ * Analysis: The longest fixed codes are a length code of 8 bits plus 5 ++ * extra bits, for lengths 131 to 257. The longest fixed distance codes are ++ * 5 bits plus 13 extra bits, for distances 16385 to 32768. The longest ++ * possible fixed-codes length/distance pair is then 31 bits total. ++ * ++ * sym_buf starts one-fourth of the way into pending_buf. So there are ++ * three bytes in sym_buf for every four bytes in pending_buf. Each symbol ++ * in sym_buf is three bytes -- two for the distance and one for the ++ * literal/length. As each symbol is consumed, the pointer to the next ++ * sym_buf value to read moves forward three bytes. From that symbol, up to ++ * 31 bits are written to pending_buf. The closest the written pending_buf ++ * bits gets to the next sym_buf symbol to read is just before the last ++ * code is written. At that time, 31*(n-2) bits have been written, just ++ * after 24*(n-2) bits have been consumed from sym_buf. sym_buf starts at ++ * 8*n bits into pending_buf. (Note that the symbol buffer fills when n-1 ++ * symbols are written.) The closest the writing gets to what is unread is ++ * then n+14 bits. Here n is lit_bufsize, which is 16384 by default, and ++ * can range from 128 to 32768. ++ * ++ * Therefore, at a minimum, there are 142 bits of space between what is ++ * written and what is read in the overlain buffers, so the symbols cannot ++ * be overwritten by the compressed data. That space is actually 139 bits, ++ * due to the three-bit fixed-code block header. ++ * ++ * That covers the case where either Z_FIXED is specified, forcing fixed ++ * codes, or when the use of fixed codes is chosen, because that choice ++ * results in a smaller compressed block than dynamic codes. That latter ++ * condition then assures that the above analysis also covers all dynamic ++ * blocks. A dynamic-code block will only be chosen to be emitted if it has ++ * fewer bits than a fixed-code block would for the same set of symbols. ++ * Therefore its average symbol length is assured to be less than 31. So ++ * the compressed data for a dynamic block also cannot overwrite the ++ * symbols from which it is being constructed. ++ */ ++ ++ s->pending_buf = (uchf *) ZALLOC(strm, s->lit_bufsize, 4); ++ s->pending_buf_size = (ulg)s->lit_bufsize * 4; + + if (s->window == Z_NULL || s->prev == Z_NULL || s->head == Z_NULL || + s->pending_buf == Z_NULL) { +@@ -340,8 +373,12 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy, + deflateEnd (strm); + return Z_MEM_ERROR; + } +- s->d_buf = overlay + s->lit_bufsize/sizeof(ush); +- s->l_buf = s->pending_buf + (1+sizeof(ush))*s->lit_bufsize; ++ s->sym_buf = s->pending_buf + s->lit_bufsize; ++ s->sym_end = (s->lit_bufsize - 1) * 3; ++ /* We avoid equality with lit_bufsize*3 because of wraparound at 64K ++ * on 16 bit machines and because stored blocks are restricted to ++ * 64K-1 bytes. ++ */ + + s->level = level; + s->strategy = strategy; +@@ -552,7 +589,7 @@ int ZEXPORT deflatePrime (strm, bits, value) + + if (deflateStateCheck(strm)) return Z_STREAM_ERROR; + s = strm->state; +- if ((Bytef *)(s->d_buf) < s->pending_out + ((Buf_size + 7) >> 3)) ++ if (s->sym_buf < s->pending_out + ((Buf_size + 7) >> 3)) + return Z_BUF_ERROR; + do { + put = Buf_size - s->bi_valid; +@@ -1113,7 +1150,6 @@ int ZEXPORT deflateCopy (dest, source) + #else + deflate_state *ds; + deflate_state *ss; +- ushf *overlay; + + + if (deflateStateCheck(source) || dest == Z_NULL) { +@@ -1133,8 +1169,7 @@ int ZEXPORT deflateCopy (dest, source) + ds->window = (Bytef *) ZALLOC(dest, ds->w_size, 2*sizeof(Byte)); + ds->prev = (Posf *) ZALLOC(dest, ds->w_size, sizeof(Pos)); + ds->head = (Posf *) ZALLOC(dest, ds->hash_size, sizeof(Pos)); +- overlay = (ushf *) ZALLOC(dest, ds->lit_bufsize, sizeof(ush)+2); +- ds->pending_buf = (uchf *) overlay; ++ ds->pending_buf = (uchf *) ZALLOC(dest, ds->lit_bufsize, 4); + + if (ds->window == Z_NULL || ds->prev == Z_NULL || ds->head == Z_NULL || + ds->pending_buf == Z_NULL) { +@@ -1148,8 +1183,7 @@ int ZEXPORT deflateCopy (dest, source) + zmemcpy(ds->pending_buf, ss->pending_buf, (uInt)ds->pending_buf_size); + + ds->pending_out = ds->pending_buf + (ss->pending_out - ss->pending_buf); +- ds->d_buf = overlay + ds->lit_bufsize/sizeof(ush); +- ds->l_buf = ds->pending_buf + (1+sizeof(ush))*ds->lit_bufsize; ++ ds->sym_buf = ds->pending_buf + ds->lit_bufsize; + + ds->l_desc.dyn_tree = ds->dyn_ltree; + ds->d_desc.dyn_tree = ds->dyn_dtree; +@@ -1925,7 +1959,7 @@ local block_state deflate_fast(s, flush) + FLUSH_BLOCK(s, 1); + return finish_done; + } +- if (s->last_lit) ++ if (s->sym_next) + FLUSH_BLOCK(s, 0); + return block_done; + } +@@ -2056,7 +2090,7 @@ local block_state deflate_slow(s, flush) + FLUSH_BLOCK(s, 1); + return finish_done; + } +- if (s->last_lit) ++ if (s->sym_next) + FLUSH_BLOCK(s, 0); + return block_done; + } +@@ -2131,7 +2165,7 @@ local block_state deflate_rle(s, flush) + FLUSH_BLOCK(s, 1); + return finish_done; + } +- if (s->last_lit) ++ if (s->sym_next) + FLUSH_BLOCK(s, 0); + return block_done; + } +@@ -2170,7 +2204,7 @@ local block_state deflate_huff(s, flush) + FLUSH_BLOCK(s, 1); + return finish_done; + } +- if (s->last_lit) ++ if (s->sym_next) + FLUSH_BLOCK(s, 0); + return block_done; + } +diff --git a/deflate.h b/deflate.h +index 23ecdd312..d4cf1a98b 100644 +--- a/deflate.h ++++ b/deflate.h +@@ -217,7 +217,7 @@ typedef struct internal_state { + /* Depth of each subtree used as tie breaker for trees of equal frequency + */ + +- uchf *l_buf; /* buffer for literals or lengths */ ++ uchf *sym_buf; /* buffer for distances and literals/lengths */ + + uInt lit_bufsize; + /* Size of match buffer for literals/lengths. There are 4 reasons for +@@ -239,13 +239,8 @@ typedef struct internal_state { + * - I can't count above 4 + */ + +- uInt last_lit; /* running index in l_buf */ +- +- ushf *d_buf; +- /* Buffer for distances. To simplify the code, d_buf and l_buf have +- * the same number of elements. To use different lengths, an extra flag +- * array would be necessary. +- */ ++ uInt sym_next; /* running index in sym_buf */ ++ uInt sym_end; /* symbol table full when sym_next reaches this */ + + ulg opt_len; /* bit length of current block with optimal trees */ + ulg static_len; /* bit length of current block with static trees */ +@@ -325,20 +320,22 @@ void ZLIB_INTERNAL _tr_stored_block OF((deflate_state *s, charf *buf, + + # define _tr_tally_lit(s, c, flush) \ + { uch cc = (c); \ +- s->d_buf[s->last_lit] = 0; \ +- s->l_buf[s->last_lit++] = cc; \ ++ s->sym_buf[s->sym_next++] = 0; \ ++ s->sym_buf[s->sym_next++] = 0; \ ++ s->sym_buf[s->sym_next++] = cc; \ + s->dyn_ltree[cc].Freq++; \ +- flush = (s->last_lit == s->lit_bufsize-1); \ ++ flush = (s->sym_next == s->sym_end); \ + } + # define _tr_tally_dist(s, distance, length, flush) \ + { uch len = (uch)(length); \ + ush dist = (ush)(distance); \ +- s->d_buf[s->last_lit] = dist; \ +- s->l_buf[s->last_lit++] = len; \ ++ s->sym_buf[s->sym_next++] = dist; \ ++ s->sym_buf[s->sym_next++] = dist >> 8; \ ++ s->sym_buf[s->sym_next++] = len; \ + dist--; \ + s->dyn_ltree[_length_code[len]+LITERALS+1].Freq++; \ + s->dyn_dtree[d_code(dist)].Freq++; \ +- flush = (s->last_lit == s->lit_bufsize-1); \ ++ flush = (s->sym_next == s->sym_end); \ + } + #else + # define _tr_tally_lit(s, c, flush) flush = _tr_tally(s, 0, c) +diff --git a/trees.c b/trees.c +index 4f4a65011..decaeb7c3 100644 +--- a/trees.c ++++ b/trees.c +@@ -416,7 +416,7 @@ local void init_block(s) + + s->dyn_ltree[END_BLOCK].Freq = 1; + s->opt_len = s->static_len = 0L; +- s->last_lit = s->matches = 0; ++ s->sym_next = s->matches = 0; + } + + #define SMALLEST 1 +@@ -948,7 +948,7 @@ void ZLIB_INTERNAL _tr_flush_block(s, buf, stored_len, last) + + Tracev((stderr, "\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u ", + opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len, +- s->last_lit)); ++ s->sym_next / 3)); + + if (static_lenb <= opt_lenb) opt_lenb = static_lenb; + +@@ -1017,8 +1017,9 @@ int ZLIB_INTERNAL _tr_tally (s, dist, lc) + unsigned dist; /* distance of matched string */ + unsigned lc; /* match length-MIN_MATCH or unmatched char (if dist==0) */ + { +- s->d_buf[s->last_lit] = (ush)dist; +- s->l_buf[s->last_lit++] = (uch)lc; ++ s->sym_buf[s->sym_next++] = dist; ++ s->sym_buf[s->sym_next++] = dist >> 8; ++ s->sym_buf[s->sym_next++] = lc; + if (dist == 0) { + /* lc is the unmatched char */ + s->dyn_ltree[lc].Freq++; +@@ -1033,30 +1034,7 @@ int ZLIB_INTERNAL _tr_tally (s, dist, lc) + s->dyn_ltree[_length_code[lc]+LITERALS+1].Freq++; + s->dyn_dtree[d_code(dist)].Freq++; + } +- +-#ifdef TRUNCATE_BLOCK +- /* Try to guess if it is profitable to stop the current block here */ +- if ((s->last_lit & 0x1fff) == 0 && s->level > 2) { +- /* Compute an upper bound for the compressed length */ +- ulg out_length = (ulg)s->last_lit*8L; +- ulg in_length = (ulg)((long)s->strstart - s->block_start); +- int dcode; +- for (dcode = 0; dcode < D_CODES; dcode++) { +- out_length += (ulg)s->dyn_dtree[dcode].Freq * +- (5L+extra_dbits[dcode]); +- } +- out_length >>= 3; +- Tracev((stderr,"\nlast_lit %u, in %ld, out ~%ld(%ld%%) ", +- s->last_lit, in_length, out_length, +- 100L - out_length*100L/in_length)); +- if (s->matches < s->last_lit/2 && out_length < in_length/2) return 1; +- } +-#endif +- return (s->last_lit == s->lit_bufsize-1); +- /* We avoid equality with lit_bufsize because of wraparound at 64K +- * on 16 bit machines and because stored blocks are restricted to +- * 64K-1 bytes. +- */ ++ return (s->sym_next == s->sym_end); + } + + /* =========================================================================== +@@ -1069,13 +1047,14 @@ local void compress_block(s, ltree, dtree) + { + unsigned dist; /* distance of matched string */ + int lc; /* match length or unmatched char (if dist == 0) */ +- unsigned lx = 0; /* running index in l_buf */ ++ unsigned sx = 0; /* running index in sym_buf */ + unsigned code; /* the code to send */ + int extra; /* number of extra bits to send */ + +- if (s->last_lit != 0) do { +- dist = s->d_buf[lx]; +- lc = s->l_buf[lx++]; ++ if (s->sym_next != 0) do { ++ dist = s->sym_buf[sx++] & 0xff; ++ dist += (unsigned)(s->sym_buf[sx++] & 0xff) << 8; ++ lc = s->sym_buf[sx++]; + if (dist == 0) { + send_code(s, lc, ltree); /* send a literal byte */ + Tracecv(isgraph(lc), (stderr," '%c' ", lc)); +@@ -1100,11 +1079,10 @@ local void compress_block(s, ltree, dtree) + } + } /* literal or match pair ? */ + +- /* Check that the overlay between pending_buf and d_buf+l_buf is ok: */ +- Assert((uInt)(s->pending) < s->lit_bufsize + 2*lx, +- "pendingBuf overflow"); ++ /* Check that the overlay between pending_buf and sym_buf is ok: */ ++ Assert(s->pending < s->lit_bufsize + sx, "pendingBuf overflow"); + +- } while (lx < s->last_lit); ++ } while (sx < s->sym_next); + + send_code(s, END_BLOCK, ltree); + } diff --git a/tools/zlib/Makefile b/tools/zlib/Makefile index 279851f758..c83cc6d55b 100644 --- a/tools/zlib/Makefile +++ b/tools/zlib/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=zlib PKG_VERSION:=1.2.11 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@SF/libpng http://www.zlib.net diff --git a/tools/zlib/patches/006-fix-compressor-crash-on-certain-inputs.patch b/tools/zlib/patches/006-fix-compressor-crash-on-certain-inputs.patch new file mode 100644 index 0000000000..9f37ba5c58 --- /dev/null +++ b/tools/zlib/patches/006-fix-compressor-crash-on-certain-inputs.patch @@ -0,0 +1,343 @@ +From 5c44459c3b28a9bd3283aaceab7c615f8020c531 Mon Sep 17 00:00:00 2001 +From: Mark Adler +Date: Tue, 17 Apr 2018 22:09:22 -0700 +Subject: [PATCH] Fix a bug that can crash deflate on some input when using + Z_FIXED. + +This bug was reported by Danilo Ramos of Eideticom, Inc. It has +lain in wait 13 years before being found! The bug was introduced +in zlib 1.2.2.2, with the addition of the Z_FIXED option. That +option forces the use of fixed Huffman codes. For rare inputs with +a large number of distant matches, the pending buffer into which +the compressed data is written can overwrite the distance symbol +table which it overlays. That results in corrupted output due to +invalid distances, and can result in out-of-bound accesses, +crashing the application. + +The fix here combines the distance buffer and literal/length +buffers into a single symbol buffer. Now three bytes of pending +buffer space are opened up for each literal or length/distance +pair consumed, instead of the previous two bytes. This assures +that the pending buffer cannot overwrite the symbol table, since +the maximum fixed code compressed length/distance is 31 bits, and +since there are four bytes of pending space for every three bytes +of symbol space. +--- + deflate.c | 74 ++++++++++++++++++++++++++++++++++++++++--------------- + deflate.h | 25 +++++++++---------- + trees.c | 50 +++++++++++-------------------------- + 3 files changed, 79 insertions(+), 70 deletions(-) + +diff --git a/deflate.c b/deflate.c +index 425babc00..19cba873a 100644 +--- a/deflate.c ++++ b/deflate.c +@@ -255,11 +255,6 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy, + int wrap = 1; + static const char my_version[] = ZLIB_VERSION; + +- ushf *overlay; +- /* We overlay pending_buf and d_buf+l_buf. This works since the average +- * output size for (length,distance) codes is <= 24 bits. +- */ +- + if (version == Z_NULL || version[0] != my_version[0] || + stream_size != sizeof(z_stream)) { + return Z_VERSION_ERROR; +@@ -329,9 +324,47 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy, + + s->lit_bufsize = 1 << (memLevel + 6); /* 16K elements by default */ + +- overlay = (ushf *) ZALLOC(strm, s->lit_bufsize, sizeof(ush)+2); +- s->pending_buf = (uchf *) overlay; +- s->pending_buf_size = (ulg)s->lit_bufsize * (sizeof(ush)+2L); ++ /* We overlay pending_buf and sym_buf. This works since the average size ++ * for length/distance pairs over any compressed block is assured to be 31 ++ * bits or less. ++ * ++ * Analysis: The longest fixed codes are a length code of 8 bits plus 5 ++ * extra bits, for lengths 131 to 257. The longest fixed distance codes are ++ * 5 bits plus 13 extra bits, for distances 16385 to 32768. The longest ++ * possible fixed-codes length/distance pair is then 31 bits total. ++ * ++ * sym_buf starts one-fourth of the way into pending_buf. So there are ++ * three bytes in sym_buf for every four bytes in pending_buf. Each symbol ++ * in sym_buf is three bytes -- two for the distance and one for the ++ * literal/length. As each symbol is consumed, the pointer to the next ++ * sym_buf value to read moves forward three bytes. From that symbol, up to ++ * 31 bits are written to pending_buf. The closest the written pending_buf ++ * bits gets to the next sym_buf symbol to read is just before the last ++ * code is written. At that time, 31*(n-2) bits have been written, just ++ * after 24*(n-2) bits have been consumed from sym_buf. sym_buf starts at ++ * 8*n bits into pending_buf. (Note that the symbol buffer fills when n-1 ++ * symbols are written.) The closest the writing gets to what is unread is ++ * then n+14 bits. Here n is lit_bufsize, which is 16384 by default, and ++ * can range from 128 to 32768. ++ * ++ * Therefore, at a minimum, there are 142 bits of space between what is ++ * written and what is read in the overlain buffers, so the symbols cannot ++ * be overwritten by the compressed data. That space is actually 139 bits, ++ * due to the three-bit fixed-code block header. ++ * ++ * That covers the case where either Z_FIXED is specified, forcing fixed ++ * codes, or when the use of fixed codes is chosen, because that choice ++ * results in a smaller compressed block than dynamic codes. That latter ++ * condition then assures that the above analysis also covers all dynamic ++ * blocks. A dynamic-code block will only be chosen to be emitted if it has ++ * fewer bits than a fixed-code block would for the same set of symbols. ++ * Therefore its average symbol length is assured to be less than 31. So ++ * the compressed data for a dynamic block also cannot overwrite the ++ * symbols from which it is being constructed. ++ */ ++ ++ s->pending_buf = (uchf *) ZALLOC(strm, s->lit_bufsize, 4); ++ s->pending_buf_size = (ulg)s->lit_bufsize * 4; + + if (s->window == Z_NULL || s->prev == Z_NULL || s->head == Z_NULL || + s->pending_buf == Z_NULL) { +@@ -340,8 +373,12 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy, + deflateEnd (strm); + return Z_MEM_ERROR; + } +- s->d_buf = overlay + s->lit_bufsize/sizeof(ush); +- s->l_buf = s->pending_buf + (1+sizeof(ush))*s->lit_bufsize; ++ s->sym_buf = s->pending_buf + s->lit_bufsize; ++ s->sym_end = (s->lit_bufsize - 1) * 3; ++ /* We avoid equality with lit_bufsize*3 because of wraparound at 64K ++ * on 16 bit machines and because stored blocks are restricted to ++ * 64K-1 bytes. ++ */ + + s->level = level; + s->strategy = strategy; +@@ -552,7 +589,7 @@ int ZEXPORT deflatePrime (strm, bits, value) + + if (deflateStateCheck(strm)) return Z_STREAM_ERROR; + s = strm->state; +- if ((Bytef *)(s->d_buf) < s->pending_out + ((Buf_size + 7) >> 3)) ++ if (s->sym_buf < s->pending_out + ((Buf_size + 7) >> 3)) + return Z_BUF_ERROR; + do { + put = Buf_size - s->bi_valid; +@@ -1113,7 +1150,6 @@ int ZEXPORT deflateCopy (dest, source) + #else + deflate_state *ds; + deflate_state *ss; +- ushf *overlay; + + + if (deflateStateCheck(source) || dest == Z_NULL) { +@@ -1133,8 +1169,7 @@ int ZEXPORT deflateCopy (dest, source) + ds->window = (Bytef *) ZALLOC(dest, ds->w_size, 2*sizeof(Byte)); + ds->prev = (Posf *) ZALLOC(dest, ds->w_size, sizeof(Pos)); + ds->head = (Posf *) ZALLOC(dest, ds->hash_size, sizeof(Pos)); +- overlay = (ushf *) ZALLOC(dest, ds->lit_bufsize, sizeof(ush)+2); +- ds->pending_buf = (uchf *) overlay; ++ ds->pending_buf = (uchf *) ZALLOC(dest, ds->lit_bufsize, 4); + + if (ds->window == Z_NULL || ds->prev == Z_NULL || ds->head == Z_NULL || + ds->pending_buf == Z_NULL) { +@@ -1148,8 +1183,7 @@ int ZEXPORT deflateCopy (dest, source) + zmemcpy(ds->pending_buf, ss->pending_buf, (uInt)ds->pending_buf_size); + + ds->pending_out = ds->pending_buf + (ss->pending_out - ss->pending_buf); +- ds->d_buf = overlay + ds->lit_bufsize/sizeof(ush); +- ds->l_buf = ds->pending_buf + (1+sizeof(ush))*ds->lit_bufsize; ++ ds->sym_buf = ds->pending_buf + ds->lit_bufsize; + + ds->l_desc.dyn_tree = ds->dyn_ltree; + ds->d_desc.dyn_tree = ds->dyn_dtree; +@@ -1925,7 +1959,7 @@ local block_state deflate_fast(s, flush) + FLUSH_BLOCK(s, 1); + return finish_done; + } +- if (s->last_lit) ++ if (s->sym_next) + FLUSH_BLOCK(s, 0); + return block_done; + } +@@ -2056,7 +2090,7 @@ local block_state deflate_slow(s, flush) + FLUSH_BLOCK(s, 1); + return finish_done; + } +- if (s->last_lit) ++ if (s->sym_next) + FLUSH_BLOCK(s, 0); + return block_done; + } +@@ -2131,7 +2165,7 @@ local block_state deflate_rle(s, flush) + FLUSH_BLOCK(s, 1); + return finish_done; + } +- if (s->last_lit) ++ if (s->sym_next) + FLUSH_BLOCK(s, 0); + return block_done; + } +@@ -2170,7 +2204,7 @@ local block_state deflate_huff(s, flush) + FLUSH_BLOCK(s, 1); + return finish_done; + } +- if (s->last_lit) ++ if (s->sym_next) + FLUSH_BLOCK(s, 0); + return block_done; + } +diff --git a/deflate.h b/deflate.h +index 23ecdd312..d4cf1a98b 100644 +--- a/deflate.h ++++ b/deflate.h +@@ -217,7 +217,7 @@ typedef struct internal_state { + /* Depth of each subtree used as tie breaker for trees of equal frequency + */ + +- uchf *l_buf; /* buffer for literals or lengths */ ++ uchf *sym_buf; /* buffer for distances and literals/lengths */ + + uInt lit_bufsize; + /* Size of match buffer for literals/lengths. There are 4 reasons for +@@ -239,13 +239,8 @@ typedef struct internal_state { + * - I can't count above 4 + */ + +- uInt last_lit; /* running index in l_buf */ +- +- ushf *d_buf; +- /* Buffer for distances. To simplify the code, d_buf and l_buf have +- * the same number of elements. To use different lengths, an extra flag +- * array would be necessary. +- */ ++ uInt sym_next; /* running index in sym_buf */ ++ uInt sym_end; /* symbol table full when sym_next reaches this */ + + ulg opt_len; /* bit length of current block with optimal trees */ + ulg static_len; /* bit length of current block with static trees */ +@@ -325,20 +320,22 @@ void ZLIB_INTERNAL _tr_stored_block OF((deflate_state *s, charf *buf, + + # define _tr_tally_lit(s, c, flush) \ + { uch cc = (c); \ +- s->d_buf[s->last_lit] = 0; \ +- s->l_buf[s->last_lit++] = cc; \ ++ s->sym_buf[s->sym_next++] = 0; \ ++ s->sym_buf[s->sym_next++] = 0; \ ++ s->sym_buf[s->sym_next++] = cc; \ + s->dyn_ltree[cc].Freq++; \ +- flush = (s->last_lit == s->lit_bufsize-1); \ ++ flush = (s->sym_next == s->sym_end); \ + } + # define _tr_tally_dist(s, distance, length, flush) \ + { uch len = (uch)(length); \ + ush dist = (ush)(distance); \ +- s->d_buf[s->last_lit] = dist; \ +- s->l_buf[s->last_lit++] = len; \ ++ s->sym_buf[s->sym_next++] = dist; \ ++ s->sym_buf[s->sym_next++] = dist >> 8; \ ++ s->sym_buf[s->sym_next++] = len; \ + dist--; \ + s->dyn_ltree[_length_code[len]+LITERALS+1].Freq++; \ + s->dyn_dtree[d_code(dist)].Freq++; \ +- flush = (s->last_lit == s->lit_bufsize-1); \ ++ flush = (s->sym_next == s->sym_end); \ + } + #else + # define _tr_tally_lit(s, c, flush) flush = _tr_tally(s, 0, c) +diff --git a/trees.c b/trees.c +index 4f4a65011..decaeb7c3 100644 +--- a/trees.c ++++ b/trees.c +@@ -416,7 +416,7 @@ local void init_block(s) + + s->dyn_ltree[END_BLOCK].Freq = 1; + s->opt_len = s->static_len = 0L; +- s->last_lit = s->matches = 0; ++ s->sym_next = s->matches = 0; + } + + #define SMALLEST 1 +@@ -948,7 +948,7 @@ void ZLIB_INTERNAL _tr_flush_block(s, buf, stored_len, last) + + Tracev((stderr, "\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u ", + opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len, +- s->last_lit)); ++ s->sym_next / 3)); + + if (static_lenb <= opt_lenb) opt_lenb = static_lenb; + +@@ -1017,8 +1017,9 @@ int ZLIB_INTERNAL _tr_tally (s, dist, lc) + unsigned dist; /* distance of matched string */ + unsigned lc; /* match length-MIN_MATCH or unmatched char (if dist==0) */ + { +- s->d_buf[s->last_lit] = (ush)dist; +- s->l_buf[s->last_lit++] = (uch)lc; ++ s->sym_buf[s->sym_next++] = dist; ++ s->sym_buf[s->sym_next++] = dist >> 8; ++ s->sym_buf[s->sym_next++] = lc; + if (dist == 0) { + /* lc is the unmatched char */ + s->dyn_ltree[lc].Freq++; +@@ -1033,30 +1034,7 @@ int ZLIB_INTERNAL _tr_tally (s, dist, lc) + s->dyn_ltree[_length_code[lc]+LITERALS+1].Freq++; + s->dyn_dtree[d_code(dist)].Freq++; + } +- +-#ifdef TRUNCATE_BLOCK +- /* Try to guess if it is profitable to stop the current block here */ +- if ((s->last_lit & 0x1fff) == 0 && s->level > 2) { +- /* Compute an upper bound for the compressed length */ +- ulg out_length = (ulg)s->last_lit*8L; +- ulg in_length = (ulg)((long)s->strstart - s->block_start); +- int dcode; +- for (dcode = 0; dcode < D_CODES; dcode++) { +- out_length += (ulg)s->dyn_dtree[dcode].Freq * +- (5L+extra_dbits[dcode]); +- } +- out_length >>= 3; +- Tracev((stderr,"\nlast_lit %u, in %ld, out ~%ld(%ld%%) ", +- s->last_lit, in_length, out_length, +- 100L - out_length*100L/in_length)); +- if (s->matches < s->last_lit/2 && out_length < in_length/2) return 1; +- } +-#endif +- return (s->last_lit == s->lit_bufsize-1); +- /* We avoid equality with lit_bufsize because of wraparound at 64K +- * on 16 bit machines and because stored blocks are restricted to +- * 64K-1 bytes. +- */ ++ return (s->sym_next == s->sym_end); + } + + /* =========================================================================== +@@ -1069,13 +1047,14 @@ local void compress_block(s, ltree, dtree) + { + unsigned dist; /* distance of matched string */ + int lc; /* match length or unmatched char (if dist == 0) */ +- unsigned lx = 0; /* running index in l_buf */ ++ unsigned sx = 0; /* running index in sym_buf */ + unsigned code; /* the code to send */ + int extra; /* number of extra bits to send */ + +- if (s->last_lit != 0) do { +- dist = s->d_buf[lx]; +- lc = s->l_buf[lx++]; ++ if (s->sym_next != 0) do { ++ dist = s->sym_buf[sx++] & 0xff; ++ dist += (unsigned)(s->sym_buf[sx++] & 0xff) << 8; ++ lc = s->sym_buf[sx++]; + if (dist == 0) { + send_code(s, lc, ltree); /* send a literal byte */ + Tracecv(isgraph(lc), (stderr," '%c' ", lc)); +@@ -1100,11 +1079,10 @@ local void compress_block(s, ltree, dtree) + } + } /* literal or match pair ? */ + +- /* Check that the overlay between pending_buf and d_buf+l_buf is ok: */ +- Assert((uInt)(s->pending) < s->lit_bufsize + 2*lx, +- "pendingBuf overflow"); ++ /* Check that the overlay between pending_buf and sym_buf is ok: */ ++ Assert(s->pending < s->lit_bufsize + sx, "pendingBuf overflow"); + +- } while (lx < s->last_lit); ++ } while (sx < s->sym_next); + + send_code(s, END_BLOCK, ltree); + } From 8c34b3bb70b840d02c8b3f3489d583da72862922 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20=C5=A0tetiar?= Date: Thu, 24 Mar 2022 06:52:37 +0100 Subject: [PATCH 20/20] imagebuilder: fix broken image generation with external targets MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When using external targets there is a symlink being created for the target under target/linux which then becomes dangling under Image Builder. Fix it by dereferencing the possible symlink. Tested on IB with external target, ipq40xx and mvebu. Signed-off-by: Petr Štetiar (cherry picked from commit 621f39d1f438bf95dbae667c575926fa16a6d797) --- target/imagebuilder/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/imagebuilder/Makefile b/target/imagebuilder/Makefile index c5805b08f6..dba651a241 100644 --- a/target/imagebuilder/Makefile +++ b/target/imagebuilder/Makefile @@ -78,7 +78,7 @@ ifneq ($(CONFIG_SIGNATURE_CHECK),) $(CP) -L $(STAGING_DIR_ROOT)/usr/sbin/opkg-key $(PKG_BUILD_DIR)/scripts/ endif - $(CP) $(TOPDIR)/target/linux $(PKG_BUILD_DIR)/target/ + $(CP) -L $(TOPDIR)/target/linux $(PKG_BUILD_DIR)/target/ if [ -d $(TOPDIR)/staging_dir/host/lib/grub ]; then \ $(CP) $(TOPDIR)/staging_dir/host/lib/grub/ $(PKG_BUILD_DIR)/staging_dir/host/lib; \ fi