sys_open + RCU

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi all, new newbie here.

I've been studying the sys_open() code and have run into a problem with the synchronization using RCU. The code snippet I'm having problems with is in get_unused_fd_flags():

FD_SET(fd, fdt->open_fds);
if (flags & O_CLOEXEC)
    FD_SET(fd, fdt->close_on_exec);
else
    FD_CLR(fd, fdt->close_on_exec);

RCU requires first creating a local copy, updating that copy, updating the RCU protected pointer with the local copy and finally deallocating the original version after a grace period. This snippet, however, directly modifies the shared structure and therefore exposes intermediate states to other readers.

I'm assuming it doesn't matter as the fd allocated won't be properly accessible until after the syscall has finished and therefore those bits won't be actually used until then. Still, I want to know if this really violates the RCU mechanic or if I'm missing something.


Cheers,
Martin

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux