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

mail/rspamd: Daemon sometimes doesn't start after reboot #466

Closed
mimugmail opened this issue Jan 4, 2018 · 34 comments
Closed

mail/rspamd: Daemon sometimes doesn't start after reboot #466

mimugmail opened this issue Jan 4, 2018 · 34 comments
Assignees
Labels
bug Production bug

Comments

@mimugmail
Copy link
Member

Hi,

this is the third time rspamd didn't start after a reboot. @fabianfrz did you experienced this too?

Seems to be something with the pid file:

2018-01-04 09:46:07 #86582(controller) rspamd_controller_on_terminate: closing rrd file: /var/db/rspamd/rspamd.rrd
2018-01-04 09:46:07 #84334(main) <ac2e90>; main; rspamd_term_handler: catch termination signal, waiting for children
2018-01-04 09:46:07 #86438(rspamd_proxy) <ac2e90>; main; rspamd_worker_term_handler: terminating after receiving signal Terminated
2018-01-04 09:46:07 #84334(main) <ac2e90>; main; wait_for_workers: hs_helper process 87334 terminated softly
2018-01-04 09:46:07 #84334(main) <ac2e90>; main; wait_for_workers: rspamd_proxy process 86438 terminated softly
2018-01-04 09:46:07 #84334(main) <ac2e90>; main; wait_for_workers: normal process 86929 terminated softly
2018-01-04 09:46:07 #84334(main) <ac2e90>; main; wait_for_workers: normal process 87155 terminated softly
2018-01-04 09:46:07 #84334(main) <ac2e90>; main; wait_for_workers: controller process 86582 terminated softly
2018-01-04 09:46:07 #84334(main) <ac2e90>; main; main: terminating...
2018-01-04 09:47:03 #41567(main) rspamd_regexp_library_init: pcre is compiled with JIT for x86 64bit (little endian + unaligned)
2018-01-04 09:47:03 #41567(main) <849ijo>; cfg; chartable_module_config: init internal chartable module
2018-01-04 09:47:03 #41567(main) <849ijo>; cfg; dkim_module_config: init internal dkim module
2018-01-04 09:47:03 #41567(main) <849ijo>; cfg; spf_module_config: init internal spf module
2018-01-04 09:47:03 #41567(main) <w4bd4g>; map; rspamd_map_add_from_ucl: added map from ucl
2018-01-04 09:47:03 #41567(main) <ttqirq>; map; rspamd_map_add_from_ucl: added map from ucl
2018-01-04 09:47:03 #41567(main) <849ijo>; cfg; surbl_module_config: init internal surbls module, 16 uribl rules loaded
2018-01-04 09:47:03 #41567(main) <849ijo>; cfg; regexp_module_config: init internal regexp module, 113 regexp rules and 0 lua rules are loaded
2018-01-04 09:47:03 #41567(main) <849ijo>; cfg; fuzzy_parse_rule: added fuzzy rule FUZZY_UNKNOWN, key: ef43ae80cc8d, shingles_key: ef43ae80cc8d, algorithm: mum
2018-01-04 09:47:03 #41567(main) <849ijo>; cfg; fuzzy_check_module_config: init internal fuzzy_check module, 1 rules loaded
2018-01-04 09:47:03 #41567(main) <849ijo>; cfg; rspamd_init_lua_filters: init lua module antivirus
2018-01-04 09:47:03 #41567(main) <849ijo>; cfg; rspamd_init_lua_filters: init lua module arc
2018-01-04 09:47:03 #41567(main) <849ijo>; cfg; rspamd_init_lua_filters: init lua module asn
2018-01-04 09:47:03 #41567(main) <849ijo>; cfg; rspamd_config_is_module_enabled: lua module bayes_expiry is enabled but has not been configured
2018-01-04 09:47:03 #41567(main) <849ijo>; cfg; rspamd_config_is_module_enabled: bayes_expiry disabling unconfigured lua module
2018-01-04 09:47:03 #41567(main) <849ijo>; lua; clickhouse.lua:639: no servers are specified, disabling module
2018-01-04 09:47:03 #41567(main) <849ijo>; cfg; rspamd_init_lua_filters: init lua module clickhouse
2018-01-04 09:47:03 #41567(main) lua; dcc.lua:142: DCC module not configured
2018-01-04 09:47:03 #41567(main) <849ijo>; cfg; rspamd_init_lua_filters: init lua module dcc
2018-01-04 09:47:03 #41567(main) <849ijo>; cfg; rspamd_init_lua_filters: init lua module dkim_signing
2018-01-04 09:47:03 #41567(main) <849ijo>; cfg; rspamd_init_lua_filters: init lua module dmarc
2018-01-04 09:47:03 #41567(main) <849ijo>; cfg; rspamd_config_is_module_enabled: lua module dynamic_conf is enabled but has not been configured
2018-01-04 09:47:03 #41567(main) <849ijo>; cfg; rspamd_config_is_module_enabled: dynamic_conf disabling unconfigured lua module
2018-01-04 09:47:03 #41567(main) <849ijo>; lua; emails.lua:174: add emails rule ebl.msbl.org
2018-01-04 09:47:03 #41567(main) <849ijo>; lua; emails.lua:174: add emails rule email.rspamd.com
2018-01-04 09:47:03 #41567(main) <849ijo>; cfg; rspamd_init_lua_filters: init lua module emails
2018-01-04 09:47:03 #41567(main) <849ijo>; cfg; rspamd_config_is_module_enabled: lua module fann_classifier is enabled but has not been configured
2018-01-04 09:47:03 #41567(main) <849ijo>; cfg; rspamd_config_is_module_enabled: fann_classifier disabling unconfigured lua module
2018-01-04 09:47:03 #41567(main) <849ijo>; lua; fann_redis.lua:864: Module is unconfigured
2018-01-04 09:47:03 #41567(main) <849ijo>; cfg; rspamd_init_lua_filters: init lua module fann_redis
2018-01-04 09:47:03 #41567(main) <849ijo>; cfg; rspamd_config_is_module_enabled: lua module fann_scores is enabled but has not been configured
2018-01-04 09:47:03 #41567(main) <849ijo>; cfg; rspamd_config_is_module_enabled: fann_scores disabling unconfigured lua module
2018-01-04 09:47:03 #41567(main) <849ijo>; cfg; rspamd_init_lua_filters: init lua module force_actions
2018-01-04 09:47:03 #41567(main) <849ijo>; cfg; rspamd_init_lua_filters: init lua module forged_recipients
2018-01-04 09:47:03 #41567(main) <849ijo>; cfg; rspamd_config_is_module_enabled: lua module fuzzy_collect is enabled but has not been configured
2018-01-04 09:47:03 #41567(main) <849ijo>; cfg; rspamd_config_is_module_enabled: fuzzy_collect disabling unconfigured lua module
2018-01-04 09:47:03 #41567(main) <849ijo>; cfg; rspamd_map_parse_backend: cannot open file '/usr/local/etc/rspamd/local.d/greylist-whitelist-domains.inc': Permission denied
2018-01-04 09:47:03 #41567(main) <849ijo>; cfg; rspamd_map_add_from_ucl: map has no urls to be loaded: empty list
2018-01-04 09:47:03 #41567(main) <849ijo>; lua; greylist.lua:428: no servers are specified, disabling module
2018-01-04 09:47:03 #41567(main) <849ijo>; cfg; rspamd_init_lua_filters: init lua module greylist
2018-01-04 09:47:03 #41567(main) <4dego7>; map; rspamd_map_add_from_ucl: added map from ucl
2018-01-04 09:47:03 #41567(main) <4dego7>; map; rspamd_map_add_from_ucl: added map from ucl
2018-01-04 09:47:03 #41567(main) <4dego7>; map; rspamd_map_add_from_ucl: added map from ucl
2018-01-04 09:47:03 #41567(main) <4dego7>; map; rspamd_map_add_from_ucl: added map from ucl
2018-01-04 09:47:03 #41567(main) <849ijo>; cfg; rspamd_init_lua_filters: init lua module hfilter
2018-01-04 09:47:03 #41567(main) <849ijo>; lua; history_redis.lua:218: no servers are specified, disabling module
2018-01-04 09:47:03 #41567(main) <849ijo>; cfg; rspamd_init_lua_filters: init lua module history_redis
2018-01-04 09:47:03 #41567(main) <849ijo>; lua; ip_score.lua:359: no servers are specified
2018-01-04 09:47:03 #41567(main) <849ijo>; cfg; rspamd_init_lua_filters: init lua module ip_score
2018-01-04 09:47:03 #41567(main) <849ijo>; cfg; rspamd_init_lua_filters: init lua module maillist
2018-01-04 09:47:03 #41567(main) <849ijo>; cfg; rspamd_init_lua_filters: init lua module metadata_exporter
2018-01-04 09:47:03 #41567(main) <849ijo>; cfg; rspamd_init_lua_filters: init lua module metric_exporter
2018-01-04 09:47:03 #41567(main) <849ijo>; cfg; rspamd_map_parse_backend: cannot open file '/usr/local/etc/rspamd/local.d/mid.inc': Permission denied
2018-01-04 09:47:03 #41567(main) <x4rkzq>; map; rspamd_map_add_from_ucl: added map from ucl
2018-01-04 09:47:03 #41567(main) <849ijo>; cfg; rspamd_init_lua_filters: init lua module mid
2018-01-04 09:47:03 #41567(main) <849ijo>; cfg; rspamd_init_lua_filters: init lua module milter_headers
2018-01-04 09:47:03 #41567(main) <849ijo>; cfg; rspamd_map_parse_backend: map '/var/db/rspamd/mime_types.inc.local' is not found, but it can be loaded automatically later
2018-01-04 09:47:03 #41567(main) <g9tfd6>; map; rspamd_map_add_from_ucl: added map from ucl
2018-01-04 09:47:03 #41567(main) <849ijo>; cfg; rspamd_init_lua_filters: init lua module mime_types
2018-01-04 09:47:03 #41567(main) <qwxppg>; map; rspamd_map_add: added map https://rspamd.com/freemail/free.txt.zst
2018-01-04 09:47:03 #41567(main) <qwxppg>; map; rspamd_map_add: added map https://rspamd.com/freemail/free.txt.zst
2018-01-04 09:47:03 #41567(main) <xa6qqy>; map; rspamd_map_add: added map https://rspamd.com/freemail/disposable.txt.zst
2018-01-04 09:47:03 #41567(main) <849ijo>; lua; multimap.lua:860: reuse url for DISPOSABLE_CC: "https://rspamd.com/freemail/disposable.txt.zst"
2018-01-04 09:47:03 #41567(main) <849ijo>; lua; multimap.lua:860: reuse url for DISPOSABLE_TO: "https://rspamd.com/freemail/disposable.txt.zst"
2018-01-04 09:47:03 #41567(main) <849ijo>; lua; multimap.lua:860: reuse url for DISPOSABLE_FROM: "https://rspamd.com/freemail/disposable.txt.zst"
2018-01-04 09:47:03 #41567(main) <849ijo>; lua; multimap.lua:860: reuse url for FREEMAIL_REPLYTO: "https://rspamd.com/freemail/free.txt.zst"
2018-01-04 09:47:03 #41567(main) <qwxppg>; map; rspamd_map_add: added map https://rspamd.com/freemail/free.txt.zst
2018-01-04 09:47:03 #41567(main) <qwxppg>; map; rspamd_map_add: added map https://rspamd.com/freemail/free.txt.zst
2018-01-04 09:47:03 #41567(main) <xa6qqy>; map; rspamd_map_add: added map https://rspamd.com/freemail/disposable.txt.zst
2018-01-04 09:47:03 #41567(main) <849ijo>; lua; multimap.lua:860: reuse url for FREEMAIL_CC: "https://rspamd.com/freemail/free.txt.zst"
2018-01-04 09:47:03 #41567(main) <xa6qqy>; map; rspamd_map_add: added map https://rspamd.com/freemail/disposable.txt.zst
2018-01-04 09:47:03 #41567(main) <849ijo>; cfg; rspamd_init_lua_filters: init lua module multimap
2018-01-04 09:47:03 #41567(main) <849ijo>; cfg; rspamd_config_is_module_enabled: lua module mx_check is disabled in the configuration
2018-01-04 09:47:03 #41567(main) <849ijo>; cfg; rspamd_init_lua_filters: init lua module once_received
2018-01-04 09:47:03 #41567(main) <uy18in>; map; rspamd_map_add: added map /usr/local/etc/rspamd/redirectors.inc
2018-01-04 09:47:03 #41567(main) <849ijo>; cfg; rspamd_map_parse_backend: cannot open file '/usr/local/etc/rspamd/local.d/redirectors.inc': Permission denied
2018-01-04 09:47:03 #41567(main) <849ijo>; lua; phishing.lua:239: cannot add map: /usr/local/etc/rspamd/local.d/redirectors.inc for symbol: LOCAL_REDIRECTOR_FALSE
2018-01-04 09:47:03 #41567(main) <849ijo>; cfg; rspamd_init_lua_filters: init lua module phishing
2018-01-04 09:47:03 #41567(main) <849ijo>; lua; ratelimit.lua:628: enabled rate buckets: []
2018-01-04 09:47:03 #41567(main) <849ijo>; lua; ratelimit.lua:681: no servers are specified, disabling module
2018-01-04 09:47:03 #41567(main) <849ijo>; cfg; rspamd_init_lua_filters: init lua module ratelimit
2018-01-04 09:47:03 #41567(main) <849ijo>; cfg; rspamd_init_lua_filters: init lua module rbl
2018-01-04 09:47:03 #41567(main) <849ijo>; lua; replies.lua:127: no servers are specified, disabling module
2018-01-04 09:47:03 #41567(main) <849ijo>; cfg; rspamd_init_lua_filters: init lua module replies
2018-01-04 09:47:03 #41567(main) <849ijo>; cfg; rspamd_init_lua_filters: init lua module rspamd_update
2018-01-04 09:47:03 #41567(main) <849ijo>; cfg; rspamd_init_lua_filters: init lua module settings
2018-01-04 09:47:03 #41567(main) <849ijo>; cfg; rspamd_init_lua_filters: init lua module spamassassin
2018-01-04 09:47:03 #41567(main) <849ijo>; cfg; rspamd_config_is_module_enabled: lua module spamtrap is disabled in the configuration
2018-01-04 09:47:03 #41567(main) <849ijo>; lua; trie.lua:165: no tries defined
2018-01-04 09:47:03 #41567(main) <849ijo>; cfg; rspamd_init_lua_filters: init lua module trie
2018-01-04 09:47:03 #41567(main) <849ijo>; lua; url_redirector.lua:273: no servers are specified, disabling module
2018-01-04 09:47:03 #41567(main) <849ijo>; cfg; rspamd_init_lua_filters: init lua module url_redirector
2018-01-04 09:47:03 #41567(main) <849ijo>; cfg; rspamd_config_is_module_enabled: lua module url_reputation is disabled in the configuration
2018-01-04 09:47:03 #41567(main) <849ijo>; cfg; rspamd_config_is_module_enabled: lua module url_tags is disabled in the configuration
2018-01-04 09:47:03 #41567(main) <849ijo>; cfg; rspamd_map_parse_backend: map '/var/db/rspamd/dmarc_whitelist.inc.local' is not found, but it can be loaded automatically later
2018-01-04 09:47:03 #41567(main) <87rxcr>; map; rspamd_map_add_from_ucl: added map from ucl
2018-01-04 09:47:03 #41567(main) <849ijo>; cfg; rspamd_map_parse_backend: map '/var/db/rspamd/spf_dkim_whitelist.inc.local' is not found, but it can be loaded automatically later
2018-01-04 09:47:03 #41567(main) <4b9dnq>; map; rspamd_map_add_from_ucl: added map from ucl
2018-01-04 09:47:03 #41567(main) <849ijo>; cfg; rspamd_map_parse_backend: map '/usr/local/etc/rspamd/dkim_whitelist.inc' is not found, but it can be loaded automatically later
2018-01-04 09:47:03 #41567(main) <849ijo>; cfg; rspamd_map_parse_backend: map '/var/db/rspamd/dkim_whitelist.inc.local' is not found, but it can be loaded automatically later
2018-01-04 09:47:03 #41567(main) <xqwnbp>; map; rspamd_map_add_from_ucl: added map from ucl
2018-01-04 09:47:03 #41567(main) <849ijo>; cfg; rspamd_map_parse_backend: map '/usr/local/etc/rspamd/spf_whitelist.inc' is not found, but it can be loaded automatically later
2018-01-04 09:47:03 #41567(main) <849ijo>; cfg; rspamd_map_parse_backend: map '/var/db/rspamd/spf_whitelist.inc.local' is not found, but it can be loaded automatically later
2018-01-04 09:47:03 #41567(main) <iwso89>; map; rspamd_map_add_from_ucl: added map from ucl
2018-01-04 09:47:03 #41567(main) <849ijo>; cfg; rspamd_init_lua_filters: init lua module whitelist
2018-01-04 09:47:03 #41567(main) <849ijo>; cfg; rspamd_map_parse_backend: map '/var/db/rspamd/rspamd_dynamic' is not found, but it can be loaded automatically later
2018-01-04 09:47:03 #41567(main) <ykjbdn>; map; rspamd_map_add: added map /var/db/rspamd/rspamd_dynamic
2018-01-04 09:47:03 #41567(main) <5462bf>; re_cache; rspamd_re_cache_init: loaded hyperscan engine witch cpu tune 'generic' and features ''
2018-01-04 09:47:03 #41567(main) <1b9028>; main; main: rspamd 1.6.5 is starting, build id: release
2018-01-04 09:47:03 #41567(main) <1b9028>; main; main: cpu features: avx, sse2, sse3, ssse3, sse4.1, sse4.2, rdrand
2018-01-04 09:47:03 #41567(main) <1b9028>; main; main: cryptobox configuration: curve25519(avx), chacha20(avx), poly1305(avx), siphash(generic), blake2(avx), base64(ref)
2018-01-04 09:47:03 #41567(main) <1b9028>; main; main: cannot write pid file /var/run/rspamd/rspamd.pid

@fabianfrz
Copy link
Member

fabianfrz commented Jan 4, 2018

@mimugmail no I did not - but from the line 2018-01-04 09:47:03 #41567(main) <1b9028>; main; main: cannot write pid file /var/run/rspamd/rspamd.pid I would expect that the directory /var/run/rspamd does not exist. That also means that your setup.sh may not have been executed. The only alternative is your disk is full.

@fichtner
Copy link
Member

fichtner commented Jan 4, 2018

setup.sh handling could be a bit unstable depending on which plugin branch and core branch you are using... _opnsense_bootup_run= was renamed to _var_script=

@mimugmail
Copy link
Member Author

yeah, I'm running on 18.1_r2.
Now with latest 18.1 it's reproduceable with every reboot.

Script is there and executable but /var/run/rspamd doesn't exist.

@fabianfrz
Copy link
Member

could be the reason because I am on 17.7.11 stable so I do not have the renaming changes in the VM

@fichtner fichtner self-assigned this Jan 11, 2018
@fichtner fichtner added the bug Production bug label Jan 11, 2018
@fichtner
Copy link
Member

Not entirely sure this is the same issue as #276 ?

@fabianfrz
Copy link
Member

fabianfrz commented Jan 11, 2018

@fichtner probably not, this is because the preparation script (setup.sh) is not called on @mimugmail machine for some reason. I never had this issue on stable 17.7.

@fichtner
Copy link
Member

Okay, waiting for a clean test on a 18.1-RC1...

@fabianfrz
Copy link
Member

fabianfrz commented Jan 11, 2018

@fichtner I think you broke something on 18.1:
screenshot_20180111_183826

This I a fresh installed image of OPNsense and the only thing that happend is the installation of rspamd.

@mimugmail
Copy link
Member Author

For me it's only the call of setup.sh at bootup. When starting manually it works. Switch back from 18.1.r_2 to 17.7 fix this. I can test latest patch when the kids sleep :)

@fabianfrz
Copy link
Member

@mimugmail this is the fresh image, not an updated version - just FYI. Those images were released yesterday. This screenshot is made on VirtualBox.

@fichtner
Copy link
Member

and if you try the old package?

# pkg add -f https://pkg.opnsense.org/FreeBSD:11:amd64/17.7/latest/All/rspamd-1.6.5_1.txz

@fabianfrz
Copy link
Member

same result...
screenshot_20180111_191242

@fichtner
Copy link
Member

funny, where should that come from then?

@fabianfrz
Copy link
Member

@fichtner did @lattera something with the new kernel or ports options?

@fabianfrz
Copy link
Member

@fichtner manual start shows the issue: it is a PAX issue:
screenshot_20180111_191856

@lattera
Copy link

lattera commented Jan 11, 2018

Looks like rspamd is crashing repeatedly, causing SEGVGUARD to fire. We need to figure out why rspamd is segfaulting.

@fichtner
Copy link
Member

no that's because it crashed before.

there are no changes in the ports if both 18.1 and 17.7 version segfaults.... only leaves the kernel or the base system

@fichtner
Copy link
Member

fichtner commented Jan 11, 2018

@lattera it's the kernel :/

17.7.10 kernel works fine

@lattera
Copy link

lattera commented Jan 11, 2018

@fichtner, what in the kernel is causing the segfault? Is there a mismerge somewhere?

@fichtner
Copy link
Member

I do not know. I just switched the kernel to the older version on the 18.1 VM. no changes to rspamd package or base system binaries.

@fabianfrz
Copy link
Member

@fichtner how should I handle the issue now. At the moment the only reasonable action can be holding back rspamd or the FreeBSD 11.1 kernel...

@fichtner
Copy link
Member

you can help debug the kernel :P

@fabianfrz
Copy link
Member

@fichtner did never debug a FreeBSD kernel - until I find out the place to start it will be too late ;)

@fichtner
Copy link
Member

@fabianfrz for now sit back and relax :)

@mimugmail
Copy link
Member Author

mimugmail commented Jan 12, 2018 via email

@fichtner
Copy link
Member

make sure to test with the 11.0 kernel (17.7-based) for now 👍

@lattera
Copy link

lattera commented Jan 12, 2018

I found the issue: rspamd calls mmap(MAP_32BIT), which was allowed in the 17.x kernel, but disallowed now in the 18.1 kernel. The output from truss is here: https://gist.github.com/135d5b5420ddca3966180bb2061f4394

Until I come up with a permanent fix, I'm going to drop the feature that disallows calls to mmap with the MAP_32BIT flag set. From the perspective of 17.x to 18.x, we're not losing anything by dropping the feature.

This will give me a good excuse to finally integrate exploit mitigation toggling directly into pkg. Note that this particular feature (the pkg integration) will take a while to implement (maybe for 18.7).

@lattera
Copy link

lattera commented Jan 12, 2018

More info:

Turns out that rspamd itself isn't calling mmap(2) with the MAP_32BIT flag, but LuaJIT is. rspamd depends on LuaJIT.

Even on 64-bit systems, LuaJIT uses 32-bit pointers. They enforce 32-bit pointers by passing in the MAP_32BIT flag to mmap(2).

In OPNsense 17.x, we didn't enable the HardenedBSD feature that disallows MAP_32BIT. Thus, LuaJIT worked fine. We enabled the feature in 18.1, which is why the LuaJIT implementation within rspamd crashes.

@lattera
Copy link

lattera commented Jan 12, 2018

So, what I'm going to do is:

In OPNsense: hardening.pax.disallow_map32bit.status will default to 1 (application must opt in). Advanced users who also don't need rspamd can set it to 2 (application must opt out) via a tunable.

In the meantime, you can work around this by setting the hardening.pax.disallow_map32bit.status tunable to 1 via /boot/loader.conf.local.

For example, login via ssh and run the following command (as root):

echo 'hardening.pax.disallow_map32bit.status="1"' >> /boot/loader.conf.local

lattera added a commit to opnsense/src that referenced this issue Jan 12, 2018
LuaJIT creates 32-bit memory maps in a 64-bit execution environment,
which is disabled by default in HardenedBSD. We never ported the
MAP_32BIT disallow logic over from HardenedBSD to OPNsense prior to
18.1. The merge of HardenedBSD's ASLR implementation for 18.1 also
brought in the new logic.

Instead of removing disallow_map32bit, simply set it to 1 by default.
This will allow those who don't use LuaJIT applications to set it to 2
in /boot/loader.conf.local.

Note that this commit is specific to OPNsense. OPNsense ships without
the PAX_SYSCTLS kernel option, thus it's impossible to toggle via
sysctl.conf(5) and must be set via loader.conf.local.

Signed-off-by:	Shawn Webb <shawn@opnsense.org>
github-issue:	opnsense/plugins#466
lattera added a commit to opnsense/src that referenced this issue Jan 12, 2018
LuaJIT creates 32-bit memory maps in a 64-bit execution environment,
which is disabled by default in HardenedBSD. We never ported the
MAP_32BIT disallow logic over from HardenedBSD to OPNsense prior to
18.1. The merge of HardenedBSD's ASLR implementation for 18.1 also
brought in the new logic.

Instead of removing disallow_map32bit, simply set it to 1 by default.
This will allow those who don't use LuaJIT applications to set it to 2
in /boot/loader.conf.local.

Note that this commit is specific to OPNsense. OPNsense ships without
the PAX_SYSCTLS kernel option, thus it's impossible to toggle via
sysctl.conf(5) and must be set via loader.conf.local.

Signed-off-by:	Shawn Webb <shawn@opnsense.org>
github-issue:	opnsense/plugins#466
(cherry picked from commit 5a1bbae)
@lattera
Copy link

lattera commented Jan 12, 2018

@fichtner, I'm not sure how you want to handle this. Now that the commit has been made, we should push out a new kernel. Then users can retest and report. If the retest is successful, we can close this ticket.

@fichtner
Copy link
Member

@lattera means we have a workaround and a sticky solution. How about we land this commit with the final 18.1 images and go with the workaround for 18.1-RC2?

So far rspamd/luajit is the only report of this failing. And it's a security feature after all.

fichtner added a commit to opnsense/core that referenced this issue Jan 12, 2018
@fabianfrz
Copy link
Member

@fichtner be careful, haproxy is also including lua.

@fichtner
Copy link
Member

on RC2 + reboot it will work with the RC1 kernel...

@fichtner
Copy link
Member

Fixed a long time ago :)

fichtner pushed a commit to opnsense/src that referenced this issue Oct 7, 2018
LuaJIT creates 32-bit memory maps in a 64-bit execution environment,
which is disabled by default in HardenedBSD. We never ported the
MAP_32BIT disallow logic over from HardenedBSD to OPNsense prior to
18.1. The merge of HardenedBSD's ASLR implementation for 18.1 also
brought in the new logic.

Instead of removing disallow_map32bit, simply set it to 1 by default.
This will allow those who don't use LuaJIT applications to set it to 2
in /boot/loader.conf.local.

Note that this commit is specific to OPNsense. OPNsense ships without
the PAX_SYSCTLS kernel option, thus it's impossible to toggle via
sysctl.conf(5) and must be set via loader.conf.local.

Signed-off-by:	Shawn Webb <shawn@opnsense.org>
github-issue:	opnsense/plugins#466
fichtner pushed a commit to opnsense/src that referenced this issue Dec 9, 2019
LuaJIT creates 32-bit memory maps in a 64-bit execution environment,
which is disabled by default in HardenedBSD. We never ported the
MAP_32BIT disallow logic over from HardenedBSD to OPNsense prior to
18.1. The merge of HardenedBSD's ASLR implementation for 18.1 also
brought in the new logic.

Instead of removing disallow_map32bit, simply set it to 1 by default.
This will allow those who don't use LuaJIT applications to set it to 2
in /boot/loader.conf.local.

Note that this commit is specific to OPNsense. OPNsense ships without
the PAX_SYSCTLS kernel option, thus it's impossible to toggle via
sysctl.conf(5) and must be set via loader.conf.local.

Signed-off-by:	Shawn Webb <shawn@opnsense.org>
github-issue:	opnsense/plugins#466
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Production bug
Development

No branches or pull requests

4 participants