openresty/openresty-systemtap-toolkit

ngx-phase-handlers: semantic errors

trimstray opened this issue · 0 comments

./ngx-phase-handlers -p 15471
WARNING: Bad $context variable being substituted with literal 0: identifier '$r' at <input>:22:16
 source:         cmcf = $r->main_conf[ctx_index]
                        ^
semantic error: while processing function print_phase

semantic error: type definition 'ngx_http_core_main_conf_t' not found in '/usr/sbin/nginx': operator '@cast' at :6:9
        source:     n = @cast(cmcf, "ngx_http_core_main_conf_t", "/usr/sbin/nginx")->phases[phase_num]->handlers->nelts
                        ^

Pass 2: analysis failed.  [man error::pass2]
Number of similar warning messages suppressed: 2.
Rerun with -v to see them.

NGINX (OpenResty)

nginx -V
nginx version: openresty/1.15.8.1
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-36) (GCC) 
built with OpenSSL 1.1.1b  26 Feb 2019
TLS SNI support enabled
configure arguments: --prefix=/etc/nginx/nginx --with-debug --with-cc-opt='-DNGX_LUA_USE_ASSERT -DNGX_LUA_ABORT_AT_PANIC -O2 -I/usr/local/include -m64 -march=native -DTCP_FASTOPEN=23 -fstack-protector-strong -flto -fuse-ld=gold --param=ssp-buffer-size=4 -Wformat -Werror=format-security -Wp,-Wno-deprecated-declarations -gsplit-dwarf -O0 -g' --add-module=../ngx_devel_kit-0.3.1rc1 --add-module=../echo-nginx-module-0.61 --add-module=../xss-nginx-module-0.06 --add-module=../ngx_coolkit-0.2 --add-module=../set-misc-nginx-module-0.32 --add-module=../form-input-nginx-module-0.12 --add-module=../encrypted-session-nginx-module-0.08 --add-module=../srcache-nginx-module-0.31 --add-module=../ngx_lua-0.10.15 --add-module=../ngx_lua_upstream-0.07 --add-module=../headers-more-nginx-module-0.33 --add-module=../array-var-nginx-module-0.05 --add-module=../memc-nginx-module-0.19 --add-module=../ngx_stream_lua-0.0.7 --with-ld-opt='-Wl,-rpath,/etc/nginx/luajit/lib -L/usr/local/lib -ljemalloc -Wl,-lpcre -Wl,-z,relro -Wl,-rpath,/usr/local/lib' --conf-path=/etc/nginx/nginx.conf --sbin-path=/usr/sbin/nginx --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --user=nginx --group=nginx --modules-path=/etc/nginx/modules --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --with-compat --with-file-aio --with-threads --with-stream --with-stream_geoip_module --with-stream_realip_module --with-stream_ssl_module --with-stream_ssl_preread_module --with-http_addition_module --with-http_auth_request_module --with-http_degradation_module --with-http_geoip_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_image_filter_module --with-http_perl_module --with-http_random_index_module --with-http_realip_module --with-http_secure_link_module --with-http_slice_module --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-google_perftools_module --with-openssl=/usr/local/src/openssl-1.1.1b --with-openssl-opt= --with-pcre=/usr/local/src/pcre-8.42 --with-pcre-jit --with-zlib=/usr/local/src/zlib --without-http-cache --without-http_memcached_module --without-mail_pop3_module --without-mail_imap_module --without-mail_smtp_module --without-http_fastcgi_module --without-http_scgi_module --without-http_uwsgi_module --add-module=/usr/local/src/openresty-1.15.8.1/modules/nginx-access-plus/src/c --add-module=/usr/local/src/openresty-1.15.8.1/modules/ngx_http_substitutions_filter_module --add-module=/usr/local/src/openresty-1.15.8.1/modules/nginx-module-vts --add-module=/usr/local/src/openresty-1.15.8.1/modules/ngx_brotli --add-module=/usr/local/src/openresty-1.15.8.1/modules/tengine/modules/ngx_backtrace_module --add-module=/usr/local/src/openresty-1.15.8.1/modules/tengine/modules/ngx_debug_pool --add-module=/usr/local/src/openresty-1.15.8.1/modules/tengine/modules/ngx_debug_timer --add-module=/usr/local/src/openresty-1.15.8.1/modules/tengine/modules/ngx_http_footer_filter_module --add-module=/usr/local/src/openresty-1.15.8.1/modules/tengine/modules/ngx_http_upstream_check_module --add-module=/usr/local/src/openresty-1.15.8.1/modules/tengine/modules/ngx_slab_stat --add-dynamic-module=/usr/local/src/openresty-1.15.8.1/modules/replace-filter-nginx-module --add-dynamic-module=/usr/local/src/openresty-1.15.8.1/modules/nginx-module-sysguard --add-dynamic-module=/usr/local/src/openresty-1.15.8.1/modules/delay-module --add-dynamic-module=/usr/local/src/openresty-1.15.8.1/modules/naxsi/naxsi_src --with-stream --with-stream_ssl_preread_module

I also got above error when I install openresty from repository (also with debuginfo).

SystemTap

stap -V
Systemtap translator/driver (version 3.3/0.172, rpm 3.3-3.el7)
Copyright (C) 2005-2018 Red Hat, Inc. and others
This is free software; see the source for copying conditions.
tested kernel versions: 2.6.18 ... 4.18-rc0
enabled features: AVAHI BOOST_STRING_REF DYNINST BPF JAVA PYTHON2 LIBRPM LIBSQLITE3 LIBVIRT LIBXML2 NLS NSS READLINE

yum list installed | grep systemtap
systemtap.x86_64                      3.3-3.el7                        @base    
systemtap-client.x86_64               3.3-3.el7                        @base    
systemtap-debuginfo.x86_64            3.3-3.el7                        @base-debuginfo
systemtap-devel.x86_64                3.3-3.el7                        @base    
systemtap-runtime.x86_64              3.3-3.el7                        @base    
systemtap-sdt-devel.x86_64            3.3-3.el7                        @base
stap -v -e 'probe vfs.read {printf("read performed\n"); exit()}'
Pass 1: parsed user script and 471 library scripts using 244732virt/42108res/3404shr/38784data kb, in 510usr/20sys/540real ms.
Pass 2: analyzed script: 1 probe, 1 function, 7 embeds, 0 globals using 409388virt/202680res/4780shr/203440data kb, in 2240usr/690sys/2935real ms.
Pass 3: using cached /root/.systemtap/cache/e4/stap_e45fd5c1be9d7d4265b0a5d7715abd81_2798.c
Pass 4: using cached /root/.systemtap/cache/e4/stap_e45fd5c1be9d7d4265b0a5d7715abd81_2798.ko
Pass 5: starting run.
read performed
Pass 5: run completed in 0usr/40sys/355real ms.

stap -v -e 'probe begin { printf("Hello, World!\n"); exit() }'
Pass 1: parsed user script and 471 library scripts using 244732virt/42108res/3404shr/38784data kb, in 490usr/40sys/527real ms.
Pass 2: analyzed script: 1 probe, 1 function, 0 embeds, 0 globals using 245656virt/43160res/3584shr/39708data kb, in 10usr/0sys/6real ms.
Pass 3: translated to C into "/tmp/stapq6ugZ8/stap_def2fb32f921d0e44b59969edc96c223_1013_src.c" using 245656virt/43724res/4108shr/39708data kb, in 0usr/0sys/0real ms.
Pass 4: compiled C into "stap_def2fb32f921d0e44b59969edc96c223_1013.ko" in 1550usr/670sys/2006real ms.
Pass 5: starting run.
Hello, World!
Pass 5: run completed in 10usr/30sys/342real ms.

System info

Linux 3.10.0-957.21.3.el7.x86_64 #1 SMP Tue Jun 18 16:35:19 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

yum list installed | grep kernel
kernel.x86_64                         3.10.0-862.el7                   @anaconda
kernel.x86_64                         3.10.0-957.21.3.el7              @updates 
kernel-debuginfo.x86_64               3.10.0-957.21.3.el7              @base-debuginfo
kernel-debuginfo-common-x86_64.x86_64 3.10.0-957.21.3.el7              @base-debuginfo
kernel-devel.x86_64                   3.10.0-957.21.3.el7              @updates 
kernel-headers.x86_64                 3.10.0-957.21.3.el7              @updates 
kernel-tools.x86_64                   3.10.0-957.21.3.el7              @updates 
kernel-tools-libs.x86_64              3.10.0-957.21.3.el7              @updates