https://bugs.kde.org/show_bug.cgi?id=431829

            Bug ID: 431829
           Summary: valgrind: the 'impossible' happened: Unsupported
                    arch_prctl option when executing valgrind
           Product: valgrind
           Version: 3.14 SVN
          Platform: Ubuntu Packages
                OS: Microsoft Windows
            Status: REPORTED
          Severity: crash
          Priority: NOR
         Component: memcheck
          Assignee: jsew...@acm.org
          Reporter: zubeyi...@hotmail.com
  Target Milestone: ---

SUMMARY

Even thou I have WSL 2, have valgrind properly (i guess) installed to my WSL,
valgrind don't seem to be running . When I try to execute valgrind memcheck
tool on CLion or via WSL, I get the following error with given stack trace:

-----------------------VALGRIND OUTPUT---------------------------

==31292== Memcheck, a memory error detector
==31292== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==31292== Using Valgrind-3.14.0.SVN and LibVEX; rerun with -h for copyright
info
==31292== Command: ls -l
==31292==

valgrind: the 'impossible' happened:
   Unsupported arch_prctl option

host stacktrace:
==31292==    at 0x5803D2CA: ??? (in
/usr/local/lib/valgrind/memcheck-amd64-linux)
==31292==    by 0x24: ???
==31292==    by 0x1002A9D95F: ???
==31292==    by 0x5803D2C9: ??? (in
/usr/local/lib/valgrind/memcheck-amd64-linux)
==31292==    by 0x1002A9D94F: ???

sched status:
  running_tid=1

Thread 1: status = VgTs_Runnable (lwpid 31292)
==31292==    at 0x401CB55: ??? (in /usr/lib/x86_64-linux-gnu/ld-2.31.so)
==31292==    by 0x1F8BFBFE: ???
Note: see also the FAQ in the source distribution.
It contains workarounds to several common problems.
In particular, if Valgrind aborted or crashed after
identifying problems in your program, there's a good chance
that fixing those problems will prevent Valgrind aborting or
crashing, especially if it happened in m_mallocfree.c.

If that doesn't help, please report this bug to: www.valgrind.org

In the bug report, send all the above text, the valgrind
version, and what OS and version you are using.  Thanks.

-------------------------------END OF VALGRIND
OUTPUT----------------------------------------------------

STEPS TO REPRODUCE
1. Have WSL 2 installed.
2. Have Ubuntu 20.04 LTS installed into WSL
3. Have the valgrind 3.14 installed just same as the instructions in this link
https://www.albertgao.xyz/2016/09/28/how-to-use-valgrind-on-windows/ 
     3.1 sudo apt-get update
     3.3 sudo apt-get install subversion
     3.4 svn co svn://svn.valgrind.org/valgrind/trunk valgrind
     3.5 sudo apt-get install automake
     3.6 sudo apt-get install build-essential
     3.7 cd valgrind/
     3.8 ./autogen.sh
     3.9 ./configure
     3.10 sudo apt-get install make
     3.11 sudo make
     3.12 sudo make install
4. Follow this additional steps in WSL that JetBrains provide in theur video
https://www.youtube.com/watch?v=xnwoCuHeHuY&ab_channel=JetBrainsTV
they are also in github:
https://github.com/JetBrains/clion-wsl/blob/master/ubuntu_setup_env.sh
--------------CLION WSL TUTORIAL START --------------------
#!/bin/bash
set -e

SSHD_LISTEN_ADDRESS=127.0.0.1

SSHD_PORT=2222
SSHD_FILE=/etc/ssh/sshd_config
SUDOERS_FILE=/etc/sudoers

# 0. update package lists
sudo apt-get update

# 0.1. reinstall sshd (workaround for initial version of WSL)
sudo apt remove -y --purge openssh-server
sudo apt install -y openssh-server

# 0.2. install basic dependencies
sudo apt install -y cmake gcc clang gdb valgrind build-essential

# 1.1. configure sshd
sudo cp $SSHD_FILE ${SSHD_FILE}.`date '+%Y-%m-%d_%H-%M-%S'`.back
sudo sed -i '/^Port/ d' $SSHD_FILE
sudo sed -i '/^ListenAddress/ d' $SSHD_FILE
sudo sed -i '/^UsePrivilegeSeparation/ d' $SSHD_FILE
sudo sed -i '/^PasswordAuthentication/ d' $SSHD_FILE
echo "# configured by CLion"      | sudo tee -a $SSHD_FILE
echo "ListenAddress ${SSHD_LISTEN_ADDRESS}"     | sudo tee -a $SSHD_FILE
echo "Port ${SSHD_PORT}"          | sudo tee -a $SSHD_FILE
echo "UsePrivilegeSeparation no"  | sudo tee -a $SSHD_FILE
echo "PasswordAuthentication yes" | sudo tee -a $SSHD_FILE
# 1.2. apply new settings
sudo service ssh --full-restart

# 2. autostart: run sshd 
sed -i '/^sudo service ssh --full-restart/ d' ~/.bashrc
echo "%sudo ALL=(ALL) NOPASSWD: /usr/sbin/service ssh --full-restart" | sudo
tee -a $SUDOERS_FILE
cat << 'EOF' >> ~/.bashrc
sshd_status=$(service ssh status)
if [[ $sshd_status = *"is not running"* ]]; then
  sudo service ssh --full-restart
fi
EOF


# summary: SSHD config info
echo 
echo "SSH server parameters ($SSHD_FILE):"
echo "ListenAddress ${SSHD_LISTEN_ADDRESS}"
echo "Port ${SSHD_PORT}"
echo "UsePrivilegeSeparation no"
echo "PasswordAuthentication yes"
--------------CLION WSL TUTORIAL END--------------------
5. Finally do the final steps given at the end of the video
    5.1 Open CLion, add WSL to toolchains and set it to default. Choose Ubuntu
20.04, open credentials, type in your WSL username and password. type localhost
to host and 2222 to port. It should automatically connect. If it doesn't either
the steps given above were not complete or it wasn't proper. In that case, just
open WSL Ubuntu 20.04.

    5.2 If CLion was succesfully connected to WSL, open a new CMake profile,
name it WSL_profile and choose debug as build type. Since WSL was default
toolchain, there is no need to choose toolchain for CMake.

    5.3 Try building with valgrind memcheck. You should get the error prompt
given above. If CLion still refuses to execute valgrin executable, use WSL and
type
     cd valgrind
     valgrind ls -l

In either case, the error is the same.

OBSERVED RESULT
Valgrind complains that "Unsupported arch_prctl option" probably something in
my protocols are not supported. But have no idea what it is.

EXPECTED RESULT
Valgrind should report me the memory leaks after all these steps. In WSL, since
there were no program to execute, it should at least tell me that there is no
memory leak nor were there any memory allocation.

SOFTWARE/OS VERSIONS
Microsoft Windows 10 Home Single Language
10.0.19042 N/A Build 19042

WSL 2 : Ubuntu 20.04 LTS

Valgrind-3.14.0.SVN

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to