Discussion:
Prevent shared libs from being cached in memory on AIX
(too old to reply)
Tim Hoke
2015-01-21 16:00:37 UTC
Permalink
On AIX, when I execute my pp'd binary (pp -C) the shared libs remain loaded
in memory. I'd like to prevent that by changing the permissions on the
files in the cache. If the execute permissions are removed from 'other',
then the library won't be kept in memory on AIX.

Will this patch be sufficient? Any issues with it that I'm not
considering? I wonder if it could be further restricted to 0700 or even
0500?

$ svn diff par/PAR-Packer/trunk/ par/trunk/
Index: par/PAR-Packer/trunk/myldr/boot.c
===================================================================
--- par/PAR-Packer/trunk/myldr/boot.c (revision 1533)
+++ par/PAR-Packer/trunk/myldr/boot.c (working copy)
@@ -66,7 +66,7 @@
if (close(fd) == -1)
return EXTRACT_FAIL;

- chmod(*ext_path, 0755);
+ chmod(*ext_path, 0750);
return EXTRACT_OK;
}

Index: par/trunk/lib/PAR/Heavy.pm
===================================================================
--- par/trunk/lib/PAR/Heavy.pm (revision 1533)
+++ par/trunk/lib/PAR/Heavy.pm (working copy)
@@ -158,7 +158,7 @@
binmode($fh);
$member->extractToFileHandle($fh);
close $fh;
- chmod 0755, $filename;
+ chmod 0750, $filename;
}

return $filename;

If that's all sufficient, how should I proceed? Get commit permission?
Submit an RT against PAR and PAR-Packer?

Thanks
-Tim
Roderich Schupp
2015-01-21 16:29:00 UTC
Permalink
Post by Tim Hoke
On AIX, when I execute my pp'd binary (pp -C) the shared libs remain
loaded in memory.
What do you mean by "remain loaded in memory" - even after the
process created by executing the pp'd binary has exited?
And why would changing the "other" bits on the files have any effect on
that?

Cheers, Roderich
Tim Hoke
2015-01-21 16:44:44 UTC
Permalink
Yes, you've got it. They remain loaded in memory even after the pp'd
binary has exited and been cleaned up (cache removed). The result is that
when the pp'd binary is called again (and again, and again), another copy
get's loaded (and kept) in memory because it's in a different cache
directory. The workaround is to run slibclean, but by changing the "other"
bits, AIX doesn't bother trying to keep it in shared memory.

Thanks
-Tim

On Wed, Jan 21, 2015 at 10:29 AM, Roderich Schupp <
Post by Roderich Schupp
Post by Tim Hoke
On AIX, when I execute my pp'd binary (pp -C) the shared libs remain
loaded in memory.
What do you mean by "remain loaded in memory" - even after the
process created by executing the pp'd binary has exited?
And why would changing the "other" bits on the files have any effect on
that?
Cheers, Roderich
Roderich Schupp
2015-01-21 17:00:19 UTC
Permalink
I see, weird.
Your patch looks reasonable, shouldn't break in other environments as cache
files should be in a per-user tree anyway.
Just a file bug on RT against PAR-Packer (because that's were I look
first), the text of your original post should do.

Cheers, Roderich
Tim Hoke
2015-01-21 17:19:27 UTC
Permalink
Done.

https://rt.cpan.org/Ticket/Display.html?id=101662

Thanks
-Tim

On Wed, Jan 21, 2015 at 11:00 AM, Roderich Schupp <
Post by Roderich Schupp
I see, weird.
Your patch looks reasonable, shouldn't break in other environments as
cache files should be in a per-user tree anyway.
Just a file bug on RT against PAR-Packer (because that's were I look
first), the text of your original post should do.
Cheers, Roderich
Loading...