public inbox for libffi-discuss@sourceware.org
 help / color / mirror / Atom feed
* Re: [Patch] Updated version of emutramp_enabled_check() for PaX kernels
@ 2014-03-27 18:15 Magnus Granberg
  2014-03-28 15:43 ` Anthony Green
  0 siblings, 1 reply; 6+ messages in thread
From: Magnus Granberg @ 2014-03-27 18:15 UTC (permalink / raw)
  To: libffi-discuss

>Hi 
>Magnus, Reading /proc/self/status is a little more heavy weight than checking 
an environment variable. Do we really have to do this every time we call 
dlmmap(), or can we do it once and cache the result? 
>Thanks, 
>AG

The selinux check read /proc/mount for selinux stuff and even check if it have 
the selinux dir. I think the selinux check have the same heavy weight as the 
pax check and then the selinux need to make a temp file in some dir the app
have acces to make file in. For me is fine to read /proc/... on every time.

/Magnus

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Patch] Updated version of emutramp_enabled_check() for PaX kernels
  2014-03-27 18:15 [Patch] Updated version of emutramp_enabled_check() for PaX kernels Magnus Granberg
@ 2014-03-28 15:43 ` Anthony Green
  0 siblings, 0 replies; 6+ messages in thread
From: Anthony Green @ 2014-03-28 15:43 UTC (permalink / raw)
  To: Magnus Granberg; +Cc: libffi-discuss

Magnus Granberg <zorry@gentoo.org> writes:

>>Hi 
>>Magnus, Reading /proc/self/status is a little more heavy weight than checking 
> an environment variable. Do we really have to do this every time we call 
> dlmmap(), or can we do it once and cache the result? 
>>Thanks, 
>>AG
>
> The selinux check read /proc/mount for selinux stuff and even check if it have 
> the selinux dir. I think the selinux check have the same heavy weight as the 
> pax check and then the selinux need to make a temp file in some dir the app
> have acces to make file in. For me is fine to read /proc/... on every time.
>
> /Magnus


Thanks Magnus,  I am applying your patch.

AG

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Patch] Updated version of emutramp_enabled_check() for PaX kernels
  2013-05-22 11:50 ` Anthony Green
@ 2013-05-22 15:16   ` Magnus Granberg
  0 siblings, 0 replies; 6+ messages in thread
From: Magnus Granberg @ 2013-05-22 15:16 UTC (permalink / raw)
  To: libffi-discuss

onsdag 22 maj 2013 07.50.57 skrev  Anthony Green:
> Hi Magnus,
> 
>   Reading /proc/self/status is a little more heavy weight than
> checking an environment variable.   Do we really have to do this every
> time we call dlmmap(), or can we do it once
> and cache the result?
> 
> Thanks,
> 
> AG
Would be fine to cache the result.

/Magnus

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Patch] Updated version of emutramp_enabled_check() for PaX kernels
  2013-04-29 21:45 Magnus Granberg
  2013-05-13 17:53 ` Magnus Granberg
@ 2013-05-22 11:50 ` Anthony Green
  2013-05-22 15:16   ` Magnus Granberg
  1 sibling, 1 reply; 6+ messages in thread
From: Anthony Green @ 2013-05-22 11:50 UTC (permalink / raw)
  To: Magnus Granberg; +Cc: libffi-discuss

Hi Magnus,

  Reading /proc/self/status is a little more heavy weight than
checking an environment variable.   Do we really have to do this every
time we call dlmmap(), or can we do it once
and cache the result?

Thanks,

AG


On Mon, Apr 29, 2013 at 5:44 PM, Magnus Granberg <zorry@gentoo.org> wrote:
> Hi
> This patch check the PaX status in /proc/self/status
> and it will return true or fales depend on the status of
> emulate trampolines in Pax.
>
> /Magnus
>
> 2013-04-29  Magnus Granberg <zorry@gentoo.org>
>
>         * src/cloures.c (emutramp_enabled_check): Check /proc/self/status for PaX
>         status.
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Patch] Updated version of emutramp_enabled_check() for PaX kernels
  2013-04-29 21:45 Magnus Granberg
@ 2013-05-13 17:53 ` Magnus Granberg
  2013-05-22 11:50 ` Anthony Green
  1 sibling, 0 replies; 6+ messages in thread
From: Magnus Granberg @ 2013-05-13 17:53 UTC (permalink / raw)
  To: libffi-discuss

måndag 29 april 2013 23.44.27 skrev  Magnus Granberg:
> Hi
> This patch check the PaX status in /proc/self/status
> and it will return true or fales depend on the status of
> emulate trampolines in Pax.
> 
> /Magnus
> 
> 2013-04-29  Magnus Granberg <zorry@gentoo.org>
> 
> 	* src/cloures.c (emutramp_enabled_check): Check /proc/self/status for PaX
> 	status.
Can this patch be included with next release?
/Magnus

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Patch] Updated version of emutramp_enabled_check() for PaX kernels
@ 2013-04-29 21:45 Magnus Granberg
  2013-05-13 17:53 ` Magnus Granberg
  2013-05-22 11:50 ` Anthony Green
  0 siblings, 2 replies; 6+ messages in thread
From: Magnus Granberg @ 2013-04-29 21:45 UTC (permalink / raw)
  To: libffi-discuss

[-- Attachment #1: Type: text/plain, Size: 286 bytes --]

Hi
This patch check the PaX status in /proc/self/status
and it will return true or fales depend on the status of
emulate trampolines in Pax.

/Magnus

2013-04-29  Magnus Granberg <zorry@gentoo.org>

	* src/cloures.c (emutramp_enabled_check): Check /proc/self/status for PaX 	
	status.


[-- Attachment #2: libffi-3.0.13-emutramp_pax_log.patch --]
[-- Type: text/x-patch, Size: 791 bytes --]

--- a/src/closures.c	2013-03-17 23:27:11.000000000 +0100
+++ b/src/closures.c	2013-04-29 23:26:02.279022022 +0200
@@ -181,10 +181,26 @@ static int emutramp_enabled = -1;
 static int
 emutramp_enabled_check (void)
 {
-  if (getenv ("FFI_DISABLE_EMUTRAMP") == NULL)
-    return 1;
-  else
+  char *buf = NULL;
+  size_t len = 0;
+  FILE *f;
+  int ret;
+  f = fopen ("/proc/self/status", "r");
+  if (f == NULL)
     return 0;
+  ret = 0;
+
+  while (getline (&buf, &len, f) != -1)
+    if (!strncmp (buf, "PaX:", 4))
+      {
+        char emutramp;
+        if (sscanf (buf, "%*s %*c%c", &emutramp) == 1)
+          ret = (emutramp == 'E');
+        break;
+      }
+  free (buf);
+  fclose (f);
+  return ret;
 }
 
 #define is_emutramp_enabled() (emutramp_enabled >= 0 ? emutramp_enabled \

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-03-28 15:43 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-27 18:15 [Patch] Updated version of emutramp_enabled_check() for PaX kernels Magnus Granberg
2014-03-28 15:43 ` Anthony Green
  -- strict thread matches above, loose matches on Subject: below --
2013-04-29 21:45 Magnus Granberg
2013-05-13 17:53 ` Magnus Granberg
2013-05-22 11:50 ` Anthony Green
2013-05-22 15:16   ` Magnus Granberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).