How to Run Systemd with Asan(Address Sanitizer) - systemd

When I use asan to compile the rpm package of systemd:
Add the following information to the systemd.spec file:
export CFLAGS="$RPM_OPT_FLAGS"
export LDFLAGS=$RPM_LD_FLAGS
CFLAGS="$CFLAGS -fsanitize=address
-fno-omit-frame-pointer-fsanitize-recover=address"
LDFLAGS="$LDFLAGS -fsanitize=address
-fno-omit-frame-pointer-fsanitize-recover=address"
Run the rpmbuild -ba command to generate RPM packages.
Then use the rpm to upgrade the system:rpm -Uvh systemd*.rpm
However, the system fails to be started:
Failed to start Load/Save Random Seed.
Some failed services will prompt such as:
systemd[1]: Starting Load/Save Random Seed...
systemd-random-seed[2939]: ==2939==Can't open /proc/2457614/task for
reading. systemd-random-seed[2939]: ==2939==LeakSanitizer has
encountered a fatal error. systemd-random-seed[2939]: ==2939==HINT:
For debugging, try setting environment variable
LSAN_OPTIONS=verbosity=1:log_threads=1 systemd-random-seed[2939]:
==2939==HINT: LeakSanitizer does not work under ptrace (strace, gdb, etc) systemd[1]: Failed to start Load/Save Random Seed.
By the way, when I enter emergency mode and execute __lsan_do_recoverable_leak_check in systemd, systemd exits.
How to Run Systemd with Asan (Address Sanitizer)?

Related

Problems using ganache-cli command

It's saying that it doesn't recognize ganache-cli as a command, despite installing it and everything else as directed.
Using:
brownie v1.17.2
node v17.2.0 (npm v8.1.4)
nvm 0.39.0
Python 3.9.7
Ganache CLI v6.12.2 (ganache-core: 2.13.2)
As part of the Solidity course here, specifically lesson 5. Github repo here.
x#y brownie_simple_storage % brownie run scripts/deploy.py
Brownie v1.17.2 - Python development framework for Ethereum
BrownieSimpleStorageProject is the active project.
Launching 'ganache-cli --port 8545 --gasLimit 12000000 --accounts 10 --hardfork istanbul --mnemonic brownie'...
File "brownie/_cli/__main__.py", line 64, in main
importlib.import_module(f"brownie._cli.{cmd}").main()
File "brownie/_cli/run.py", line 44, in main
network.connect(CONFIG.argv["network"])
File "brownie/network/main.py", line 50, in connect
rpc.launch(active["cmd"], **active["cmd_settings"])
File "brownie/network/rpc/__init__.py", line 93, in launch
raise RPCProcessError(cmd, uri)
RPCProcessError: Unable to launch local RPC client.
Command: ganache-cli
URI: http://127.0.0.1:8545
Looks like this can be resolved using nvm v 16.
nvm install 16
nvm use 16
node --version
v16.13.1
x#y brownie_simple_storage % brownie run scripts/deploy.py
Brownie v1.17.2 - Python development framework for Ethereum
BrownieSimpleStorageProject is the active project.
Launching 'ganache-cli --port 8545 --gasLimit 12000000 --accounts 10 --hardfork istanbul --mnemonic brownie'...
Running 'scripts/deploy.py::main'...
Hello!
Terminating local RPC client...
Most likely the issue you're dealing with is because ganache is already running in another active project, in order to have brownie recognize ganache is to make sure that's the only environment running ganache close to the project running the node. Which, is most likely the web3 simple storage file... not the newly created brownie file.

What does "Failed to execute /init (error -7)" mean?

Linux kernel version: 4.18.0-17
I am porting some 4.15 kernel customizations to 4.18, but my 4.18 kernel does not boot. A stock 4.18 kernel (i.e. the starting point before merging the 4.15 modifications) boots and runs.
The error message is:
Failed to execute /init (error -7)
Starting init: /bin/sh exists but couldn't execute it (error -7)
"errno 7" is "E2BIG 7 Argument list too long"
What does that mean in the context of the kernel starting the init process?
If the kernel command line and root file systems is exactly the same as the one you are giving to the kernel version that does boot than the most likely cause is that get_user_pages_remote() is failing here: https://elixir.bootlin.com/linux/v4.18/source/fs/exec.c#L194
Which would imply one of your changes broke memory management.
To get here, just track from try_to_run_init_process() which runs init to all the functions called from it which can return E2BIG. This is the only call site that does not depend on init argument list or environment size - https://elixir.bootlin.com/linux/v4.18/source/init/main.c#L1001
Having said that, I would first make VERY sure that the kernel command line and root file system are the same.

Thread 'main' panicked at 'could not initialize thread_rng: All entropy sources failed

After running a cross-compiled Rust ARM binary on a Raspberry Pi Zero for a few hours, the process panics with the following error:
1 Feb 02 12:03:17 raspberrypi monitoring-service[339]: thread 'main'
panicked at 'could not initialize thread_rng: All entropy sources failed (permanently unavailable); cause: getrandom not ready (not ready
yet); cause: Resource temporarily unavailable (os error 11)', /root/.cargo/registry/src/github.com-1ecc6299db9ec823/rand-0.6.1/src/rngs/thread.rs:82:17
systemd tried to restart the process, but it failed with the same error several times. The next day I was able to manually restart it, but countdown to when it fails again.
I suspect this is caused by the ws websocket crate indirectly using the rand v0.6.1 crate, but I'm not sure.
Is there a way to force these packages to use a newer version of the rand crate, or do I need to tweak an OS setting on Raspbian? I'm running Raspbian Stretch (v9), kernel v4.14.79+. As an internal monitoring tool, my application requires no encryption or privacy so ideally I can get around the entropy issue.

Install Logstash error Errno::ENOMEM Duplicate

i am trying to install elasticsearch with logstash for every mysql action.
i stuck when trying to install logstash .
heres my command.
[root#centos-elasticsearch tampung]# rpm -ivh logstash-6.5.2.rpm
Preparing... ################################# [100%]
Updating / installing...
1:logstash-1:6.5.2-1 ################################# [100%]
Using provided startup.options file: /etc/logstash/startup.options
OpenJDK 64-Bit Server VM warning: If the number of processors is expected to increase from one, then you should configure the number of parallel GC threads appropriately using -XX:ParallelGCThreads=N
Errno::ENOMEM: Cannot allocate memory - systemctl
spawn at org/jruby/RubyProcess.java:1566
spawn at org/jruby/RubyKernel.java:1511
popen_run at /usr/share/logstash/vendor/jruby/lib/ruby/stdlib/open3.rb:206
popen3 at /usr/share/logstash/vendor/jruby/lib/ruby/stdlib/open3.rb:102
execute at /usr/share/logstash/vendor/bundle/jruby/2.3.0/gems/pleaserun-0.0.30/lib/pleaserun/detector.rb:74
detect_systemd at /usr/share/logstash/vendor/bundle/jruby/2.3.0/gems/pleaserun-0.0.30/lib/pleaserun/detector.rb:29
detect_platform at /usr/share/logstash/vendor/bundle/jruby/2.3.0/gems/pleaserun-0.0.30/lib/pleaserun/detector.rb:24
detect at /usr/share/logstash/vendor/bundle/jruby/2.3.0/gems/pleaserun-0.0.30/lib/pleaserun/detector.rb:18
setup_defaults at /usr/share/logstash/vendor/bundle/jruby/2.3.0/gems/pleaserun-0.0.30/lib/pleaserun/cli.rb:153
execute at /usr/share/logstash/vendor/bundle/jruby/2.3.0/gems/pleaserun-0.0.30/lib/pleaserun/cli.rb:119
run at /usr/share/logstash/vendor/bundle/jruby/2.3.0/gems/clamp-0.6.5/lib/clamp/command.rb:67
run at /usr/share/logstash/vendor/bundle/jruby/2.3.0/gems/pleaserun-0.0.30/lib/pleaserun/cli.rb:114
run at /usr/share/logstash/vendor/bundle/jruby/2.3.0/gems/clamp-0.6.5/lib/clamp/command.rb:132
<main> at /usr/share/logstash/lib/systeminstall/pleasewrap.rb:12
Unable to install system startup script for Logstash.
anyone know what must i do?
i tried to remove logstash,and reinstall.
but still not success.
i tried to upgrade memory..
after that i tried to reinstall again
and i get this.
Updating / installing...
1:logstash-1:6.5.2-1 ################################# [100%]
Using provided startup.options file: /etc/logstash/startup.options
Errno::EISDIR: Is a directory - /etc/default/logstash
write at org/jruby/RubyIO.java:3622
write at /usr/share/logstash/vendor/bundle/jruby/2.3.0/gems/pleaserun-0.0.30/lib/pleaserun/installer.rb:32
block in install_files at /usr/share/logstash/vendor/bundle/jruby/2.3.0/gems/pleaserun-0.0.30/lib/pleaserun/installer.rb:23
yield at org/jruby/RubyYielder.java:102
block in files at /usr/share/logstash/vendor/bundle/jruby/2.3.0/gems/pleaserun-0.0.30/lib/pleaserun/platform/systemd.rb:24
each at org/jruby/RubyGenerator.java:99
install_files at /usr/share/logstash/vendor/bundle/jruby/2.3.0/gems/pleaserun-0.0.30/lib/pleaserun/installer.rb:18
run_human at /usr/share/logstash/vendor/bundle/jruby/2.3.0/gems/pleaserun-0.0.30/lib/pleaserun/cli.rb:185
execute at /usr/share/logstash/vendor/bundle/jruby/2.3.0/gems/pleaserun-0.0.30/lib/pleaserun/cli.rb:141
run at /usr/share/logstash/vendor/bundle/jruby/2.3.0/gems/clamp-0.6.5/lib/clamp/command.rb:67
run at /usr/share/logstash/vendor/bundle/jruby/2.3.0/gems/pleaserun-0.0.30/lib/pleaserun/cli.rb:114
run at /usr/share/logstash/vendor/bundle/jruby/2.3.0/gems/clamp-0.6.5/lib/clamp/command.rb:132
<main> at /usr/share/logstash/lib/systeminstall/pleasewrap.rb:12
{:timestamp=>"2018-12-07T07:44:13.341202+0000", :message=>"No platform selected. Autodetecting...", :platform=>"systemd", :version=>"219", :level=>:warn}
{:timestamp=>"2018-12-07T07:44:13.411454+0000", :message=>"Writing file", :destination=>"/etc/default/logstash"}
Unable to install system startup script for Logstash.
As I already wrote in my previous comment, the first error
Errno::ENOMEM: Cannot allocate memory
means that your system is low of phisical memory.
The second one
Errno::EISDIR: Is a directory
means that the file is a directory; and that you cannot open a directory for writing, or create or remove hard links to it.

Errors when generating mixed mode Flame Graphs

I'm trying to generate some mixed mode flame graphs on a Linux machine (CentOS 7) and running into some issues.
I'm following instructions from this link: https://www.slideshare.net/brendangregg/java-performance-analysis-on-linux-with-flame-graphs (starting from slide 47).
when I run the below command to collect perf data:
perf record -F 997 -a -g --sleep <time in seconds>; jmaps
It seems to generate perf.data with no errors. However, when I try to process the perf.data by running the below command,
perf script --input=perf.data > out.stacks01
it shows me below messages:
/tmp/libnetty-transport-native-epoll6943913993058681852.so was updated (is prelink enabled?). Restart the long running apps that use it!
corrupted callchain, skipping
Does anyone have any idea what these messages mean?

Resources