openwrt/staging/wigyori.git
19 months agoath79: refactor ZTE MF28x dts files
Andreas Böhler [Mon, 10 Apr 2023 21:31:34 +0000 (23:31 +0200)]
ath79: refactor ZTE MF28x dts files

Move common dts entries of ZTE MF281 and ZTE MF286 to a common .dtsi file
to reduce redundancies.

Signed-off-by: Andreas Böhler <dev@aboehler.at>
19 months agoramips: mt7621: rename Asus RT-AC57U to v1
Felix Baumann [Sun, 30 Apr 2023 20:36:09 +0000 (22:36 +0200)]
ramips: mt7621: rename Asus RT-AC57U to v1

rename RT-AC57U to avoid confusion with unsupported revisions 2 and 3

Signed-off-by: Felix Baumann <felix.bau@gmx.de>
19 months agomwlwifi: update to version 10.3.9.1-20230429
Kabuli Chana [Sat, 29 Apr 2023 15:59:53 +0000 (09:59 -0600)]
mwlwifi: update to version 10.3.9.1-20230429

resolve disconnect issue, upstream PR412

Signed-off-by: Kabuli Chana <newtownBuild@gmail.com>
19 months agotools/xz: update to 5.4.3
Nick Hainke [Sat, 6 May 2023 00:45:57 +0000 (02:45 +0200)]
tools/xz: update to 5.4.3

Changelog:
https://git.tukaani.org/?p=xz.git;a=blob;f=NEWS;h=2f4d35adca6198671434d2988803cc9316ad1ec8;hb=c247d06e1f6cada9a76f4f6225cbd97ea760f52f#l5

Signed-off-by: Nick Hainke <vincent@systemli.org>
19 months agomac80211: ath11k: sync with ath-next
Robert Marko [Fri, 5 May 2023 17:30:15 +0000 (19:30 +0200)]
mac80211: ath11k: sync with ath-next

Synchronize the ath11k backports with the current ath-next tree.

This replaces the 160MHz with the upstreamed one, fixes 6GHz only WIPHY
registration, allows SAR usage on WCN6750 and plenty of REO fixes.

Signed-off-by: Robert Marko <robimarko@gmail.com>
19 months agorealtek: adapt patch description to it's current use
Nick Hainke [Thu, 4 May 2023 19:52:28 +0000 (21:52 +0200)]
realtek: adapt patch description to it's current use

The patch is not doing anymore what the descriptions says. Update it.

Signed-off-by: Nick Hainke <vincent@systemli.org>
19 months agogeneric: 5.15: remove outdated symbols
Nick Hainke [Fri, 5 May 2023 12:50:13 +0000 (14:50 +0200)]
generic: 5.15: remove outdated symbols

Remove symbols that are no longer present in 5.15:
- CONFIG_CRYPTO_RMD128
- CONFIG_CRYPTO_RMD256
- CONFIG_CRYPTO_RMD320
- CONFIG_CRYPTO_SALSA20
- CONFIG_CRYPTO_TGR192
- CONFIG_RAW_DRIVER
- CONFIG_ENABLE_MUST_CHECK

Signed-off-by: Nick Hainke <vincent@systemli.org>
19 months agogeneric: 5.15: add patch fixing compiling mvebu with gcc-13
Nick Hainke [Thu, 4 May 2023 07:07:13 +0000 (09:07 +0200)]
generic: 5.15: add patch fixing compiling mvebu with gcc-13

Fixes errors in the form of:
drivers/ata/libahci.c: In function 'ahci_led_store':
././include/linux/compiler_types.h:334:45: error: call to '__compiletime_assert_363' declared with attribute error: BUILD_BUG_ON failed: sizeof(_s) > sizeof(long)
  334 |         _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
      |                                             ^
././include/linux/compiler_types.h:315:25: note: in definition of macro '__compiletime_assert'
  315 |                         prefix ## suffix();                             \
      |                         ^~~~~~
././include/linux/compiler_types.h:334:9: note: in expansion of macro '_compiletime_assert'
  334 |         _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
      |         ^~~~~~~~~~~~~~~~~~~
./include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert'
   39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
      |                                     ^~~~~~~~~~~~~~~~~~
./include/linux/build_bug.h:50:9: note: in expansion of macro 'BUILD_BUG_ON_MSG'
   50 |         BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
      |         ^~~~~~~~~~~~~~~~
./include/linux/nospec.h:62:9: note: in expansion of macro 'BUILD_BUG_ON'
   62 |         BUILD_BUG_ON(sizeof(_s) > sizeof(long));                        \
      |         ^~~~~~~~~~~~
drivers/ata/libahci.c:1143:23: note: in expansion of macro 'array_index_nospec'
 1143 |                 pmp = array_index_nospec(pmp, EM_MAX_SLOTS);
      |                       ^~~~~~~~~~~~~~~~~~

Signed-off-by: Nick Hainke <vincent@systemli.org>
19 months agotoolchain: gcc: backport patch for gcc 13 fixing access path analysis
Nick Hainke [Wed, 3 May 2023 14:46:52 +0000 (16:46 +0200)]
toolchain: gcc: backport patch for gcc 13 fixing access path analysis

While improving access path analysis a typo happened. Now it can happen
that gcc misscompiles. The patch is fixing the issue. However, also
other gcc versions 10.2+ are affected. They also should be bumped or the
fix should be backported.

For more bug information have a look at:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109585

Signed-off-by: Nick Hainke <vincent@systemli.org>
19 months agotoolchain: gcc: add support for GCC 13
Nick Hainke [Thu, 27 Apr 2023 21:03:14 +0000 (23:03 +0200)]
toolchain: gcc: add support for GCC 13

Release Notes:
https://gcc.gnu.org/pipermail/gcc-announce/2023/000175.html

Manually Refreshed:
- 910-mbsd_multi.patch
- 970-macos_arm64-building-fix.patch

Automatically Refreshed:
- 010-documentation.patch
- 230-musl_libssp.patch
- 300-mips_Os_cpu_rtx_cost_model.patch
- 820-libgcc_pic.patch
- 840-armv4_pass_fix-v4bx_to_ld.patch
- 850-use_shared_libgcc.patch
- 870-ppc_no_crtsavres.patch
- 920-specs_nonfatal_getenv.patch

Signed-off-by: Nick Hainke <vincent@systemli.org>
19 months agotoolchain: gcc: copy patches from 12.x to 13.x
Nick Hainke [Thu, 27 Apr 2023 21:00:30 +0000 (23:00 +0200)]
toolchain: gcc: copy patches from 12.x to 13.x

This simplifies the gcc bump patch review.

Signed-off-by: Nick Hainke <vincent@systemli.org>
19 months agolantiq: switch to Kernel 5.15 by default
Paul Spooren [Wed, 22 Feb 2023 18:55:56 +0000 (19:55 +0100)]
lantiq: switch to Kernel 5.15 by default

Getting ready for the next release.

Signed-off-by: Paul Spooren <mail@aparcar.org>
19 months agolantiq: xway: use capital letters in Fritz!Box name
Nick Hainke [Wed, 3 May 2023 18:10:32 +0000 (20:10 +0200)]
lantiq: xway: use capital letters in Fritz!Box name

Rename to Fritz!Box to keep naming uniform.

Fixes: ceac4ae3b403 ("lantiq: xway: add support for AVM FRITZ!Box 7330")
Signed-off-by: Nick Hainke <vincent@systemli.org>
19 months agowireless-regdb: update to 2023.05.03
Yuu Toriyama [Thu, 4 May 2023 10:26:13 +0000 (19:26 +0900)]
wireless-regdb: update to 2023.05.03

Changes:
  43f81b4 wireless-regdb: update regulatory database based on preceding changes
  66f245d wireless-regdb: Update regulatory rules for Hong Kong (HK)
  e78c450 wireless-regdb: update regulatory rules for India (IN)
  1647bb6 wireless-regdb: Update regulatory rules for Russia (RU). Remove DFS requirement.
  c076f21 Update regulatory info for Russia (RU) on 6GHz

Signed-off-by: Yuu Toriyama <PascalCoffeeLake@gmail.com>
19 months agogettext-full: bootstrap to local gnulib source
Michael Pratt [Sun, 16 Apr 2023 22:32:14 +0000 (18:32 -0400)]
gettext-full: bootstrap to local gnulib source

Using the local gnulib source during autogen.sh
allows for fine-grained control over the macros
and source files for use with gettext
but part of gnulib instead of gettext,
without having to wait for a release
or deal with gnulib as a git submodule.

This is an alternative to running autoreconf.

It also removes the need to patch macros
in the case where there is a conflict
between the source and our aclocal directory.

Signed-off-by: Michael Pratt <mcpratt@pm.me>
19 months agotools/coreutils: bootstrap to local gnulib source
Michael Pratt [Thu, 23 Mar 2023 07:49:01 +0000 (03:49 -0400)]
tools/coreutils: bootstrap to local gnulib source

Using the local gnulib source during bootstrap
allows for fine-grained control over the macros
and source files for use with coreutils
but part of gnulib instead of coreutils,
without having to wait for a release
or deal with gnulib as a git submodule.

In this case, the execution of autotools
must be skipped by force.
Autoconf and Automake during bootstrap on coreutils
only works right when using directly checked-out source.

There is a symbol in gnulib, @GNULIB_TIME@
that is not yet defined in coreutils source,
so we use the backup of lib/time.in.h instead
of the one provided by gnulib source.

Signed-off-by: Michael Pratt <mcpratt@pm.me>
19 months agotools/libtool: bootstrap to local gnulib source
Michael Pratt [Thu, 23 Mar 2023 07:53:52 +0000 (03:53 -0400)]
tools/libtool: bootstrap to local gnulib source

Using the local gnulib source during bootstrap
allows for fine-grained control over the macros
and source files for use with libtool
but part of gnulib instead of libtool,
without having to wait for a release
or deal with gnulib as a git submodule.

Signed-off-by: Michael Pratt <mcpratt@pm.me>
19 months agogettext-full: link to local libxml2
Michael Pratt [Sun, 16 Apr 2023 15:04:31 +0000 (11:04 -0400)]
gettext-full: link to local libxml2

Some users have reported that gettext builds
are attempting to link to libxml2
while it was supposed to be configured
to use it's own built-in substitute.

Configure gettext to require and link
to our local libxml2 explicitly.

Add a patch to revert upstream commit 87927a4e2
which forces libtextstyle to use the built-in libxml,
no matter what the configuration is,
making that option configurable again
after the configure script is regenerated.

Reported-by: Tianling Shen <cnsztl@immortalwrt.org>
Signed-off-by: Michael Pratt <mcpratt@pm.me>
19 months agogettext-full: set gperf as build prerequisite
Michael Pratt [Mon, 17 Apr 2023 03:20:57 +0000 (23:20 -0400)]
gettext-full: set gperf as build prerequisite

Require gperf to be built before gettext.

Signed-off-by: Michael Pratt <mcpratt@pm.me>
19 months agolibxml2: add from packages feed
Michael Pratt [Wed, 19 Apr 2023 16:52:04 +0000 (12:52 -0400)]
libxml2: add from packages feed

Add libxml2 which can be used to build gettext
instead of the old built-in substitute for it.

Signed-off-by: Michael Pratt <mcpratt@pm.me>
19 months agogperf: add from packages feed
Michael Pratt [Wed, 19 Apr 2023 08:40:42 +0000 (04:40 -0400)]
gperf: add from packages feed

Add gperf which is required for building gettext
after using the autogen.sh script.

Signed-off-by: Michael Pratt <mcpratt@pm.me>
19 months agogettext-full: override SUBDIRS variable with Makefile
Michael Pratt [Sat, 15 Apr 2023 23:54:43 +0000 (19:54 -0400)]
gettext-full: override SUBDIRS variable with Makefile

Instead of editing the SUBDIRS variable with a patch,
it can be overriden at the end of the command line when invoking Make.

This tool has a series of recursive Makefiles in each subdirectory,
therefore SUBDIRS is set to a pattern of Make functions
so that the result is variable depending on the current subdirectory
that Make is being invoked in.

Some of the subdirectories don't have a Makefile and are just storing files
for another subdirectory Makefile target,
therefore we have to place a fake Makefile that does nothing.

Signed-off-by: Michael Pratt <mcpratt@pm.me>
19 months agotools/gengetopt: override SUBDIRS variable with Makefile
Michael Pratt [Sun, 26 Mar 2023 08:11:13 +0000 (04:11 -0400)]
tools/gengetopt: override SUBDIRS variable with Makefile

Instead of editing the SUBDIRS variable with a patch,
it can be overriden at the end of the command line when invoking Make.

This tool has a series of recursive Makefiles in each subdirectory,
therefore SUBDIRS is set to a pattern of Make functions
so that the result is variable depending on the current subdirectory
that Make is being invoked in.

By eliminating the patch, autoreconf is no longer required.

Signed-off-by: Michael Pratt <mcpratt@pm.me>
19 months agotools/flex: override SUBDIRS variable with Makefile
Michael Pratt [Sat, 25 Mar 2023 05:01:36 +0000 (01:01 -0400)]
tools/flex: override SUBDIRS variable with Makefile

Instead of editing the SUBDIRS variable with a patch,
it can be overriden at the end of the command line when invoking Make.

Skip the build for po files as well, which is causing a conflict
depending on the version of gettext detected, and macros present.

Signed-off-by: Michael Pratt <mcpratt@pm.me>
19 months agotools/automake: move file requirements to higher strictness
Michael Pratt [Wed, 29 Mar 2023 21:00:18 +0000 (17:00 -0400)]
tools/automake: move file requirements to higher strictness

GNU standards requires certain files at the top-level directory
of a package that automake is used with, mostly documentation.

If one of these files happens to be missing, autoreconf would fail.

Move these file requirements to the more strict 'GNITS' setting.

Link: https://www.gnu.org/software/automake/manual/html_node/Strictness.html
Signed-off-by: Michael Pratt <mcpratt@pm.me>
19 months agotools/missing-macros: bump version of makeinfo alternative script
Michael Pratt [Thu, 23 Mar 2023 07:42:04 +0000 (03:42 -0400)]
tools/missing-macros: bump version of makeinfo alternative script

Some new releases of GNU tools are checking for a higher version
of makeinfo than what our scripted alternative shows
when working with checked-out sources instead of releases.

Since this is a "fake" makeinfo we can also just fake the version.

Signed-off-by: Michael Pratt <mcpratt@pm.me>
19 months agotools/missing-macros: prefer macros provided by gnulib source
Michael Pratt [Wed, 22 Mar 2023 22:46:30 +0000 (18:46 -0400)]
tools/missing-macros: prefer macros provided by gnulib source

These 7 macro files are provided by gnulib,
so we can now replace these statically stored copies
with the latest copy from GNU sources.

Signed-off-by: Michael Pratt <mcpratt@pm.me>
19 months agotools: add gnulib source
Michael Pratt [Wed, 22 Mar 2023 22:29:24 +0000 (18:29 -0400)]
tools: add gnulib source

By having a local copy of gnulib, we can:
import the latest macro fixes into any package,
get rid of some statically stored macros that were otherwise missing,
bootstrap GNU tools with the latest relevant source
without having to wait for a release or rely on git submodules,
and possibly more...

The patch assists in bootstrapping by ignoring
the building of po files using gettext,
and also to allow a user-defined path to a program
to include parameters.

Signed-off-by: Michael Pratt <mcpratt@pm.me>
19 months agoautotools: add list of fake paths to tools
Michael Pratt [Fri, 14 Apr 2023 06:06:53 +0000 (02:06 -0400)]
autotools: add list of fake paths to tools

A list that can be used by some packages in order
to force the skipping of every execution of autoreconf.

Signed-off-by: Michael Pratt <mcpratt@pm.me>
19 months agoprereq-build: add check for true and false
Michael Pratt [Thu, 20 Apr 2023 16:31:16 +0000 (12:31 -0400)]
prereq-build: add check for true and false

Some uses cases, like with autotools, need a path for 'true'
if we use them to force something to skip.

This will work by default on Linux hosts,
and require MacOS hosts to get coreutils,
which is currently installed in the CI
for 'macos-latest' host.

In the future, prereq stage can be reworked
to search for the actual binary
instead of relying on env.

Signed-off-by: Michael Pratt <mcpratt@pm.me>
19 months agolantiq: xrx200: mark subtarget as source-only
Aleksander Jan Bajkowski [Thu, 4 May 2023 11:30:35 +0000 (13:30 +0200)]
lantiq: xrx200: mark subtarget as source-only

The current problems blocking the switch to the kernel 5.15 are
related to the GSWIP driver. This driver is only used by the
xrx200 subtarget. The other subtargets are unaffected by this
problem.

Signed-off-by: Aleksander Jan Bajkowski <olek2@wp.pl>
19 months agoRevert "lantiq: mark source only"
Aleksander Jan Bajkowski [Thu, 4 May 2023 12:02:04 +0000 (14:02 +0200)]
Revert "lantiq: mark source only"

This reverts commit c306385474f4f183657423be708ac7813ee38b47.

It should be sufficient to disable only the xrx200 subtarget.

Signed-off-by: Aleksander Jan Bajkowski <olek2@wp.pl>
19 months agokernel: improve handling of CONFIG_IO_URING
Tony Ambardar [Tue, 25 Apr 2023 05:28:44 +0000 (22:28 -0700)]
kernel: improve handling of CONFIG_IO_URING

Kernel setting CONFIG_IO_URING supports high-performance I/O for file
access and servers, generally for more performant platforms, and adds
~45 KB to kernel sizes. The need for this on less "beefy" devices is
questionable, as is the size cost considering many platforms have kernel
size limits which require tricky repartitioning if outgrown. The size
cost is also large relative to the ~180 KB bump expected between major
OpenWRT kernel releases.

No OpenWrt packages have hard dependencies on this; samba4 and mariadb
can take advantage if available (+KERNEL_IO_URING:liburing) but
otherwise build and work fine.

Since CONFIG_IO_URING is already managed via the KERNEL_IO_URING setting
in Config-kernel.in (default Y), remove it from those target configs
which unconditionally enable it, and update the defaults to enable it
conditionally only on more powerful 64-bit x86 and arm devices. It may
still be manually enabled as needed for high-performance custom builds.

Signed-off-by: Tony Ambardar <itugrok@yahoo.com>
19 months agokernel: fix handling of CONFIG_DYNAMIC_DEBUG
Tony Ambardar [Wed, 30 Nov 2022 01:52:46 +0000 (17:52 -0800)]
kernel: fix handling of CONFIG_DYNAMIC_DEBUG

Since CONFIG_DYNAMIC_DEBUG is already managed via the KERNEL_DYNAMIC_DEBUG
setting in Config-kernel.in (default N), remove or disable it in target
configs which unconditionally enable it, along with the related setting
CONFIG_DYNAMIC_DEBUG_CORE. This saves several KB in the kernels for
ipq40xx, ipq806x, filogic, mt7622, qoriq, and sunxi.

Signed-off-by: Tony Ambardar <itugrok@yahoo.com>
19 months agokernel: bump 5.15 to 5.15.110
John Audia [Mon, 1 May 2023 07:54:24 +0000 (03:54 -0400)]
kernel: bump 5.15 to 5.15.110

All patches automatically rebased.

Build system: x86_64
Build-tested: bcm2711/RPi4B, ramips/tplink_archer-a6-v3, filogic/xiaomi_redmi-router-ax6000-ubootmod
Run-tested: bcm2711/RPi4B, ramips/tplink_archer-a6-v3, filogic/xiaomi_redmi-router-ax6000-ubootmod

Signed-off-by: John Audia <therealgraysky@proton.me>
19 months agoipq40xx: convert AVM FRITZ!Repeater 3000 to DSA
Nick Hainke [Mon, 24 Apr 2023 20:00:18 +0000 (22:00 +0200)]
ipq40xx: convert AVM FRITZ!Repeater 3000 to DSA

Convert the repeater to DSA.

Signed-off-by: Nick Hainke <vincent@systemli.org>
19 months agokernel: Activate CONFIG_SLAB_FREELIST_RANDOM
Hauke Mehrtens [Sat, 22 Apr 2023 16:45:43 +0000 (18:45 +0200)]
kernel: Activate CONFIG_SLAB_FREELIST_RANDOM

This activates CONFIG_SLAB_FREELIST_RANDOM.
This option make the free list less predictable. This makes it harder to
exploit heap based security vulnerabilities.

This adds a little bit more code to the kernel and a small additional
compute overhead.

This option is activated in Debian by default.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
19 months agoomap: mark source only
Paul Spooren [Mon, 1 May 2023 15:52:34 +0000 (17:52 +0200)]
omap: mark source only

The target is currently broken with Kernel 5.15 and no one in sight to
fix it. Instead of stalling the next release indefinitely, make it
source only and see if someone steps up to fix it.

Signed-off-by: Paul Spooren <paul.spooren@rhebo.com>
19 months agolantiq: mark source only
Paul Spooren [Mon, 1 May 2023 15:56:36 +0000 (17:56 +0200)]
lantiq: mark source only

The target is currently broken with Kernel 5.15 and no one in sight to
fix it. Instead of stalling the next release indefinitely, make it
source only and see if someone steps up to fix it.

Signed-off-by: Paul Spooren <paul.spooren@rhebo.com>
19 months agouboot-mediatek: fixes build when nmbm enabled
Chukun Pan [Thu, 20 Apr 2023 15:03:08 +0000 (23:03 +0800)]
uboot-mediatek: fixes build when nmbm enabled

The image_header_t typedef has been removed from
uboot v2023.01 [1], replaced with legacy struct.

[1] https://github.com/u-boot/u-boot/commit/f3543e69442ca393e52df253d9c5d45bc189d471

Fixes: 3d5c542 ("uboot-mediatek: update to U-Boot 2023.01")
Signed-off-by: Chukun Pan <amadeus@jmu.edu.cn>
19 months agouboot-mediatek: fix CONFIG_TEXT_BASE variable
Chukun Pan [Wed, 19 Apr 2023 15:02:09 +0000 (23:02 +0800)]
uboot-mediatek: fix CONFIG_TEXT_BASE variable

CONFIG_SYS_TEXT_BASE has been renamed to CONFIG_TEXT_BASE
in uboot v2023.01 [1], fixes all this variable.

[1] https://github.com/u-boot/u-boot/commit/984639039f4cfe32ec2cc531d6ace05326ac49eb

Fixes: 3d5c5427 ("uboot-mediatek: update to U-Boot 2023.01")
Signed-off-by: Chukun Pan <amadeus@jmu.edu.cn>
19 months agouboot-mediatek: remove duplicate config in mt7986
Chukun Pan [Tue, 18 Apr 2023 15:05:21 +0000 (23:05 +0800)]
uboot-mediatek: remove duplicate config in mt7986

Some config was written twice by mistake, fix it.

Signed-off-by: Chukun Pan <amadeus@jmu.edu.cn>
19 months agoramips: mt7621: add support for Cudy X6 v2
Felix Baumann [Fri, 21 Apr 2023 01:39:38 +0000 (03:39 +0200)]
ramips: mt7621: add support for Cudy X6 v2

Rename existing device to v1 and create common .dtsi
Difference to v1: 16MB Flash

Specifications:

SoC: MediaTek MT7621
RAM: 256 MB
Flash: 16 MB (SPI NOR, XM25QH128C on my device)
WiFi: MediaTek MT7915E
Switch: 1 WAN, 4 LAN (Gigabit)
Buttons: Reset, WPS
LEDs: Two Power LEDs (blue and red; together they form purple)
Power: DC 12V 1A center positive
Serial: 115200 8N1
        C440 - (3V3 - GND - RX - TX) - C41 | v1 and v2
               (P   - G   - R  - T)        | v2 labels them on the board
Installation:

Download and flash the manufacturer's built OpenWrt image available at
http://www.cudytech.com/openwrt_software_download
Install the new OpenWrt image via luci (System -> Backup/Flash firmware)
Be sure to NOT keep settings.

Recovery:

Loads only signed manufacture firmware due to bootloader RSA verification
Serve tftp-recovery image as /recovery.bin on 192.168.1.88/24
Connect to any lan ethernet port
Power on the device while holding the reset button
Wait at least 8 seconds before releasing reset button for image to
download

MAC addresses as verified by OEM firmware:

use   address             source
LAN   f4:a4:54:86:75:a2   label
WAN   f4:a4:54:86:75:a3   label + 1
2g    f4:a4:54:86:75:a2   label
5g    f6:a4:54:b6:75:a2   label + LA-Bit set + 4th oktet increased

The label MAC address is found in bdinfo 0xde00.

Signed-off-by: Felix Baumann <felix.bau@gmx.de>
19 months agorealtek: hpe_1920-8g: add phy-handle for SFP ports
Jan Hoffmann [Sat, 11 Mar 2023 20:34:25 +0000 (21:34 +0100)]
realtek: hpe_1920-8g: add phy-handle for SFP ports

The switch driver actually expects every port to have a PHY handle, and
several branches in the code determine if a port is valid by checking
for a non-zero phy field.

Signed-off-by: Jan Hoffmann <jan@3e8.eu>
19 months agomediatek: no longer hard-code WAN PHY of Netgear WAX206
Daniel Golle [Sun, 30 Apr 2023 03:01:12 +0000 (04:01 +0100)]
mediatek: no longer hard-code WAN PHY of Netgear WAX206

The RealTek 2.5G PHY providing the WAN port of the Netgear WAX206 has
previously been hard-coded in the device tree. Now that the PHY can be
probed correctly also via Clause-45 MDIO, use that instead.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
19 months agogeneric: net: phy: realtek: detect early version of RTL8221B
Daniel Golle [Sun, 30 Apr 2023 02:59:55 +0000 (03:59 +0100)]
generic: net: phy: realtek: detect early version of RTL8221B

Early versions (?) of the RTL8221B PHY cannot be identified in a regular
Clause-45 bus scan as the PHY doesn't report the implemented MMDs
correctly but returns 0 instead.
Implement custom identify function using the PKGID instead of iterating
over the implemented MMDs to work-around this problem.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
19 months agokernel: bump 5.15 to 5.15.109
John Audia [Sat, 29 Apr 2023 11:22:29 +0000 (07:22 -0400)]
kernel: bump 5.15 to 5.15.109

Removed upstreamed:
backport-5.15/743-v6.3-0005-net-dsa-b53-mmap-add-phy-ops.patch[1]

All other patches automatically rebased.

1. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.15.109&id=357fa038d93d0e9159a0f0d45bae0f8654e2ade5

Build system: x86_64
Build-tested: bcm2711/RPi4B, ramips/tplink_archer-a6-v3, filogic/xiaomi_redmi-router-ax6000-ubootmod
Run-tested: bcm2711/RPi4B, ramips/tplink_archer-a6-v3, filogic/xiaomi_redmi-router-ax6000-ubootmod

Signed-off-by: John Audia <therealgraysky@proton.me>
19 months agokernel: bump 5.10 to 5.10.179
John Audia [Sat, 29 Apr 2023 08:00:30 +0000 (04:00 -0400)]
kernel: bump 5.10 to 5.10.179

All patches automatically rebased.

Signed-off-by: John Audia <therealgraysky@proton.me>
19 months agoramips: add factory image for TP-Link EC330-G5u v1
Mikhail Zhilkin [Sat, 22 Apr 2023 09:35:44 +0000 (09:35 +0000)]
ramips: add factory image for TP-Link EC330-G5u v1

This commit adds factory.bin image for TP-Link EC330-G5u v1. This allows
to install OpenWrt without connecting a serial cable (UART).

Installation using factory image
--------------------------------

Tested with "3.16.0 0.9.1 v6037.0 Build 191016 Rel.30619nb" TP-Link
firmware.

1.  Login to the router web interface (http://192.168.0.1/ by default) and
    save running config to "conf.bin" file
2.  Open configuration file in any TP-Link config editor (e.g.
    https://jahed.github.io/tp-link-config-editor/)
3.  Find "DeviceInfo" section and insert a new string "<Description
    val="Modem Router`telnetd -p 1023 -l login`" />" according to the
    following example:
       <DeviceInfo>
          ...
          <Description val="Modem Router`telnetd -p 1023 -l login`" />
          ...
       </DeviceInfo>
4.  Save configuration file and upload changed configuration using stock
    firmware interface
5.  Login using telnet to IP:192.168.0.1 (Username:admin, password:1234)
6.  Run "cat /proc/mtd | grep mtd7"
       a. If the result is 'mtd7: 03000000 00020000 "rootfs" 03400000',
          then install stock firmware using web interface to toggle booted
          firmware image from "os1" to "os0"
       b. If the result is 'mtd7: 03000000 00020000 "rootfs" 00400000',
          then all is ok, go to the next step
7.  Set up a tftp server with OpenWrt factory.bin image (IP:192.168.0.100
    in this example)
8.  Login using telnet to 192.168.0.1
9.  Download OpenWrt factory.bin image from the tftp server:
       cd /tmp
       tftp -g -r factory.bin 192.168.0.100
10. Write OpenWrt factory.bin image:
       dd if=/tmp/factory.bin of=/dev/mtdblock1
11. Power cycle the router

Signed-off-by: Mikhail Zhilkin <csharper2005@gmail.com>
19 months agoramips: TP-Link EC330-G5u v1: switch to mac-address-ascii
Mikhail Zhilkin [Sat, 22 Apr 2023 06:58:01 +0000 (06:58 +0000)]
ramips: TP-Link EC330-G5u v1: switch to mac-address-ascii

The TP-Link EC330-G5u v1 router has MAC address that stored in factory mtd
in ascii format. This commit makes the router use of "mac-address-ascii"
in dts.

After the change:
1. All MAC addresses are explicitly assigned in dts (the workarounds in
   network scripts are no longer needed);
2. gmac0 (eth0) MAC address is no longer random.

Signed-off-by: Mikhail Zhilkin <csharper2005@gmail.com>
19 months agoramips: lzma-loader: Refactor loader
Antonio Vázquez [Sat, 21 Jan 2023 21:34:28 +0000 (22:34 +0100)]
ramips: lzma-loader: Refactor loader

* Delete unused lantiq makefile
* Delete redundant makefiles and unify them into the main makefile
* Refactor and unify board code into a single file
* Add support and review subtarget specific board support

Signed-off-by: Antonio Vázquez <antoniovazquezblanco@gmail.com>
19 months agoramips: add support for D-Link DAP-1620 B1
Rani Hod [Sun, 9 Apr 2023 19:47:58 +0000 (22:47 +0300)]
ramips: add support for D-Link DAP-1620 B1

The DAP-1620 rev B is a wall-plug AC1300 repeater.

Specifications:
- MT7621AT, 256 MiB RAM, 16 MiB SPI NOR
- MT7615DN 2x2 802.11n +2x2 802.11ac (DBDC)
- Ethernet: 1 port 10/100/1000
- Status LEDs (1x red+green)
- LED RSSI bargraph (2x green, 1x red+green)

Installation:
- Keep reset button pressed during plug-in
- Web Recovery Updater is at 192.168.0.50
- Upload factory.bin, confirm flashing
  (seems to work best with Chromium-based browsers)

Revert to OEM firmware:
- tail -c+117 DAP1620B1_FW212B03.bin | \
  openssl aes-256-cbc -d -md md5 -out decrypted.bin \
  -k 905503a4e0c3cd3c1ce062246de427a68962347e
- flash decrypted.bin via D-Link Web Recovery

Signed-off-by: Rani Hod <rani.hod@gmail.com>
19 months agobcm27xx: Deactivate CONFIG_OABI_COMPAT
Hauke Mehrtens [Sat, 22 Apr 2023 17:56:42 +0000 (19:56 +0200)]
bcm27xx: Deactivate CONFIG_OABI_COMPAT

This deactivates the kernel option CONFIG_OABI_COMPAT.

The old arm OABI is not needed any more, we compile all applications for
the new ARM EABI.

This reduces the attack surface of the kernel syscall interface.

On all other targets CONFIG_OABI_COMPAT is already deactivated.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
19 months agokernel: Deactivate CONFIG_COMPAT
Hauke Mehrtens [Sat, 22 Apr 2023 17:48:54 +0000 (19:48 +0200)]
kernel: Deactivate CONFIG_COMPAT

This deactivates the CONFIG_COMPAT kernel option.
With CONFIG_COMPAT the kernel will provide syscall interfaces for arm32
binaries in addition to the interfaces needed for arm64 binaries.

In OpenWrt the complete userspace is compiled for this specific
architecture and support for 32 bit ARM applications is not needed.
This reduces the size and the attack surface for the systems.

On all other targets CONFIG_COMPAT is already deactivated.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
19 months agokernel: Deactivate CONFIG_LEGACY_PTYS
Hauke Mehrtens [Sat, 22 Apr 2023 13:40:59 +0000 (15:40 +0200)]
kernel: Deactivate CONFIG_LEGACY_PTYS

The legacy (BSD) PTY support could open security problems in a system,
We do not need them in OpenWrt, deactivate this option in all targets.

Debian also deactivates this option.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
19 months agokernel: Activate CONFIG_ARM64_SW_TTBR0_PAN
Hauke Mehrtens [Sat, 22 Apr 2023 17:52:22 +0000 (19:52 +0200)]
kernel: Activate CONFIG_ARM64_SW_TTBR0_PAN

This activates the CONFIG_ARM64_SW_TTBR0_PAN option for all arm64
kernels by default.

The CONFIG_ARM64_SW_TTBR0_PAN option prevents the kernel form accessing
user space memory directly. This makes it harder to exploit the kernel.

This is activated by default and was already activate on all other arm64
targets before.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
19 months agokernel: Activate CONFIG_HARDENED_USERCOPY for all targets
Hauke Mehrtens [Sat, 22 Apr 2023 13:52:56 +0000 (15:52 +0200)]
kernel: Activate CONFIG_HARDENED_USERCOPY for all targets

This activates CONFIG_HARDENED_USERCOPY for the remaining targets. This
adds additional checks in the copy_from_user() and copy_to_user()
functions.

This was not activated for ARCHS38 before because of a bug in the Linux
kernel 5.4 till 5.14, which as fixed and is described here:
https://github.com/foss-for-synopsys-dwc-arc-processors/linux/issues/15

I do not know why this was deactivated for mt7629 and rockchip.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
19 months agoramips: mt7621: add support for ZyXEL WSM20
Andreas Böhler [Tue, 4 Apr 2023 17:41:26 +0000 (19:41 +0200)]
ramips: mt7621: add support for ZyXEL WSM20

The ZyXEL WSM20 aka Multy M1 is a cheap mesh router system by ZyXEL
based on the MT7621 CPU.

Specifications
==============

SoC: MediaTek MT7621AT (880MHz)
RAM: 256MiB
Flash: 128MiB NAND
Wireless: 802.11ax (2x2 MT7915E DBDC)
Ethernet: 4x 10/100/1000 (MT7530)
Button: 1x WPS, 1x Reset, 1x LED On/Off
LED: 7 LEDs (3x white, 2x red, 2x green)

MAC address assignment
======================

The MAC address assignment follows stock: The label MAC address is the LAN
MAC address, the WAN address is read from flash.

The WiFi MAC addresses are set in userspace to label MAC + 1 and label MAC
+ 2.

Installation (web interface)
============================

The device is cloud-managed, but there is a hidden local firmware upgrade
page in the OEM web interface. The device has to be registered in the
cloud in order to be able to access this page.

The system has a dual firmware design, there is no way to tell which
firmware is currently booted. Therefore, an -initramfs version is flashed
first.

1. Log into the OEM web GUI
2. Access the hidden upgrade page by navigating to
   https://192.168.212.1/gui/#/main/debug/firmwareupgrade
3. Upload the -initramfs-kernel.bin file and flash it
4. Wait for OpenWrt to boot and log in via SSH
5. Transfer the sysupgrade file via SCP
6. Run sysupgrade to install the image
7. Reboot and enjoy

NB: If the initramfs version was installed in RAS2, the sysupgrade script
sets the boot number to the first partition. A backup has to be performed
manually in case the OEM firwmare should be kept.

Installation (UART method)
==========================

The UART method is more difficult, as the boot loader does not have a
timeout set. A semi-working stock firmware is required to configure it:

1. Attach UART
2. Boot the stock firmware until the message about failsafe mode appears
3. Enter failsafe mode by pressing "f" and "Enter"
4. Type "mount_root"
5. Run "fw_setenv bootmenu_delay 3"
6. Reboot, U-Boot now presents a menu
7. The -initramfs-kernel.bin image can be flashed using the menu
8. Run the regular sysupgrade for a permanent installation

Changing the partition to boot is a bit cumbersome in U-Boot, as there is
no menu to select it. It can only be checked using mstc_bootnum. To change
it, issue the following commands in U-Boot:

   nand read 1800000 53c0000 800
   mw.b 1800004 1 1
   nand erase 53c0000 800
   nand write 1800000 53c0000 800

This selects FW1. Replace "mw.b 1800004 1 1" by "mw.b 1800004 2 1" to
change to the second slot.

Back to stock
=============

It is possible to flash back to stock, but a OEM firmware upgrade is
required. ZyXEL does not provide the link on its website, but the link
can be acquired from the OEM web GUI by analyzing the transferred JSON
objects.

It is then a matter of writing the firmware to Kernel2 and setting the
boot partition to FW2:

   mtd write zyxel.bin Kernel2
   echo -ne "\x02" | dd of=/dev/mtdblock7 count=1 bs=1 seek=4 conv=notrunc

Signed-off-by: Andreas Böhler <dev@aboehler.at>
Credits to forum users Annick and SirLouen for their initial work on this
device

19 months agoumbim: include MBIM-provided DNS servers also with DHCP mode
Lech Perczak [Sat, 6 Nov 2021 16:56:03 +0000 (17:56 +0100)]
umbim: include MBIM-provided DNS servers also with DHCP mode

In MBIM interfaces, DNS servers may be provided out-of-band regardless
whether DHCP is used for configuration, or not. Move the DNS
configuration outside "if" blocks to support that.

Signed-off-by: Lech Perczak <lech.perczak@gmail.com>
19 months agoumbim: extract common code from static and dhcp(v6) setup procedure
Lech Perczak [Sat, 6 Nov 2021 16:51:25 +0000 (17:51 +0100)]
umbim: extract common code from static and dhcp(v6) setup procedure

Beginnings and endings of sub-interface creation procedure were
literally duplicates - extract them outside if "if" blocks

Signed-off-by: Lech Perczak <lech.perczak@gmail.com>
19 months agoumbim: handle MTU configuration
Lech Perczak [Sat, 6 Nov 2021 15:01:02 +0000 (16:01 +0100)]
umbim: handle MTU configuration

Allow setting interface MTU through UCI. If this is not set,
use MBIM-provided MTU, if provided through control channel.
If separate MTUs are provided for IPv4 and IPv6, apply larger of them.
This is very unlikely and possible only for IPv4v6 dual-stack configuration.

Signed-off-by: Lech Perczak <lech.perczak@gmail.com>
19 months agoumbim: delegate RFC7278 IPv6 prefixes from OOB config
Lech Perczak [Sat, 6 Nov 2021 13:02:15 +0000 (14:02 +0100)]
umbim: delegate RFC7278 IPv6 prefixes from OOB config

Delegate prefixes received through MBIM control channel the same way, as
would be done through DHCP, according to RFC7278.

Signed-off-by: Lech Perczak <lech.perczak@gmail.com>
19 months agoumbim: drop IP configuration parsing using 'eval'
Lech Perczak [Sat, 6 Nov 2021 12:43:12 +0000 (13:43 +0100)]
umbim: drop IP configuration parsing using 'eval'

Finally, when new helper is in use, drop old IP configuration parser.

Signed-off-by: Lech Perczak <lech.perczak@gmail.com>
19 months agoumbim: support multiple-valued configuration fields
Lech Perczak [Sat, 6 Nov 2021 12:35:15 +0000 (13:35 +0100)]
umbim: support multiple-valued configuration fields

MBIM supports multiple values for IP address and DNS server, and such
configuration is available through output of MBIM. Use new helper
method to support adding multiple addresses and DNS servers to static
interfaces for both IPv4 and IPv6.

Signed-off-by: Lech Perczak <lech.perczak@gmail.com>
19 months agoumbim: add "_proto_mbim_get_field" helper
Lech Perczak [Sat, 6 Nov 2021 12:21:32 +0000 (13:21 +0100)]
umbim: add "_proto_mbim_get_field" helper

Add a new helper to extract IP configuration from umbim output. This is
required to extract fields which can possibly have multiple values,
namely IP addresses and DNS servers, and get rid of primitive parser
using 'eval' builtin without support for this.

Signed-off-by: Lech Perczak <lech.perczak@gmail.com>
19 months agoumbim: log output of 'config' step
Lech Perczak [Sat, 6 Nov 2021 02:02:08 +0000 (03:02 +0100)]
umbim: log output of 'config' step

Display full configuration obtained using MBIM control channel in the
log, from umbim output verbatim, for easier troubleshooting, and in
preparation for parser refactoring.

Signed-off-by: Lech Perczak <lech.perczak@gmail.com>
19 months agoumbim: pass ipXtable to child interfaces
Lech Perczak [Fri, 6 Aug 2021 20:29:57 +0000 (22:29 +0200)]
umbim: pass ipXtable to child interfaces

Inspired by commti e51aa699f7ca, allow setting specific routing tables
via ip4table and ip6table options, by passing them on child interfaces
created by MBIM protocol handler.

Signed-off-by: Lech Perczak <lech.perczak@gmail.com>
19 months agoumbim: respect 'Enable IPv6 negotiation' option
Lech Perczak [Tue, 20 Jul 2021 20:57:10 +0000 (22:57 +0200)]
umbim: respect 'Enable IPv6 negotiation' option

Don't bring IPv6 part of interface up if it's disabled,
or system does not support it.

Signed-off-by: Lech Perczak <lech.perczak@gmail.com>
19 months agoumbim: use static config by default, fallback to DHCP
Lech Perczak [Mon, 19 Jul 2021 19:28:07 +0000 (21:28 +0200)]
umbim: use static config by default, fallback to DHCP

Finally, inspired by ModemManager's logic, make static configuration
obtained through MBIM control channel, preferred.
If IP configuration is not available this way, fallback to DHCP(v6) if
enabled, else do not create a sub-interface for unavailable IP type.

Signed-off-by: Lech Perczak <lech.perczak@gmail.com>
19 months agoumbim: separate DHCPv6 configuration from DHCP(v4)
Lech Perczak [Mon, 9 Jan 2023 21:54:07 +0000 (22:54 +0100)]
umbim: separate DHCPv6 configuration from DHCP(v4)

Now, that sub-interface setup is split by IP type, and separate checks
are performed for DHCP selection, it is possible to control DHCP on v4
an v6 sub-interfaces instantly. Add "dhcpv6" variable, akin to QMI
option, to control behaviour of DHCPv6 separately from IPv4 option,
which is required for some mobile operators.

Signed-off-by: Lech Perczak <lech.perczak@gmail.com>
19 months agoumbim: restructure IPv4/IPv6 handling
Lech Perczak [Mon, 19 Jul 2021 19:16:08 +0000 (21:16 +0200)]
umbim: restructure IPv4/IPv6 handling

Check whether interface is configured per IP type, not per DHCP. This is
preparation to allow fallback to DHCP if static IP configuration is not
available, which is the default option for MBIM modems

Signed-off-by: Lech Perczak <lech.perczak@gmail.com>
19 months agoumbim: inherit firewall zone membership from parent interface
Lech Perczak [Mon, 19 Jul 2021 17:26:02 +0000 (19:26 +0200)]
umbim: inherit firewall zone membership from parent interface

Fix an issue where subinterfaces were not added to the same
firewall zone as their parent.
Inspired by 64bb88841fb.

Signed-off-by: Lech Perczak <lech.perczak@gmail.com>
19 months agoumbim: inherit "peerdns" option from parent interface
Lech Perczak [Mon, 19 Jul 2021 17:15:53 +0000 (19:15 +0200)]
umbim: inherit "peerdns" option from parent interface

MBIM protocol handler should intherit "peerdns" options from parent
interface on sub-interfaces, otherwise upstream DNS servers are applied
regardless of configuration.

Signed-off-by: Lech Perczak <lech.perczak@gmail.com>
19 months agoumbim: use IP configuration provided by MBIM by default
Lech Perczak [Mon, 19 Jul 2021 17:04:09 +0000 (19:04 +0200)]
umbim: use IP configuration provided by MBIM by default

Previously, DHCP was used. According to MBIM Specification v1.0 errata 1 [1],
section 10.5.20, MBIM_CID_IP_CONFIGURATION,
if MBIM information element containing IP configuration is available,
host shall use it, and fall back to in-band mechanisms to acquire it therwise -
therefore make static configuration the default.

[1] https://www.usb.org/document-library/mobile-broadband-interface-model-v10-errata-1-and-adopters-agreement

Signed-off-by: Lech Perczak <lech.perczak@gmail.com>
19 months agoumbim: detect actual connection IP type
Lech Perczak [Mon, 21 Feb 2022 21:48:10 +0000 (22:48 +0100)]
umbim: detect actual connection IP type

Current implementation needlessly creates both IPv4 and IPv6
sub-interfaces for single-stack IP types. Limit this only to selected IP
type. While at that, ensure that IP type is also passed to umbim during
"connect" phase. In addition, detect the actual established connection
type returned by umbim and set up subinterfaces according to that,
not to requested configuration. While at that, allow empty IP type explicitly,
interpreted as "any" according to MBIM specification.

Signed-off-by: Lech Perczak <lech.perczak@gmail.com>
19 months agoumbim: fail connect step immediately
Lech Perczak [Mon, 9 Jan 2023 21:08:07 +0000 (22:08 +0100)]
umbim: fail connect step immediately

Subsequent calls to 'umbim connect' do not have any effect if a failure
occured, and in such case an infinite loop without timeout is created,
leading to possibility of interface stuck at connecting forever.
Drop this loop, and issue MBIM disconnect properly, so netifd can
restart from scratch.
This issue can be observed with Sierra EM7455 at changing APN, which
causes network re-registration by default, and a MBIM transaction
timeout, which is resolved on next interface bringup by netifd.

Signed-off-by: Lech Perczak <lech.perczak@gmail.com>
19 months agoumbim: connect session for only the selected PDP type
Lech Perczak [Tue, 15 Feb 2022 00:44:32 +0000 (01:44 +0100)]
umbim: connect session for only the selected PDP type

Previous implementation automatically set up connections for both IPv4
and IPv6, even if one of them isn't supported. Respect the "pdptype"
option in the same way, as it is done for QMI or NCM, and only start the
respective PDN sessions, if set.

Signed-off-by: Lech Perczak <lech.perczak@gmail.com>
19 months agoumbim: add support for non-dhcp mode
Martin Schiller [Fri, 7 Feb 2020 11:50:22 +0000 (12:50 +0100)]
umbim: add support for non-dhcp mode

There are mbim compatible wwan modules available which do not support
the dhcp autoconfiguration. (e.g. gemalto Cinterion ELS81)

This adds the possibility to get the configuration parameters from mbim.

Signed-off-by: Martin Schiller <ms@dev.tdt.de>
Signed-off-by: Lech Perczak <lech.perczak@gmail.com>
19 months agotools/patchelf: update to 0.18.0
Nick Hainke [Mon, 24 Apr 2023 06:21:20 +0000 (08:21 +0200)]
tools/patchelf: update to 0.18.0

Release Notes:
https://github.com/NixOS/patchelf/releases/tag/0.18.0

Signed-off-by: Nick Hainke <vincent@systemli.org>
19 months agotools/coreutils: update to 9.3
Nick Hainke [Wed, 26 Apr 2023 10:06:07 +0000 (12:06 +0200)]
tools/coreutils: update to 9.3

Update to latest bugfix release.

Remove upstreamed patches:
- 001-copy-fix-reflink-auto-to-fallback-in-more-cases.patch
- 002-date-diagnose-f-read-errors.patch

Signed-off-by: Nick Hainke <vincent@systemli.org>
19 months agokernel: mtk_bmt: refactor to avoid deep recursion
Michał Kępień [Sat, 29 Apr 2023 06:41:32 +0000 (07:41 +0100)]
kernel: mtk_bmt: refactor to avoid deep recursion

A Linksys E8450 (mt7622) device running current master has recently
started crashing:

    [    0.562900] mtk-ecc 1100e000.ecc: probed
    [    0.570254] spi-nand spi2.0: Fidelix SPI NAND was found.
    [    0.575576] spi-nand spi2.0: 128 MiB, block size: 128 KiB, page size: 2048, OOB size: 64
    [    0.583780] mtk-snand 1100d000.spi: ECC strength: 4 bits per 512 bytes
    [    0.682930] Insufficient stack space to handle exception!
    [    0.682939] ESR: 0x0000000096000047 -- DABT (current EL)
    [    0.682946] FAR: 0xffffffc008c47fe0
    [    0.682948] Task stack:     [0xffffffc008c48000..0xffffffc008c4c000]
    [    0.682951] IRQ stack:      [0xffffffc008008000..0xffffffc00800c000]
    [    0.682954] Overflow stack: [0xffffff801feb00a0..0xffffff801feb10a0]
    [    0.682959] CPU: 1 PID: 1 Comm: swapper/0 Tainted: G S                5.15.107 #0
    [    0.682966] Hardware name: Linksys E8450 (DT)
    [    0.682969] pstate: 800000c5 (Nzcv daIF -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
    [    0.682975] pc : dequeue_entity+0x0/0x250
    [    0.682988] lr : dequeue_task_fair+0x98/0x290
    [    0.682992] sp : ffffffc008c48030
    [    0.682994] x29: ffffffc008c48030 x28: 0000000000000001 x27: ffffff801feb6380
    [    0.683004] x26: 0000000000000001 x25: ffffff801feb6300 x24: ffffff8000068000
    [    0.683011] x23: 0000000000000001 x22: 0000000000000009 x21: 0000000000000000
    [    0.683017] x20: ffffff801feb6380 x19: ffffff8000068080 x18: 0000000017a740a6
    [    0.683024] x17: ffffffc008bae748 x16: ffffffc008bae6d8 x15: ffffffffffffffff
    [    0.683031] x14: ffffffffffffffff x13: 0000000000000000 x12: 0000000f00000101
    [    0.683038] x11: 0000000000000449 x10: 0000000000000127 x9 : 0000000000000000
    [    0.683044] x8 : 0000000000000125 x7 : 0000000000116da1 x6 : 0000000000116da1
    [    0.683051] x5 : 00000000001165a1 x4 : ffffff801feb6e00 x3 : 0000000000000000
    [    0.683058] x2 : 0000000000000009 x1 : ffffff8000068080 x0 : ffffff801feb6380
    [    0.683066] Kernel panic - not syncing: kernel stack overflow
    [    0.683069] SMP: stopping secondary CPUs
    [    1.648361] SMP: failed to stop secondary CPUs 0-1
    [    1.648366] Kernel Offset: disabled
    [    1.648368] CPU features: 0x00003000,00000802
    [    1.648372] Memory Limit: none

Several factors contributed to this issue:

 1. The mtk_bmt driver recursively calls its scan_bmt() helper function
    during device initialization, while looking for a valid block
    mapping table (BMT).

 2. Commit fa4dc86e98 ("kernel: backport MEMREAD ioctl"):

      - increased the size of some stack-allocated structures (like
struct mtd_oob_ops, used in bbt_nand_read(), which is indirectly
called from scan_bmt()),

      - increased the stack size for some functions (for example,
spinand_mtd_read(), which is indirectly called from scan_bmt(),
now uses an extra stack-allocated struct mtd_ecc_stats).

 3. OpenWrt currently compiles the kernel with the
    -fno-optimize-sibling-calls flag, which prevents tail-call
    optimization.

Collectively, all of these factors caused stack usage in the mtk_bmt
driver to grow excessively large, triggering stack overflows.

Recursion is not really necessary in scan_bmt() as it simply iterates
over flash memory blocks in reverse order, looking for a valid BMT.
Refactor the logic contained in the scan_bmt() and read_bmt() functions
in target/linux/generic/files/drivers/mtd/nand/mtk_bmt_v2.c so that deep
recursion is prevented (and therefore also any potential stack overflows
it may cause).

Link: https://lists.openwrt.org/pipermail/openwrt-devel/2023-April/040872.html
Signed-off-by: Michał Kępień <openwrt@kempniu.pl>
19 months agokernel: Activate CONFIG_SCHED_STACK_END_CHECK
Hauke Mehrtens [Sat, 22 Apr 2023 17:36:22 +0000 (19:36 +0200)]
kernel: Activate CONFIG_SCHED_STACK_END_CHECK

This activates the CONFIG_SCHED_STACK_END_CHECK option.

The kernel will check if the kernel stack overflowed in the schedule()
function. This just adds a very small computational overhead.

This option is activated in Debian by default.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
19 months agokernel: Activate CONFIG_SLAB_FREELIST_HARDENED
Hauke Mehrtens [Sat, 22 Apr 2023 13:07:36 +0000 (15:07 +0200)]
kernel: Activate CONFIG_SLAB_FREELIST_HARDENED

This activates some extra checks in SLAB or SLUB to make it harder to
execute kernel heap exploits. This adds a minor performance
degradation which I haven't measured-.

Many mainstream Linux distributions also activate this option.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
19 months agokernel: Initialize RNG using CPU RNG and bootloader
Hauke Mehrtens [Sat, 22 Apr 2023 13:28:01 +0000 (15:28 +0200)]
kernel: Initialize RNG using CPU RNG and bootloader

This activates the following kernel options by default:
* CONFIG_RANDOM_TRUST_CPU
* CONFIG_RANDOM_TRUST_BOOTLOADER

With these option Linux will also use data from the CPU RNG e.g. RDRAND
and the bootloader to initialize the Linux RNG if such sources are
available.
These random bits are used in addition to the other sources, no other
sources are getting deactivated. I read that the Chacha mixer isn't
vulnerable to injected entropy, so this should not be a problem even if
these sources might inject bad random data.

The Linux kernel suggests to activate both options, Debian also
activates them. This does not increase kernel code size.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
19 months agoopenssl: fix low-severity CVE-2023-1255
Eneas U de Queiroz [Wed, 26 Apr 2023 11:35:23 +0000 (08:35 -0300)]
openssl: fix low-severity CVE-2023-1255

This applies commit 02ac9c94 to fix this OpenSSL Security Advisory
issued on 20th April 2023[1]:

Input buffer over-read in AES-XTS implementation on 64 bit ARM
(CVE-2023-1255)
==============================================================

Severity: Low

Issue summary: The AES-XTS cipher decryption implementation for 64 bit
ARM platform contains a bug that could cause it to read past the input
buffer, leading to a crash.

Impact summary: Applications that use the AES-XTS algorithm on the 64
bit ARM platform can crash in rare circumstances. The AES-XTS algorithm
is usually used for disk encryption.

The AES-XTS cipher decryption implementation for 64 bit ARM platform
will read past the end of the ciphertext buffer if the ciphertext size
is 4 mod 5 in 16 byte blocks, e.g. 144 bytes or 1024 bytes. If the
memory after the ciphertext buffer is unmapped, this will trigger a
crash which results in a denial of service.

If an attacker can control the size and location of the ciphertext
buffer being decrypted by an application using AES-XTS on 64 bit ARM,
the application is affected. This is fairly unlikely making this issue a
Low severity one.

1. https://www.openssl.org/news/secadv/20230420.txt

Signed-off-by: Eneas U de Queiroz <cotequeiroz@gmail.com>
19 months agokernel: crypto: crypto-rng: select SHA512 for >= 5.14.0
Glen Huang [Wed, 26 Apr 2023 14:38:24 +0000 (22:38 +0800)]
kernel: crypto: crypto-rng: select SHA512 for >= 5.14.0

drbg swtiched to use HMAC(SHA-512) since 5.14.0
https://github.com/torvalds/linux/commit/5261cdf457ce3635bf18d393a3c1991dcfaf9d02

Signed-off-by: Glen Huang <me@glenhuang.com>
19 months agomediatek: remove mt753x driver
Felix Fietkau [Sat, 29 Apr 2023 08:25:18 +0000 (10:25 +0200)]
mediatek: remove mt753x driver

It is unused

Signed-off-by: Felix Fietkau <nbd@nbd.name>
19 months agoramips: reduce Archer AX23 / MR70X SPI-frequency
David Bauer [Thu, 27 Apr 2023 20:24:15 +0000 (22:24 +0200)]
ramips: reduce Archer AX23 / MR70X SPI-frequency

It was brought to attention the Archer AX23 v1 fails to read jffs2 data
from time to time. While this is not reproducible on my unit, it is on
others.

Reducing the SPI frequency does the trick. While it worked with at lest
40 MHz, opt for the cautious side and choose a save frequency of 25 MHz.

Apply the same treatment to the Mercusys MR70X which uses a similar
design just in case.

Signed-off-by: David Bauer <mail@david-bauer.net>
19 months agobroadcom-sprom: update to latest version
Álvaro Fernández Rojas [Thu, 27 Apr 2023 15:46:12 +0000 (17:46 +0200)]
broadcom-sprom: update to latest version

Replaces SPROMs with the ones from bmips fixups to prevent errors such as:
https://github.com/openwrt/openwrt/pull/11474#issuecomment-1524235591

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
19 months agogeneric: Convert incorrect generic/5.15 patches again
Olliver Schinagl [Thu, 13 Apr 2023 09:38:54 +0000 (11:38 +0200)]
generic: Convert incorrect generic/5.15 patches again

OpenWrt's developer guide prefers having actual patches so they an be
sent upstream more easily.

However, in the case of hack-5.15 patches which are not meant for
upstream, adding proper fields allows for `git am` to properly function.

This commit tries to rectify that, by digging in the history to find
where and how it was first added.

Signed-off-by: Olliver Schinagl <oliver@schinagl.nl>
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
19 months agobmips: fix external interrupt controller
Álvaro Fernández Rojas [Thu, 27 Apr 2023 11:49:10 +0000 (13:49 +0200)]
bmips: fix external interrupt controller

- irq_domain_add_simple() can't be used on bmips since interrupts aren't
hardcoded with specific offsets for internal and external as opposed to
bcm63xx. This is needed to avoid collisions with other interrupts.
- remove unused bcm63xx-specific code.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
19 months agobmips: document GPIO external interrupts
Álvaro Fernández Rojas [Thu, 27 Apr 2023 11:47:24 +0000 (13:47 +0200)]
bmips: document GPIO external interrupts

BCM63xx SoCs have an external interrupt controller which can be used for
specific GPIO keys.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
19 months agobmips: increment polled keys interval to 100
Álvaro Fernández Rojas [Tue, 25 Apr 2023 19:17:52 +0000 (21:17 +0200)]
bmips: increment polled keys interval to 100

There's no need to poll the gpio keys every 20 ms and the linux kernel
documentation suggests 100 ms.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
19 months agoci: add Coverity Scan scheduled workflow
Petr Štetiar [Mon, 30 Jan 2023 07:33:16 +0000 (08:33 +0100)]
ci: add Coverity Scan scheduled workflow

Coverity Scan is a static code analysis service focused on open source
software quality and security, so lets scan various OpenWrt components
every Friday for the start.

Signed-off-by: Petr Štetiar <ynezz@true.cz>
19 months agobusybox: turn on BUSYBOX_DEFAULT_ASH_RANDOM_SUPPORT for having $RANDOM
Ilario Gelmetti [Sun, 23 Apr 2023 14:23:45 +0000 (16:23 +0200)]
busybox: turn on BUSYBOX_DEFAULT_ASH_RANDOM_SUPPORT for having $RANDOM

$RANDOM shell variable is a convenient way for getting a random number from 0 to 32767

Signed-off-by: Ilario Gelmetti <iochesonome@gmail.com>
19 months agobusybox: Activate resize tool by default
Hauke Mehrtens [Sun, 23 Apr 2023 10:24:22 +0000 (12:24 +0200)]
busybox: Activate resize tool by default

The resize tool will resize the prompt to match the current terminal
size. This is helpful when connecting to the system using UART to make
the vi or top output match the current terminal size.

This increases the busybox binary size by 136 bytes and the ipkg size by
335 bytes on aarch64.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
19 months agokernel: ssb: fallback-sprom: check bustype
Álvaro Fernández Rojas [Mon, 24 Apr 2023 18:39:55 +0000 (20:39 +0200)]
kernel: ssb: fallback-sprom: check bustype

host_pci is only defined when bustype is SSB_BUSTYPE_PCI.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
19 months agokernel: bcma: fallback-sprom: check hosttype
Álvaro Fernández Rojas [Mon, 24 Apr 2023 18:38:36 +0000 (20:38 +0200)]
kernel: bcma: fallback-sprom: check hosttype

host_pci is only defined when hosttype is BCMA_HOSTTYPE_PCI.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
19 months agokernel: bcma: fallback-sprom: align extraction with upstream
Álvaro Fernández Rojas [Mon, 24 Apr 2023 18:31:48 +0000 (20:31 +0200)]
kernel: bcma: fallback-sprom: align extraction with upstream

The current bcma SPROM extraction from upstream only supports SPROMs with
revisions from 8 to 11.
Let's align the downstream fallback driver with upstream.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
19 months agokernel: ssb: fallback-sprom: drop mac leftovers
Álvaro Fernández Rojas [Mon, 24 Apr 2023 18:13:13 +0000 (20:13 +0200)]
kernel: ssb: fallback-sprom: drop mac leftovers

This was left behind when removing the MAC extractions from PCI SPROMs.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>