Skip to content
This repository has been archived by the owner on Jan 20, 2022. It is now read-only.

fork() system call execution #7

Closed
ShobhaV opened this issue Sep 21, 2016 · 1 comment
Closed

fork() system call execution #7

ShobhaV opened this issue Sep 21, 2016 · 1 comment

Comments

@ShobhaV
Copy link

ShobhaV commented Sep 21, 2016

Hi,

I want to run a benchmark which makes some system calls. I have written a small program to test if some system calls were working, But the fork() function seems to be stuck in a infinite loop and never exits the program. The program runs successfully natively on Linux.

I have attached a part of the program here and the manifest file is similar to the manifest.template of opendjk example in the library.

_code snippet_

           switch (fork()) {
           case -1:            /* Error */
               errExit("fork");

           case 0:             /* Child */
               printf("DOne3 \n");
               CPU_SET(childCPU, &set);
               if (sched_setaffinity(getpid(), sizeof(set), &set) == -1)
                     errExit("sched_setaffinity")
               else
                     printf("Setaffinity success!\n");

               for (j = 0; j < nloops; j++)
                   getppid();

               exit(EXIT_SUCCESS);

_manifest.template snippet_

sys.stack.size = 256K
sys.brk.size = 16M
glibc.heap_size = 16M

sgx.enclave_size = 512M
sgx.thread_num = 16

I cloned and installed the library from GitHub just yesterday after seeing 'bugfix: process fork in LibOS' and ran the program. It gave the output and gets stuck.

WARNING: no physical memory support, process creation will be slow.
sched_setaffinity: Function not implemented

@chiache
Copy link
Contributor

chiache commented Nov 14, 2016

Hi, sorry for the late response. sched_setaffinity is not implemented in Graphene yet. We are planning to support scheduling APIs in the future by adding host interface to Graphene. Currently calling sched_setaffinity will get a warning "sched_setaffinity: Function not implemented" and return -ENOSYS to the application. I will suggest you modify the source code and bypass failed calls to sched_setaffinity.

@chiache chiache closed this as completed Nov 14, 2016
donporter added a commit that referenced this issue Feb 19, 2019
donporter added a commit that referenced this issue Mar 7, 2019
This corresponds to PRs #6 and #7 for lmbench-2.5, which drops all of the lat_proc tests until they are fully debugged.
yamahata added a commit that referenced this issue Jul 24, 2019
When a helper thread exit voluntariy, the following segv happends.
The reason for segv is, __handle_signal() tries to access
shim_thread, it's already freed.
This situation only happens with helper threads. exit system call
doesn't trigger this pattern.
So add __disable_preempt() before put_thread() in helper function
as exeption.

> #0  0x00007f99f900d77e in atomic_read (v=0x7f99f8d772b8) at ../../../Pal/lib/atomic.h:93
> #1  0x00007f99f900f800 in __handle_signal (tcb=0x7f99f9522ec0, sig=1) at bookkeep/shim_signal.c:677
> #2  0x00007f99f90052dd in enable_preempt (tcb=0x7f99f9522ec0) at ../include/shim_internal.h:507
> #3  0x00007f99f90053db in unlock (l=0x7f99f930c190 <vma_list_lock>) at ../include/shim_internal.h:581
> #4  0x00007f99f9007c65 in bkeep_munmap (addr=0x7f99f8d77000, length=8192, flags=536870912) at bookkeep/shim_vma.c:681
> #5  0x00007f99f90731f0 in __system_free (addr=0x7f99f8d77000, size=5176) at shim_malloc.c:102
> #6  0x00007f99f9072ead in slab_free (mgr=0x7f99f8dc6000, obj=0x7f99f8d77020) at ../../../Pal/lib/slabmgr.h:465
> #7  0x00007f99f90733e7 in free (mem=0x7f99f8d77020) at shim_malloc.c:332
> #8  0x00007f99f900ae99 in put_thread (thread=0x7f99f8d77020) at bookkeep/shim_thread.c:346
> #9  0x00007f99f90742c7 in shim_async_helper (arg=0x7f99f8d77020) at shim_async.c:271
> #10 0x00007f99f931cd76 in pal_thread_init (tcbptr=<optimized out>) at db_threading.c:75
> #11 0x00007f99f9321776 in clone () at clone-x86_64.S:105

Signed-off-by: Isaku Yamahata <isaku.yamahata@gmail.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants