This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[MTASCsft PATCH WIP5 33/33] MT-, AS- and AC-safety docs: manual/users.texi
- From: Alexandre Oliva <aoliva at redhat dot com>
- To: libc-alpha at sourceware dot org
- Cc: carlos at redhat dot com, mtk dot manpages at gmail dot com
- Date: Wed, 13 Nov 2013 06:15:38 -0200
- Subject: [MTASCsft PATCH WIP5 33/33] MT-, AS- and AC-safety docs: manual/users.texi
- Authentication-results: sourceware.org; auth=none
- References: <20131113081059 dot 3464 dot 51385 dot stgit at frit dot home>
for ChangeLog
* manual/users.texi: Document MTASC-safety properties.
---
manual/users.texi | 344 +++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 344 insertions(+)
diff --git a/manual/users.texi b/manual/users.texi
index 957e346..9231750 100644
--- a/manual/users.texi
+++ b/manual/users.texi
@@ -221,6 +221,9 @@ This is an integer data type used to represent group IDs. In
@comment unistd.h
@comment POSIX.1
@deftypefun uid_t getuid (void)
+@safety{@mtsafe{}@assafe{selfdeadlock(hurd)}@acsafe{}}
+@c Atomic syscall, except on hurd, where it takes a lock within a hurd
+@c critical section.
The @code{getuid} function returns the real user ID of the process.
@end deftypefun
@@ -792,6 +795,41 @@ The @code{getlogin} function is declared in @file{unistd.h}, while
@comment unistd.h
@comment POSIX.1
@deftypefun {char *} getlogin (void)
+@safety{@mtunsafe{staticbuf, tempsig, stimer, glocale}@asunsafe{oncesafe, shlimb, asmalloc, selfdeadlock}@acunsafe{incansist, lockleak, fdleak, memleak}}
+@c getlogin (linux) staticbuf, tempsig, stimer, glocale, oncesafe, shlimb, asmalloc, selfdeadlock, incansist, lockleak, fdleak, memleak
+@c getlogin_r_loginuid dup glocale, oncesafe, shlimb, asmalloc, selfdeadlock, incansist, lockleak, fdleak, memleak
+@c getlogin_fd0 (unix) staticbuf, tempsig, stimer, asmalloc, selfdeadlock, lockleak, fdleak, memleak
+@c uses static buffer name => staticbuf
+@c ttyname_r dup asmalloc, memleak, fdleak
+@c strncpy dup ok
+@c setutent dup staticbuf, selfdeadlock, lockleak, fdleak
+@c getutline_r dup staticbuf, tempsig, stimer, selfdeadlock, lockleak, fdleak
+@c endutent dup staticbuf, selfdeadlock, lockleak
+@c libc_lock_unlock dup ok
+@c strlen dup ok
+@c memcpy dup ok
+@c
+@c getlogin_r (linux) staticbuf, tempsig, stimer, glocale, oncesafe, shlimb, asmalloc, selfdeadlock, incansist, lockleak, fdleak, memleak
+@c getlogin_r_loginuid glocale, oncesafe, shlimb, asmalloc, selfdeadlock, incansist, lockleak, fdleak, memleak
+@c open_not_cancel_2 dup fdleak
+@c read_not_cancel dup ok
+@c close_not_cancel_no_status dup ok
+@c strtoul glocale, glocale
+@c getpwuid_r dup glocale, oncesafe, shlimb, asmalloc, selfdeadlock, incansist, lockleak, fdleak, memleak
+@c realloc dup selfdeadlock, lockleak, fdleak, memleak
+@c strlen dup ok
+@c memcpy dup ok
+@c free dup selfdeadlock, lockleak, fdleak, memleak
+@c getlogin_r_fd0 (unix) staticbuf, tempsig, stimer, asmalloc, selfdeadlock, lockleak, memleak, fdleak
+@c ttyname_r dup asmalloc, memleak, fdleak
+@c strncpy dup ok
+@c libc_lock_lock dup selfdeadlock, lockleak
+@c *libc_utmp_jump_table->setutent dup staticbuf, fdleak
+@c *libc_utmp_jump_table->getutline_r dup staticbuf, tempsig, stimer
+@c *libc_utmp_jump_table->endutent dup staticbuf, selfdeadlock, lockleak
+@c libc_lock_unlock dup ok
+@c strlen dup ok
+@c memcpy dup ok
The @code{getlogin} function returns a pointer to a string containing the
name of the user logged in on the controlling terminal of the process,
or a null pointer if this information cannot be determined. The string
@@ -1013,6 +1051,22 @@ compatibility only, @file{utmp.h} defines @code{ut_time} as an alias for
@comment utmp.h
@comment SVID
@deftypefun void setutent (void)
+@safety{@mtunsafe{staticbuf}@asunsafe{selfdeadlock}@acunsafe{lockleak, fdleak}}
+@c Besides the static variables in utmp_file.c, there's the jump_table.
+@c They're both modified while holding a lock, but other threads may
+@c cause the variables to be modified between calling this function and
+@c others that rely on the internal state it sets up.
+
+@c setutent staticbuf, selfdeadlock, lockleak, fdleak
+@c libc_lock_lock dup selfdeadlock, lockleak
+@c *libc_utmp_jump_table->setutent staticbuf, fdleak
+@c setutent_unknown staticbuf, fdleak
+@c *libc_utmp_file_functions.setutent = setutent_file staticbuf, fdleak
+@c open_not_cancel_2 dup fdleak
+@c fcntl_not_cancel dup ok
+@c close_not_cancel_no_status dup fdleak
+@c lseek64 dup ok
+@c libc_lock_unlock dup ok
This function opens the user accounting database to begin scanning it.
You can then call @code{getutent}, @code{getutid} or @code{getutline} to
read entries and @code{pututline} to write entries.
@@ -1024,6 +1078,15 @@ the database.
@comment utmp.h
@comment SVID
@deftypefun {struct utmp *} getutent (void)
+@safety{@mtunsafe{1stcall, staticbuf, tempsig, stimer}@asunsafe{asmaloc, selfdeadlock, tempsig, stimer}@acunsafe{tempsig, stimer, lockleak, fdleak, memleak}}
+@c The static buffer that holds results is allocated with malloc at
+@c the first call; the test is not thread-safe, so multiple concurrent
+@c calls could malloc multiple buffers.
+
+@c getutent 1stcall, staticbuf, tempsig, stimer, asmalloc, selfdeadlock, lockleak, fdleak, memleak
+@c malloc selfdeadlock, lockleak, fdleak, memleak
+@c getutent_r dup staticbuf, tempsig, stimer, selfdeadlock, lockleak, fdleak
+
The @code{getutent} function reads the next entry from the user
accounting database. It returns a pointer to the entry, which is
statically allocated and may be overwritten by subsequent calls to
@@ -1037,6 +1100,14 @@ A null pointer is returned in case no further entry is available.
@comment utmp.h
@comment SVID
@deftypefun void endutent (void)
+@safety{@mtunsafe{staticbuf}@asunsafe{selfdeadlock}@acunsafe{lockleak}}
+@c endutent staticbuf, selfdeadlock, lockleak
+@c libc_lock_lock dup selfdeadlock, lockleak
+@c *libc_utmp_jump_table->endutent staticbuf
+@c endutent_unknown ok
+@c endutent_file staticbuf
+@c close_not_cancel_no_status dup ok
+@c libc_lock_unlock dup ok
This function closes the user accounting database.
@end deftypefun
@@ -1073,6 +1144,14 @@ over again.
@comment utmp.h
@comment SVID
@deftypefun {struct utmp *} getutline (const struct utmp *@var{line})
+@safety{@mtunsafe{1stcall, staticbuf, tempsig, stimer}@asunsafe{asmaloc, selfdeadlock, tempsig, stimer}@acunsafe{tempsig, stimer, lockleak, fdleak, memleak}}
+@c The static buffer that holds results is allocated with malloc at
+@c the first call; the test is not thread-safe, so multiple concurrent
+@c calls could malloc multiple buffers.
+
+@c getutline 1stcall, staticbuf, tempsig, stimer, asmalloc, selfdeadlock, lockleak, fdleak, memleak
+@c malloc selfdeadlock, lockleak, fdleak, memleak
+@c getutline_r dup staticbuf, tempsig, stimer, selfdeadlock, lockleak, fdleak
This function searches forward from the current point in the database
until it finds an entry whose @code{ut_type} value is
@code{LOGIN_PROCESS} or @code{USER_PROCESS}, and whose @code{ut_line}
@@ -1125,6 +1204,27 @@ user-provided buffer.
@comment utmp.h
@comment GNU
@deftypefun int getutent_r (struct utmp *@var{buffer}, struct utmp **@var{result})
+@safety{@mtunsafe{staticbuf, tempsig, stimer}@asunsafe{selfdeadlock, tempsig, stimer}@acunsafe{tempsig, stimer, lockleak, fdleak}}
+@c getutent_r staticbuf, tempsig, stimer, selfdeadlock, lockleak, fdleak
+@c libc_lock_lock dup selfdeadlock, lockleak
+@c *libc_utmp_jump_table->getutent_r staticbuf, tempsig, stimer, fdleak
+@c getutent_r_unknown staticbuf, fdleak
+@c setutent_unknown dup staticbuf, fdleak
+@c getutent_r_file staticbuf, tempsig, stimer
+@c LOCK_FILE tempsig, stimer
+@c alarm dup stimer
+@c sigemptyset dup ok
+@c sigaction dup ok
+@c memset dup ok
+@c fcntl_not_cancel dup ok
+@c LOCKING_FAILED ok
+@c read_not_cancel dup ok
+@c UNLOCK_FILE stimer
+@c fcntl_not_cancel dup ok
+@c alarm dup stimer
+@c sigaction dup ok
+@c memcpy dup ok
+@c libc_lock_unlock dup ok
The @code{getutent_r} is equivalent to the @code{getutent} function. It
returns the next entry from the database. But instead of storing the
information in a static buffer it stores it in the buffer pointed to by
@@ -1157,6 +1257,28 @@ This function is a GNU extension.
@comment utmp.h
@comment GNU
@deftypefun int getutline_r (const struct utmp *@var{line}, struct utmp *@var{buffer}, struct utmp **@var{result})
+@safety{@mtunsafe{staticbuf, tempsig, stimer}@asunsafe{selfdeadlock, tempsig, stimer}@acunsafe{tempsig, stimer, lockleak, fdleak}}
+@c getutline_r staticbuf, tempsig, stimer, selfdeadlock, lockleak, fdleak
+@c libc_lock_lock dup selfdeadlock, lockleak
+@c *libc_utmp_jump_table->getutline_r staticbuf, tempsig, stimer, fdleak
+@c getutline_r_unknown staticbuf, fdleak
+@c setutent_unknown dup staticbuf, fdleak
+@c getutline_r_file staticbuf, tempsig, stimer
+@c LOCK_FILE tempsig, stimer
+@c alarm dup stimer
+@c sigemptyset dup ok
+@c sigaction dup ok
+@c memset dup ok
+@c fcntl_not_cancel dup ok
+@c LOCKING_FAILED ok
+@c read_not_cancel dup ok
+@c strncmp dup ok
+@c UNLOCK_FILE stimer
+@c fcntl_not_cancel dup ok
+@c alarm dup stimer
+@c sigaction dup ok
+@c memcpy dup ok
+@c libc_lock_unlock dup ok
This function retrieves just like @code{getutline} the next entry
matching the information stored in @var{line}. But the result is stored
in the buffer pointed to by the parameter @var{buffer}.
@@ -1345,6 +1467,7 @@ a pointer to a @code{struct utmpx} instead of @code{struct utmp}. In
@comment utmpx.h
@comment XPG4.2
@deftypefun void endutxent (void)
+@safety{@mtunsafe{staticbuf}@asunsafe{selfdeadlock}@acunsafe{lockleak}}
This function is similar to @code{endutent}. In @theglibc{} it is
simply an alias for @code{endutent}.
@end deftypefun
@@ -1546,6 +1669,208 @@ user ID @var{uid}.
@comment pwd.h
@comment POSIX.1c
@deftypefun int getpwuid_r (uid_t @var{uid}, struct passwd *@var{result_buf}, char *@var{buffer}, size_t @var{buflen}, struct passwd **@var{result})
+@safety{@mtsafe{glocale}@asunsafe{oncesafe, shlimb, asmalloc, selfdeadlock}@acunsafe{incansist, lockleak, fdleak, memleak}}
+@c getpwuid_r glocale, oncesafe, shlimb, asmalloc, selfdeadlock, incansist, lockleak, fdleak, memleak
+@c nscd_getpwuid_r asmalloc, selfdeadlock, lockleak, fdleak, memleak
+@c itoa_word dup ok
+@c nscd_getpw_r asmalloc, selfdeadlock, lockleak, fdleak, memleak
+@c nscd_get_map_ref asmalloc, selfdeadlock, lockleak, fdleak, memleak
+@c nscd_acquire_maplock ok
+@c nscd_get_mapping asmalloc, selfdeadlock, lockleak, fdleak, memleak
+@c open_socket dup ok
+@c memset dup ok
+@c wait_on_socket dup ok
+@c recvmsg dup ok
+@c strcmp dup ok
+@c fstat64 dup ok
+@c mmap dup memleak
+@c munmap dup ok
+@c malloc dup selfdeadlock, lockleak, fdleak, memleak
+@c close dup ok
+@c nscd_unmap dup selfdeadlock, lockleak, fdleak, memleak
+@c nscd_cache_search ok
+@c nis_hash ok
+@c memcmp dup ok
+@c nscd_open_socket ok
+@c open_socket ok
+@c socket dup fdleak
+@c fcntl dup ok
+@c strcpy dup ok
+@c connect dup ok
+@c send dup ok
+@c gettimeofday dup ok
+@c poll dup ok
+@c close_not_cancel_no_status dup ok
+@c wait_on_socket dup ok
+@c read dup ok
+@c close_not_cancel_no_status dup ok
+@c readall ok
+@c read dup ok
+@c wait_on_socket ok
+@c poll dup ok
+@c gettimeofday dup ok
+@c memcpy dup ok
+@c close_not_cancel_no_status dup ok
+@c nscd_drop_map_ref selfdeadlock, lockleak, fdleak, memleak
+@c nscd_unmap dup selfdeadlock, lockleak, fdleak, memleak
+@c nscd_unmap selfdeadlock, lockleak, fdleak, memleak
+@c munmap dup ok
+@c free dup selfdeadlock, lockleak, fdleak, memleak
+@c nss_passwd_lookup2 glocale, shlimb, asmalloc, selfdeadlock, incansist, lockleak, fdleak, memleak
+@c nss_database_lookup glocale, asmalloc, selfdeadlock, incansist, memleak, fdleak, lockleak
+@c libc_lock_lock selfdeadlock, lockleak
+@c libc_lock_unlock lockleak
+@c nss_parse_file glocale, asmalloc, selfdeadlock, incansist, memleak, fdleak, lockleak
+@c fopen dup asmalloc, selfdeadlock, memleak, fdleak, lockleak
+@c fsetlocking dup ok [no concurrent uses]
+@c malloc dup selfdeadlock, lockleak, fdleak, memleak
+@c fclose dup asmalloc, selfdeadlock, memleak, fdleak, lockleak
+@c getline dup asmalloc, lockleak, incansist, memleak
+@c strchrnul dup ok
+@c nss_getline glocale, asmalloc, memleak
+@c isspace glocale^^
+@c strlen dup ok
+@c malloc dup selfdeadlock, lockleak, fdleak, memleak
+@c memcpy dup ok
+@c nss_parse_service_list dup glocale^, asmalloc, memleak
+@c feof_unlocked dup ok
+@c free dup selfdeadlock, lockleak, fdleak, memleak
+@c strcmp dup ok
+@c nss_parse_service_list glocale^, asmalloc, memleak
+@c isspace glocale^^
+@c malloc dup selfdeadlock, lockleak, fdleak, memleak
+@c mempcpy dup ok
+@c strncasecmp dup ok
+@c free dup selfdeadlock, lockleak, fdleak, memleak
+@c malloc dup selfdeadlock, lockleak, fdleak, memleak
+@c nss_lookup shlimb, asmalloc, selfdeadlock, incansist, lockleak, fdleak, memleak
+@c nss_lookup_function shlimb, asmalloc, selfdeadlock, incansist, lockleak, fdleak, memleak
+@c libc_lock_lock selfdeadlock, lockleak
+@c tsearch asmalloc, incansist, memleak [no xguargs or asynconsist due to locking]
+@c known_compare ok
+@c strcmp dup ok
+@c malloc dup selfdeadlock, lockleak, fdleak, memleak
+@c tdelete asmalloc, incansist, memleak [no xguargs or asynconsist due to locking]
+@c free dup selfdeadlock, lockleak, fdleak, memleak
+@c nss_load_library shlimb, asmalloc, sefldeadlock, lockleak, fdleak, memleak
+@c nss_new_service asmalloc, memleak
+@c strcmp dup ok
+@c malloc dup selfdeadlock, lockleak, fdleak, memleak
+@c strlen dup ok
+@c stpcpy dup ok
+@c libc_dlopen shlimb, asmalloc, selfdeadlock, lockleak, fdleak, memleak
+@c libc_dlsym dup selfdeadlock, lockleak, fdleak, memleak
+@c *ifct(*nscd_init_cb)
+@c stpcpy dup ok
+@c libc_dlsym dup selfdeadlock, lockleak, fdleak, memleak
+@c libc_lock_unlock dup ok
+@c nss_next_action ok
+@c *fct.l -> _nss_*_getpwuid_r glocale, oncesafe, asmalloc, selfdeadlock, incansist, lockleak, memleak, fdleak
+@c nss_next2 shlimb, asmalloc, selfdeadlock, incansist, lockleak, fdleak, memleak
+@c nss_next_action dup ok
+@c nss_lookup_function dup shlimb, asmalloc, selfdeadlock, incansist, lockleak, fdleak, memleak
+
+@c _nss_files_getpwuid_r glocale, asmalloc, selfdeadlock, lockleak, memleak, fdleak
+@c libc_lock_lock dup selfdeadlock, lockleak
+@c internal_setent asmalloc, selfdeadlock, lockleak, memleak, fdleak
+@c fopen dup asmalloc, selfdeadlock, memleak, fdleak, lockleak
+@c fileno dup ok
+@c fcntl dup ok
+@c fclose dup asmalloc, selfdeadlock, lockleak, memleak, fdleak
+@c rewind dup lockleak [stream guarded by non-recursive pwent lock]
+@c internal_getent glocale^
+@c fgets_unlocked dup ok [stream guarded by non-recursive pwent lock]
+@c isspace dup glocale^^
+@c _nss_files_parse_pwent = parse_line ok
+@c strpbrk dup ok
+@c internal_endent asmalloc, selfdeadlock, lockleak, memleak, fdleak
+@c fclose dup asmalloc, selfdeadlock, lockleak, memleak, fdleak
+@c libc_lock_unlock dup lockleak
+
+@c _nss_nis_getpwuid_r ... not fully reviewed (assumed) oncesafe, selfdeadlock, incansist, lockleak
+@c yp_get_default_domain selfdeadlock, lockleak
+@c libc_lock_lock dup selfdeadlock, lockleak
+@c getdomainname dup ok
+@c strcmp dup ok
+@c libc_lock_unlock dup lockleak
+@c snprintf dup asmalloc, memleak
+@c yp_match
+@c do_ypcall_tr(xdr_ypreq_key,xdr_ypresp_val)
+@c do_ypcall(xdr_ypreq_key,xdr_ypresp_val)
+@c libc_lock_lock selfdeadlock, lockleak
+@c strcmp
+@c yp_bind
+@c ypclnt_call
+@c clnt_call
+@c clnt_perror
+@c libc_lock_unlock lockleak
+@c yp_unbind_locked
+@c yp_unbind
+@c strcmp dup ok
+@c calloc dup selfdeadlock, lockleak, fdleak, memleak
+@c yp_bind_file
+@c strlen dup ok
+@c snprintf dup asmalloc, memleak
+@c open dup fdleak, cancelpt
+@c pread dup cancelpt
+@c yp_bind_client_create
+@c close dup fdleak, cancelpt
+@c yp_bind_ypbindprog
+@c clnttcp_create
+@c clnt_destroy
+@c clnt_call(xdr_domainname,xdr_ypbind_resp)
+@c memset dup ok
+@c yp_bind_client_create
+@c free dup selfdeadlock, lockleak, fdleak, memleak
+@c calloc dup selfdeadlock, lockleak, fdleak, memleak
+@c free dup selfdeadlock, lockleak, fdleak, memleak
+@c ypprot_err
+@c memcpy dup ok
+@c xdr_free(xdr_ypresp_val)
+@c xdr_ypresp_val
+@c xdr_ypstat
+@c xdr_enum
+@c XDR_PUTLONG
+@c *x_putlong
+@c XDR_GETLONG
+@c *x_getlong
+@c xdr_long
+@c XDR_PUTLONG dup
+@c XDR_GETLONG dup
+@c xdr_short
+@c XDR_PUTLONG dup
+@c XDR_GETLONG dup
+@c xdr_valdat
+@c xdr_bytes
+@c xdr_u_int
+@c XDR_PUTLONG dup
+@c XDR_GETLONG dup
+@c mem_alloc asmalloc, memleak
+@c malloc dup selfdeadlock, lockleak, fdleak, memleak
+@c xdr_opaque
+@c XDR_GETBYTES
+@c *x_getbytes
+@c XDR_PUTBYTES
+@c *x_putbytes
+@c mem_free asmalloc, memleak
+@c free dup selfdeadlock, lockleak, fdleak, memleak
+@c yperr2nss ok
+@c strchr dup ok
+@c _nls_default_nss oncesafe, asmalloc, selfdeadlock, incansist, memleak, fdleak, lockleak
+@c init oncesafe^, asmalloc, selfdeadlock, incansist, memleak, fdleak, lockleak
+@c fopen dup asmalloc, selfdeadlock, memleak, fdleak, lockleak
+@c fsetlocking ok [no concurrent uses]
+@c feof_unlocked dup ok
+@c getline dup asmalloc, lockleak, incansist, memleak
+@c isspace dup glocale^^
+@c strncmp dup ok
+@c free dup selfdeadlock, memleak, fdleak, lockleak
+@c fclose dup asmalloc, selfdeadlock, lockleak, memleak, fdleak
+@c free dup selfdeadlock, memleak, fdleak, lockleak
+@c mempcpy dup ok
+@c strncpy dup ok
+@c isspace dup glocale^^
+@c _nss_files_parse_pwent ok
This function is similar to @code{getpwuid} in that it returns
information about the user whose user ID is @var{uid}. However, it
fills the user supplied structure pointed to by @var{result_buf} with
@@ -1579,6 +1904,25 @@ A null pointer return indicates there is no user named @var{name}.
@comment pwd.h
@comment POSIX.1c
@deftypefun int getpwnam_r (const char *@var{name}, struct passwd *@var{result_buf}, char *@var{buffer}, size_t @var{buflen}, struct passwd **@var{result})
+@safety{@mtsafe{glocale}@asunsafe{oncesafe, shlimb, asmalloc, selfdeadlock}@acunsafe{incansist, lockleak, fdleak, memleak}}
+@c getpwnam_r glocale, oncesafe, shlimb, asmalloc, selfdeadlock, incansist, lockleak, fdleak, memleak
+@c nscd_getpwnam_r asmalloc, selfdeadlock, lockleak, fdleak, memleak
+@c strlen dup ok
+@c nscd_getpw_r dup asmalloc, selfdeadlock, lockleak, fdleak, memleak
+@c nss_passwd_lookup2 dup glocale, shlimb, asmalloc, selfdeadlock, incansist, lockleak, fdleak, memleak
+@c *fct.l
+@c nss_next2 dup shlimb, asmalloc, selfdeadlock, incansist, lockleak, fdleak, memleak
+@c
+@c _nss_files_getpwnam_r glocale, asmalloc, selfdeadlock, lockleak, memleak, fdleak
+@c libc_lock_lock dup selfdeadlock, lockleak
+@c internal_setent dup asmalloc, selfdeadlock, lockleak, memleak, fdleak
+@c internal_getent dup glocale^
+@c strcmp dup ok
+@c internal_endent dup asmalloc, selfdeadlock, lockleak, memleak, fdleak
+@c libc_lock_unlock dup lockleak
+@c
+@c _nss_*_getpwnam_r (assumed) oncesafe, selfdeadlock, incansist, lockleak
+
This function is similar to @code{getpwnam} in that is returns
information about the user whose user name is @var{name}. However, like
@code{getpwuid_r}, it fills the user supplied buffers in