Linux::Smaps on RHEL

Linux::Smaps on RHEL

am 22.07.2009 00:53:54 von Jonathan Swartz

I'm running into the problem using Linux::Smaps on RHEL with an Apache
server on port 80. Namely, that the httpd child doesn't have
permissions to look at the smaps file.

Linux::Smaps: Cannot open /proc/20074/smaps: Permission denied
or
Linux::Smaps: Cannot open /proc/self/smaps: Permission denied

I believe it is this bug:

https://bugzilla.redhat.com/show_bug.cgi?id=322881

Since the redhat folks don't seem to be in a hurry to fix this, I'm
wondering if anyone has discovered a workaround. (Other than, "don't
use RHEL" - beyond my control. :))

Thanks
Jon

Re: Linux::Smaps on RHEL

am 22.07.2009 15:24:25 von torsten.foertsch

On Wed 22 Jul 2009, Jonathan Swartz wrote:
> I'm running into the problem using Linux::Smaps on RHEL with an
> Apache =A0 server on port 80. Namely, that the httpd child doesn't have
> permissions to look at the smaps file.
>
> =A0 =A0 =A0 Linux::Smaps: Cannot open /proc/20074/smaps: Permission denied
> =A0 =A0or
> =A0 =A0 =A0 Linux::Smaps: Cannot open /proc/self/smaps: Permission denied
>
> I believe it is this bug:
>
> =A0 =A0 =A0https://bugzilla.redhat.com/show_bug.cgi?id=3D322881
>
> Since the redhat folks don't seem to be in a hurry to fix this, I'm =A0
> wondering if anyone has discovered a workaround. (Other than, "don't
> =A0 use RHEL" - beyond my control. :))

If access is denied by the kernel there is only one solution, fix the=20
kernel.

Torsten

=2D-=20
Need professional mod_perl support?
Just hire me: torsten.foertsch@gmx.net

Re: Linux::Smaps on RHEL

am 22.07.2009 15:27:28 von hans

Jonathan,

I've tested on Redhat Nahant (RHEL4, i don't like it but my situation is si=
milar to yours), an effectively the permissions are very tight, 600 for the=
smaps file. Let's look at the smaps of the current process (bash in this c=
ase):

[hans@led ~]$ ls -l /proc/$$/smaps

-r-------- 1 hans hans 0 jul 22 08:47 /proc/25064/smaps

In any case root and the user owner of the process can read the file, you m=
ust run the process that is reading the smaps file as root or as the user o=
wner of the process. If you can't do it in normal ways, you can achieve th=
is using the setuid bit to force the auditing process to run under the user=
owning the maps.

Good luck
Hans

----- "Jonathan Swartz" escribió:

> I'm running into the problem using Linux::Smaps on RHEL with an Apachee
> =20
> server on port 80. Namely, that the httpd child doesn't have =20
> permissions to look at the smaps file.
>=20
> Linux::Smaps: Cannot open /proc/20074/smaps: Permission denied
> or
> Linux::Smaps: Cannot open /proc/self/smaps: Permission denied
>=20
> I believe it is this bug:
>=20
> https://bugzilla.redhat.com/show_bug.cgi?id=3D322881
>=20
> Since the redhat folks don't seem to be in a hurry to fix this, I'm =20
> wondering if anyone has discovered a workaround. (Other than, "don't=20
>=20
> use RHEL" - beyond my control. :))
>=20
> Thanks
> Jon

--=20
Hans Poo, WeLinux S.A.
Oficina: 697.25.42, Celular: 09-319.93.05
Bombero Ossa # 1010, Santiago