Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Building ngx_stream_socks_module as a dynamic module with --add-dynamic-module= causes segfaults #4

Open
muravjov opened this issue Mar 15, 2023 · 0 comments

Comments

@muravjov
Copy link

Having a simple config like

load_module modules/ngx_stream_module.so;
load_module modules/ngx_stream_socks_module.so;

events {
}

stream {
}

I get segfaults:

$ sudo objs/nginx -t -c /home/sa/nginx_build/socks-nginx.conf
qemu: uncaught target signal 11 (Segmentation fault) - core dumped

How to reproduce:

  • ubuntu 22.04.1
  • the config:
$ sudo objs/nginx -V
nginx version: nginx/1.18.0 (Ubuntu)
built with OpenSSL 3.0.2 15 Mar 2022
TLS SNI support enabled
configure arguments: --with-cc-opt='-g -O2 -ffile-prefix-map=/home/sa/nginx_build/nginx-1.18.0=. -flto=auto -ffat-lto-objects -flto=auto -ffat-lto-objects -fstack-protector-strong -Wformat -Werror=format-security -fPIC -Wdate-time -D_FORTIFY_SOURCE=2' --with-ld-opt='-Wl,-Bsymbolic-functions -flto=auto -ffat-lto-objects -flto=auto -Wl,-z,relro -Wl,-z,now -fPIC' --prefix=/usr/share/nginx --conf-path=/etc/nginx/nginx.conf --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --lock-path=/var/lock/nginx.lock --pid-path=/run/nginx.pid --modules-path=/usr/lib/nginx/modules --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --with-compat --with-debug --with-pcre-jit --with-http_ssl_module --with-http_stub_status_module --with-http_realip_module --with-http_auth_request_module --with-http_v2_module --with-http_dav_module --with-http_slice_module --with-threads --add-dynamic-module=/home/sa/nginx_build/nginx-1.18.0/debian/modules/http-geoip2 --with-http_addition_module --with-http_flv_module --with-http_geoip_module=dynamic --with-http_gunzip_module --with-http_gzip_static_module --with-http_image_filter_module=dynamic --with-http_mp4_module --with-http_perl_module=dynamic --with-http_random_index_module --with-http_secure_link_module --with-http_sub_module --with-http_xslt_module=dynamic --with-mail=dynamic --with-mail_ssl_module --with-stream=dynamic --with-stream_geoip_module=dynamic --with-stream_ssl_module --with-stream_ssl_preread_module --add-dynamic-module=/home/sa/nginx_build/nginx-1.18.0/debian/modules/http-headers-more-filter --add-dynamic-module=/home/sa/nginx_build/nginx-1.18.0/debian/modules/http-auth-pam --add-dynamic-module=/home/sa/nginx_build/nginx-1.18.0/debian/modules/http-cache-purge --add-dynamic-module=/home/sa/nginx_build/nginx-1.18.0/debian/modules/http-dav-ext --add-dynamic-module=/home/sa/nginx_build/nginx-1.18.0/debian/modules/http-ndk --add-dynamic-module=/home/sa/nginx_build/nginx-1.18.0/debian/modules/http-echo --add-dynamic-module=/home/sa/nginx_build/nginx-1.18.0/debian/modules/http-fancyindex --add-dynamic-module=/home/sa/nginx_build/nginx-1.18.0/debian/modules/nchan --add-dynamic-module=/home/sa/nginx_build/nginx-1.18.0/debian/modules/rtmp --add-dynamic-module=/home/sa/nginx_build/nginx-1.18.0/debian/modules/http-uploadprogress --add-dynamic-module=/home/sa/nginx_build/nginx-1.18.0/debian/modules/http-upstream-fair --add-dynamic-module=/home/sa/nginx_build/nginx-1.18.0/debian/modules/http-subs-filter --add-dynamic-module=/home/sa/nginx_build/ngx_stream_socks_module

The nginx is built from the ubuntu official repo with

# get sources
$ apt-get source nginx

# add github.com/attenuation/ngx_stream_socks_module to configure
$ sed -i 's+/http-subs-filter+/http-subs-filter --add-dynamic-module=/home/sa/nginx_build/ngx_stream_socks_module+g' debian/rules

# build it
$ debian/rules build

# the result .so
$ ls -lah debian/build-extras/objs/ngx_stream_socks_module.so
-rwxrwxr-x 1 sa sa 124K Feb 28 03:34 debian/build-extras/objs/ngx_stream_socks_module.so

The ngx_stream_socks_module commit is used:

$ git log -1
commit acf31be0a046edf42518958b7a322e5367734761 (HEAD -> main, tag: 0.1.0, tag: 0.1, origin/main, origin/HEAD)
Author: Jun Ouyang <[email protected]>
Date:   Mon Jan 9 22:43:41 2023 +0800

    update readme
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant