Changeset 4680ef5 in mainline


Ignore:
Timestamp:
2007-06-13T21:36:59Z (17 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
8b243f2
Parents:
341140c
Message:

Fix a double-free recently introduced in revision r2436.
Add a comment clarifying the life-cycle of the kernel_uarg structure.

Comment out the freeing of userspace thread stack while still running on it.
This should be fixed by implementing userspace version of thread_join().

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/proc/thread.c

    r341140c r4680ef5  
    386386                task_destroy(t->task);
    387387       
    388         /*
    389          * If the thread had a userspace context, free up its kernel_uarg
    390          * structure.
    391          */
    392         if (t->flags & THREAD_FLAG_USPACE) {
    393                 ASSERT(t->thread_arg);
    394                 free(t->thread_arg);
    395         }
    396 
    397388        slab_free(thread_slab, t);
    398389}
     
    683674                return (unative_t) rc;
    684675
    685         kernel_uarg = (uspace_arg_t *) malloc(sizeof(uspace_arg_t), 0);
     676        /*
     677         * In case of failure, kernel_uarg will be deallocated in this function.
     678         * In case of success, kernel_uarg will be freed in uinit().
     679         */
     680        kernel_uarg = (uspace_arg_t *) malloc(sizeof(uspace_arg_t), 0);
     681       
    686682        rc = copy_from_uspace(kernel_uarg, uspace_uarg, sizeof(uspace_arg_t));
    687683        if (rc != 0) {
  • uspace/libc/generic/thread.c

    r341140c r4680ef5  
    108108        uarg->uspace_thread_function(uarg->uspace_thread_arg);
    109109        /* XXX: we cannot free the userspace stack while running on it */
    110         free(uarg->uspace_stack);
    111         free(uarg);
     110//      free(uarg->uspace_stack);
     111//      free(uarg);
    112112
    113113        /* If there is a manager, destroy it */
Note: See TracChangeset for help on using the changeset viewer.