public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] hsearch_r: Apply VM size limit in test case
@ 2016-02-08 12:41 Florian Weimer
  2016-02-08 15:31 ` Mike Frysinger
  0 siblings, 1 reply; 6+ messages in thread
From: Florian Weimer @ 2016-02-08 12:41 UTC (permalink / raw)
  To: GNU C Library

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

As discussed before.

Florian

[-- Attachment #2: 0001-hsearch_r-Apply-VM-size-limit-in-test-case.patch --]
[-- Type: text/x-patch, Size: 1110 bytes --]

2016-02-08  Florian Weimer  <fweimer@redhat.com>

	* misc/bug18240.c (do_test): Set RLIMIT_AS.

diff --git a/misc/bug18240.c b/misc/bug18240.c
index 4b26865..773586e 100644
--- a/misc/bug18240.c
+++ b/misc/bug18240.c
@@ -22,6 +22,7 @@
 #include <stdbool.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <sys/resource.h>
 
 static void
 test_size (size_t size)
@@ -58,6 +59,27 @@ test_size (size_t size)
 static int
 do_test (void)
 {
+  /* Limit the size of the process, so that memory allocation will
+     fail without impacting the entire system.  */
+  {
+    struct rlimit limit;
+    if (getrlimit (RLIMIT_AS, &limit) != 0)
+      {
+        printf ("getrlimit (RLIMIT_AS) failed: %m\n");
+        return 1;
+      }
+    long target = 100 * 1024 * 1024;
+    if (limit.rlim_cur == RLIM_INFINITY || limit.rlim_cur > target)
+      {
+        limit.rlim_cur = target;
+        if (setrlimit (RLIMIT_AS, &limit) != 0)
+          {
+            printf ("setrlimit (RLIMIT_AS) failed: %m\n");
+            return 1;
+          }
+      }
+  }
+
   test_size (500);
   test_size (-1);
   test_size (-3);

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

* Re: [PATCH] hsearch_r: Apply VM size limit in test case
  2016-02-08 12:41 [PATCH] hsearch_r: Apply VM size limit in test case Florian Weimer
@ 2016-02-08 15:31 ` Mike Frysinger
  2016-02-12  8:31   ` Florian Weimer
  0 siblings, 1 reply; 6+ messages in thread
From: Mike Frysinger @ 2016-02-08 15:31 UTC (permalink / raw)
  To: Florian Weimer; +Cc: GNU C Library

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

OK
-mike

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

* Re: [PATCH] hsearch_r: Apply VM size limit in test case
  2016-02-08 15:31 ` Mike Frysinger
@ 2016-02-12  8:31   ` Florian Weimer
  2016-02-12 10:18     ` Szabolcs Nagy
  2016-02-12 11:56     ` Adhemerval Zanella
  0 siblings, 2 replies; 6+ messages in thread
From: Florian Weimer @ 2016-02-12  8:31 UTC (permalink / raw)
  To: Adhemerval Zanella; +Cc: libc-alpha

On 02/08/2016 04:31 PM, Mike Frysinger wrote:
> OK -mike

Adhemerval,

is this okay for master?

  <https://sourceware.org/ml/libc-alpha/2016-02/msg00085.html>

People building on larger boxes notice the test failure:

  <https://sourceware.org/bugzilla/show_bug.cgi?id=18240#c14>

Thanks,
Florian

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

* Re: [PATCH] hsearch_r: Apply VM size limit in test case
  2016-02-12  8:31   ` Florian Weimer
@ 2016-02-12 10:18     ` Szabolcs Nagy
  2016-02-12 11:56     ` Adhemerval Zanella
  1 sibling, 0 replies; 6+ messages in thread
From: Szabolcs Nagy @ 2016-02-12 10:18 UTC (permalink / raw)
  To: Florian Weimer, Adhemerval Zanella; +Cc: libc-alpha, nd

On 12/02/16 08:31, Florian Weimer wrote:
> On 02/08/2016 04:31 PM, Mike Frysinger wrote:
>> OK -mike
> 
> Adhemerval,
> 
> is this okay for master?
> 
>   <https://sourceware.org/ml/libc-alpha/2016-02/msg00085.html>
> 
> People building on larger boxes notice the test failure:
> 
>   <https://sourceware.org/bugzilla/show_bug.cgi?id=18240#c14>
> 
> Thanks,
> Florian
> 

fwiw i tested the patch on aarch64 and fixes the issue as expected.

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

* Re: [PATCH] hsearch_r: Apply VM size limit in test case
  2016-02-12  8:31   ` Florian Weimer
  2016-02-12 10:18     ` Szabolcs Nagy
@ 2016-02-12 11:56     ` Adhemerval Zanella
  2016-02-12 12:13       ` Florian Weimer
  1 sibling, 1 reply; 6+ messages in thread
From: Adhemerval Zanella @ 2016-02-12 11:56 UTC (permalink / raw)
  To: Florian Weimer; +Cc: libc-alpha



On 12-02-2016 06:31, Florian Weimer wrote:
> On 02/08/2016 04:31 PM, Mike Frysinger wrote:
>> OK -mike
> 
> Adhemerval,
> 
> is this okay for master?

Yes, thanks.

> 
>   <https://sourceware.org/ml/libc-alpha/2016-02/msg00085.html>
> 
> People building on larger boxes notice the test failure:
> 
>   <https://sourceware.org/bugzilla/show_bug.cgi?id=18240#c14>
> 
> Thanks,
> Florian
> 

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

* Re: [PATCH] hsearch_r: Apply VM size limit in test case
  2016-02-12 11:56     ` Adhemerval Zanella
@ 2016-02-12 12:13       ` Florian Weimer
  0 siblings, 0 replies; 6+ messages in thread
From: Florian Weimer @ 2016-02-12 12:13 UTC (permalink / raw)
  To: Adhemerval Zanella; +Cc: libc-alpha

On 02/12/2016 12:56 PM, Adhemerval Zanella wrote:
> 
> 
> On 12-02-2016 06:31, Florian Weimer wrote:
>> On 02/08/2016 04:31 PM, Mike Frysinger wrote:
>>> OK -mike
>>
>> Adhemerval,
>>
>> is this okay for master?
> 
> Yes, thanks.

Thanks, pushed.

Florian

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

end of thread, other threads:[~2016-02-12 12:13 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-08 12:41 [PATCH] hsearch_r: Apply VM size limit in test case Florian Weimer
2016-02-08 15:31 ` Mike Frysinger
2016-02-12  8:31   ` Florian Weimer
2016-02-12 10:18     ` Szabolcs Nagy
2016-02-12 11:56     ` Adhemerval Zanella
2016-02-12 12:13       ` Florian Weimer

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).