[apparmor] [PATCH] Fix clone test on quantal arm omap-4

John Johansen john.johansen at canonical.com
Mon Oct 15 06:15:09 UTC 2012


On 10/13/2012 05:50 AM, Steve Beattie wrote:
> On Fri, Oct 12, 2012 at 01:58:49PM -0700, John Johansen wrote:
>> On 10/12/2012 01:36 PM, Kees Cook wrote:
>>> How about using getpagesize() instead?
>>>
>> We certainly could, but certainly isn't required for this test.
>>
>> tbh I am not even sure why we are bothering with PAGE_SIZE at
>> all, after all we are just allocating some space for the threads
>> stack.  And for this case anything over a few hundred bytes should
>> be sufficient.
> 
> I suspect (since my recollection of writing this testcase is lost
> in the sands of time) that I was just trying to be conservative in
> allocating a sufficiently sized stack for the child thread. I'm not
> opposed to doing something differently here.
> 

Alright here is a simple alternative I think is more than sufficient

---

=== modified file 'tests/regression/apparmor/clone.c'
--- tests/regression/apparmor/clone.c	2010-12-20 20:29:10 +0000
+++ tests/regression/apparmor/clone.c	2012-10-15 06:14:01 +0000
@@ -23,6 +23,8 @@
 #include <sched.h>
 #include <linux/unistd.h>
 
+#define STACK_SIZE 0x8000
+
 struct option long_options[] =
 {
 	{"newns", 0, 0, 'n'},  /* create a new namespace */
@@ -59,7 +61,7 @@
 	int waitstatus;
 	int c;
 	char buf[BUFSIZ];
-	int stack_size = PAGE_SIZE << 4;
+	int stack_size = STACK_SIZE;
 	void *child_stack = malloc(stack_size);
 	int clone_flags = SIGCHLD;





More information about the AppArmor mailing list