Slate 7 - 4.7.2 breaks nginx for general use

With 4.7.2, there is a major bug with the compiled version of nginx:

root@GL-BE3600:~# nginx -V
nginx version: nginx/1.26.1 (x86_64-pc-linux-gnu)

There is no (easy) way possible to use this version of nginx with other config files as even the most simple config file results in a segmentation fault.

root@GL-BE3600:/etc/nginx# vi nginx_minimal.conf

worker_processes 1;

events {
    worker_connections 1024;
}

http {
    server {
        listen 80;
        server_name localhost;

        location / {
            root /www;
            index index.html;
        }
    }
}

root@GL-BE3600:/etc/nginx# /etc/init.d/nginx stop
root@GL-BE3600:/etc/nginx# nginx -c /etc/nginx/nginx_minimal.conf
Segmentation fault
root@GL-BE3600:/etc/nginx#

Some additional steps are that re-installing nginx-ssl will remove the nginx.conf file so you'll want to recopy that from /rom/etc/nginx. Other things are also broken that need to get reinstalled like nginx-mod-lua, nginx-mod-lua-resty-core, and nginx-mod-lua-resty-lrucache. Reinstalling these and placing the original nginx.conf back into /etc/nginx gets you back to Luci working. There is some bug with the glinet webui that I haven't figured out yet.

1 Like

So the issue is that these ARM Cortex-A53 cores do not support the LSE atomic instructions, but the nginx binary or some of its linked libraries were built assuming LSE support.

That causes the illegal instruction (SIGILL) crash when nginx hits those instructions.

In the build config or package Makefile, please add:
TARGET_CFLAGS += -march=armv8-a -mno-lse

Then rebuild nginx and the related libs

Suspicion of what's going on
• LSE is a new set of atomic instructions added in ARMv8.1-A
• Cortex-A53 cores are ARMv8.0-A and do not have LSE
• Compiling with default ARMv8-A might enable LSE instructions if the toolchain defaults to ARMv8.1 or newer features, causing crashes on older CPUs when there is a server block in the config file which triggers LSE

1 Like

After hours of research, I've found a workaround. Adding "resolver 127.0.0.1 ipv6=off;" to the server section of nginx conf file will prevent segfault.

Bottom Line

  1. Adding resolver 127.0.0.1 ipv6=off; is a workaround because it changes nginx’s startup execution path,
  2. The real issue is still the LSE instructions,
  3. Recompiling nginx and linked libraries with -mno-lse is the permanent fix
5 Likes

Thanks for your love and suggestion, will ask the R&D guys to check.

1 Like