Community
cancel
Showing results for 
Search instead for 
Did you mean: 
JKrug2
New Contributor I
2,004 Views

Accessing /proc/PID/maps

Hi.

Is there a way to access "/proc/pid/maps" ?

I am using the default Yocto image, after upgrading my Edison.

What I mean with that is that I did not compile the Yocto image from sources, I am using a standard distributed install.

The "maps" files for all processes seems to be 0 bytes size, however, that may simple be because of permissions, since I get a "permission denied" when reading some of them.

I am aware that if SELINUX is turned on in the kernel, it will deny access to the information I need in the "maps" files.

I can see there is a directory "/sys/kernel/slab/selinux_inode_security/" on the Edison.

I need to be able to access "/proc/PID/maps" for an application I launch, in order to debug the application.

I also need to be able to do this "WITHOUT" having to re-compile the kernel and turn off "selinux".

Is there a flag on startup I can set, a parameter I can pas to the kernel, or maybe a systemctl command I can give, to allow me to access the "maps" of a particular process ?

Also, I am not so sure that selinux is enabled.

If I do a "id -Z" I get back the following:

id: --context (-Z) works only on an SELinux-enabled kernel"

Background:

------------------

The intent is to connect remotely to a process and debug it.

I am using Wind River Helix Application Cloud and it can interface with an agent we install on the Edison target.

With it, I can compile and run an application on the target itself. It can also do debugging, however, currently for the debugger to work, we read information from the "maps" file that gets created when starting the "compiled application".

I appreciate any suggestions or workarounds ?

Thanks

0 Kudos
10 Replies
idata
Community Manager
285 Views

Hi Johan,

 

 

Could you please provide an example of a PID that showed you the "permission denied" message? I've been trying to read some of them and while I don't get any actual data I haven't get the permission message. I would like to investigate this a little bit more.

 

 

Regards,

 

-Pablo
JKrug2
New Contributor I
285 Views

Sure, here is a little example, checking on a process that I know will also be running on your target.

root@johan_edison:/proc# ps | grep ssh

883 root 5120 S sshd: root@pts/0

1054 root 4964 S sshd: root@pts/1

1066 root 2656 S grep ssh

root@johan_edison:/proc#

root@johan_edison:/proc# cat /proc/883/maps

cat: /proc/883/maps: Permission denied

root@johan_edison:/proc#

root@johan_edison:/proc# cat /proc/883/smaps

cat: /proc/883/smaps: Permission denied

root@johan_edison:/proc#

root@johan_edison:/proc# uname -a

Linux johan_edison 3.10.98-poky-edison+ # 1 SMP PREEMPT Mon Jun 6 14:32:08 PDT 2016 i686 GNU/Linux

root@johan_edison:/proc#

The same happens with processes I start, and binaries I put on the target.

This is with the default image that is installed on the Edison after auto-upgrading the firmware (did it via Windows)

idata
Community Manager
285 Views

Hi Johan,

 

 

Thank you for your response. We will check the information and will investigate this a little bit more, we will get back to you as soon as we have an answer.

 

 

Regards,

 

-Pablo
idata
Community Manager
285 Views

Hi Johan,

I did get a similar behavior using the latest image. However, I got different results using an older image. Look at this example:

 

I used ps | grep wpa to get the processes related to the wifi connection, and I got the following:

188 root 6244 S /usr/sbin/wpa_supplicant -u -c/etc/wpa_supplicant/wp

 

266 root 1924 S /usr/sbin/wpa_cli -a /etc/wpa_supplicant/wpa_cli-act

 

286 root 1924 S /usr/sbin/wpa_cli -a /etc/wpa_supplicant/wpa_cli-act

 

347 root 2664 S grep wpa

After that I run cat /proc/188/maps and this log appeared:

And the same goes for smaps, an even longer log appeared. So I'm wondering if this is a limitation of the latest image exclusively. I would suggest you to move to an older image for now, I'll pass this information to the development team to see if they can do something about it.

Regards,

-Pablo

JKrug2
New Contributor I
285 Views

Thanks.

It will be great if the newer images also allow access to maps and smaps.

Eventually we will make use of "ptrace" to get the information, but at the moment we rely on maps.

JKrug2
New Contributor I
285 Views

Are there any updates on this ?

Has it been communicated to those who create the SDKs, that the next SDK should allow access to /proc/PID/maps as earlier distributions did ?

Thanks

idata
Community Manager
285 Views

Hi Johan,

 

 

We've already passed the information to the team in charge, however, there's no ETA as to when this will be solved. We appreciate your patience in the meantime.

 

 

Regards,

 

-Pablo
JKrug2
New Contributor I
285 Views

Hi Pablo.

I got the 3.5 software release over here:

https://software.intel.com/en-us/iot/hardware/edison/downloads IoT - Intel® Edison Board Download | Intel® Software

This contained the kernel "3.10.98-poky-edison+" for the Edison, that did not work.

I used the "Windows* 64-bit" installer.

We tried the same thing on 2 other Edison boards out-of-the-box.

They contain the kernel version "3.10.17-poky-edison+", and that does work correctly.

Few Questions

  1. You mention that you used an older software version. Do you have a link to the particular installer (the version you tested) that we can tell our customers to download and install ?
  2. Also, which version of the "Installer" do we need to install to get the original kernel "3.10.17" version, and where can we download that.

Thanks

idata
Community Manager
285 Views

Hi Johan,

 

 

Thank you for your patience.

 

This is the version that I'm talking about, https://downloadcenter.intel.com/download/24910/Intel-Edison-Board-Software-Package https://downloadcenter.intel.com/download/24910/Intel-Edison-Board-Software-Package, download the file called edison-image-ww18-15.zip. You can find some other versions if you scroll down the page. At the very end you'll see the links. Use the Flashall script to load the image to your Edison.

 

 

Regards,

 

-Pablo
idata
Community Manager
285 Views

Hi Johan,

 

 

Just to add to my last reply. You'll get kernel 3.10.17 just by loading the image that I provided. But again, if you use the integrated installer you'll download the latest image, so if you're using your Edison for the very first time, install all necessary drivers manually (FTDI and such) or if you want to use the installer just load the previous image with the Flashall script once you're all set.

 

 

Regards,

 

-Pablo
Reply