Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#7056 closed bug (fixed)

umask is not inherited to exec'ed image

Reported by: zooey Owned by: zooey
Priority: normal Milestone: R1
Component: System/libroot.so Version: R1/Development
Keywords: exec umask Cc:
Blocked By: Blocking:
Has a Patch: no Platform: All

Description

The umask of the calling process is not inherited to any image loaded via any of the exec...() functions. According to the POSIX base specs version 7, it should be. This causes problems for the git test suite and (I suppose) for the mercurial test suite, too.

Attachments (1)

exec_umask.c (113 bytes) - added by zooey 8 years ago.
a tiny test exposing the problem - just set the umask to some specific value and, invoking the test, you'll see that it will have been reverted to '022'.

Download all attachments as: .zip

Change History (5)

Changed 8 years ago by zooey

Attachment: exec_umask.c added

a tiny test exposing the problem - just set the umask to some specific value and, invoking the test, you'll see that it will have been reverted to '022'.

comment:1 Changed 8 years ago by bonefish

Implementation hint:

  • Add a parameter for the umask to _kern_exec() and pass the current umask where invoked.
  • In team.cpp pass the umask on (_user_exec() -> team_exec()) and add it to the team_arg structure (defined in same file).
  • In user_runtime.h add a umask field to the user_space_program_args structure and set it in team_create_thread_start() (from the team_arg field).
  • In libroot's initialize_before() set the umask from the newly introduced __gRuntimeLoader->program_args member.

comment:2 Changed 8 years ago by zooey

Owner: changed from axeld to zooey
Status: newin-progress

comment:3 Changed 8 years ago by zooey

Resolution: fixed
Status: in-progressclosed

Fixed in hrev40071 - basically followed Ingo's implementation hint (thanks!), additionally chose to not inherit the umask for images loaded by other means (load_image...).

comment:4 Changed 8 years ago by axeld

Which I definitely agree with. An alternative would have been to maintain the umask kernel side, and have a syscall to retrieve it - but this way, a syscall is saved whenever it's used in userland, so it's probably the better solution. Thanks!

Note: See TracTickets for help on using tickets.