On 08/23/2011 06:08 AM, Dhaval Giani wrote:
> On Mon, Aug 22, 2011 at 5:48 AM, Jan Safranek <[email protected]> wrote:
>> when an executable is symlinked and the symlink is executed,
>> /proc/PID/status contains name of the symlink, while /proc/PID/exe points
>> to the real executable name. cgrulesengd considered this case as error and
>> did not trigger any rule for this exec().
>>
>> With this patch, cgrulesengd uses name of /proc/PID/exe as the executable
>> in this case.
>>
>> Signed-off-by: Jan Safranek <[email protected]>
>
> If we get a tested by on this one, go ahead with it. looks sane to me.
Tested and pushed.
Jan
>
>> ---
>>
>> src/api.c | 17 +++++++++++++++--
>> 1 files changed, 15 insertions(+), 2 deletions(-)
>>
>> diff --git a/src/api.c b/src/api.c
>> index e443ad5..b3c96d7 100644
>> --- a/src/api.c
>> +++ b/src/api.c
>> @@ -3694,11 +3694,24 @@ int cgroup_get_procname_from_procfs(pid_t pid, char
>> **procname)
>> */
>> ret = cg_get_procname_from_proc_cmdline(pid, pname_status,
>> &pname_cmdline);
>> - if (!ret)
>> + if (!ret) {
>> *procname = pname_cmdline;
>> + free(pname_status);
>> + return 0;
>> + }
>>
>> + /*
>> + * The above strncmp() is not 0 also if executing a symbolic link,
>> + * /proc/pid/exe point to real executable name then.
>> + * Return it as the last resort.
>> + */
>> free(pname_status);
>> - return ret;
>> + *procname = strdup(buf);
>> + if (*procname == NULL) {
>> + last_errno = errno;
>> + return ECGOTHER;
>> + }
>> + return 0;
>> }
>>
>> int cgroup_register_unchanged_process(pid_t pid, int flags)
>>
>>
>
> ------------------------------------------------------------------------------
> Get a FREE DOWNLOAD! and learn more about uberSVN rich system,
> user administration capabilities and model configuration. Take
> the hassle out of deploying and managing Subversion and the
> tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2
> _______________________________________________
> Libcg-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/libcg-devel
------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2dcopy1
_______________________________________________
Libcg-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/libcg-devel