* [Patch v2] Add access function attributes to grp and shadow headers
@ 2022-03-10 22:31 Steve Grubb
2022-03-14 7:59 ` Siddhesh Poyarekar
0 siblings, 1 reply; 2+ messages in thread
From: Steve Grubb @ 2022-03-10 22:31 UTC (permalink / raw)
To: libc-alpha
This patch adds access function attributes to the re-entrant functions
in grp.h and shadow headers.
v2 - add missing parenthesis
---
grp/grp.h | 12 ++++++++----
gshadow/gshadow.h | 12 ++++++++----
shadow/shadow.h | 12 ++++++++----
3 files changed, 24 insertions(+), 12 deletions(-)
---
diff -urp glibc-2.35.9000-111-g2bbc694df2.orig/grp/grp.h glibc-2.35.9000-111-g2bbc694df2/grp/grp.h
--- glibc-2.35.9000-111-g2bbc694df2.orig/grp/grp.h 2022-02-28 10:47:38.000000000 -0500
+++ glibc-2.35.9000-111-g2bbc694df2/grp/grp.h 2022-03-10 11:56:18.733069367 -0500
@@ -130,7 +130,8 @@ extern struct group *getgrnam (const cha
# ifdef __USE_GNU
extern int getgrent_r (struct group *__restrict __resultbuf,
char *__restrict __buffer, size_t __buflen,
- struct group **__restrict __result);
+ struct group **__restrict __result)
+ __attr_access ((__write_only__, 2, 3));
# endif
/* Search for an entry with a matching group ID.
@@ -139,7 +140,8 @@ extern int getgrent_r (struct group *__r
marked with __THROW. */
extern int getgrgid_r (__gid_t __gid, struct group *__restrict __resultbuf,
char *__restrict __buffer, size_t __buflen,
- struct group **__restrict __result);
+ struct group **__restrict __result)
+ __attr_access ((__write_only__, 3, 4));
/* Search for an entry with a matching group name.
@@ -148,7 +150,8 @@ extern int getgrgid_r (__gid_t __gid, st
extern int getgrnam_r (const char *__restrict __name,
struct group *__restrict __resultbuf,
char *__restrict __buffer, size_t __buflen,
- struct group **__restrict __result);
+ struct group **__restrict __result)
+ __attr_access ((__write_only__, 3, 4));
# ifdef __USE_MISC
/* Read a group entry from STREAM. This function is not standardized
@@ -161,7 +164,8 @@ extern int getgrnam_r (const char *__res
extern int fgetgrent_r (FILE *__restrict __stream,
struct group *__restrict __resultbuf,
char *__restrict __buffer, size_t __buflen,
- struct group **__restrict __result);
+ struct group **__restrict __result)
+ __attr_access ((__write_only__, 3, 4));
# endif
#endif /* POSIX or reentrant */
diff -urp glibc-2.35.9000-111-g2bbc694df2.orig/gshadow/gshadow.h glibc-2.35.9000-111-g2bbc694df2/gshadow/gshadow.h
--- glibc-2.35.9000-111-g2bbc694df2.orig/gshadow/gshadow.h 2022-02-28 10:47:38.000000000 -0500
+++ glibc-2.35.9000-111-g2bbc694df2/gshadow/gshadow.h 2022-03-10 12:10:00.417407391 -0500
@@ -108,19 +108,23 @@ extern int putsgent (const struct sgrp *
or due to the implementation they are cancellation points and
therefore not marked with __THROW. */
extern int getsgent_r (struct sgrp *__result_buf, char *__buffer,
- size_t __buflen, struct sgrp **__result);
+ size_t __buflen, struct sgrp **__result)
+ __attr_access ((__write_only__, 2, 3));
extern int getsgnam_r (const char *__name, struct sgrp *__result_buf,
char *__buffer, size_t __buflen,
- struct sgrp **__result);
+ struct sgrp **__result)
+ __attr_access ((__write_only__, 3, 4));
extern int sgetsgent_r (const char *__string, struct sgrp *__result_buf,
char *__buffer, size_t __buflen,
- struct sgrp **__result);
+ struct sgrp **__result)
+ __attr_access ((__write_only__, 3, 4));
extern int fgetsgent_r (FILE *__stream, struct sgrp *__result_buf,
char *__buffer, size_t __buflen,
- struct sgrp **__result);
+ struct sgrp **__result)
+ __attr_access ((__write_only__, 3, 4));
#endif /* misc */
__END_DECLS
diff -urp glibc-2.35.9000-111-g2bbc694df2.orig/shadow/shadow.h glibc-2.35.9000-111-g2bbc694df2/shadow/shadow.h
--- glibc-2.35.9000-111-g2bbc694df2.orig/shadow/shadow.h 2022-02-28 10:47:38.000000000 -0500
+++ glibc-2.35.9000-111-g2bbc694df2/shadow/shadow.h 2022-03-10 11:59:17.647530571 -0500
@@ -122,19 +122,23 @@ extern int putspent (const struct spwd *
or due to the implementation they are cancellation points and
therefore not marked with __THROW. */
extern int getspent_r (struct spwd *__result_buf, char *__buffer,
- size_t __buflen, struct spwd **__result);
+ size_t __buflen, struct spwd **__result)
+ __attr_access ((__write_only__, 2, 3));
extern int getspnam_r (const char *__name, struct spwd *__result_buf,
char *__buffer, size_t __buflen,
- struct spwd **__result);
+ struct spwd **__result)
+ __attr_access ((__write_only__, 3, 4));
extern int sgetspent_r (const char *__string, struct spwd *__result_buf,
char *__buffer, size_t __buflen,
- struct spwd **__result);
+ struct spwd **__result)
+ __attr_access ((__write_only__, 3, 4));
extern int fgetspent_r (FILE *__stream, struct spwd *__result_buf,
char *__buffer, size_t __buflen,
- struct spwd **__result);
+ struct spwd **__result)
+ __attr_access ((__write_only__, 3, 4));
#endif /* misc */
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [Patch v2] Add access function attributes to grp and shadow headers
2022-03-10 22:31 [Patch v2] Add access function attributes to grp and shadow headers Steve Grubb
@ 2022-03-14 7:59 ` Siddhesh Poyarekar
0 siblings, 0 replies; 2+ messages in thread
From: Siddhesh Poyarekar @ 2022-03-14 7:59 UTC (permalink / raw)
To: Steve Grubb, libc-alpha
On 11/03/2022 04:01, Steve Grubb via Libc-alpha wrote:
> This patch adds access function attributes to the re-entrant functions
> in grp.h and shadow headers.
>
> v2 - add missing parenthesis
>
> ---
This patch showed up as failed in patchwork CI:
https://patchwork.sourceware.org/project/glibc/patch/4708166.GXAFRqVoOG@x2/
https://www.delorie.com/trybots/32bit/7828/misc-tst-bz21269.out
However the failure is unrelated to this change. I ran tst-bz21269 in a
loop with and without this patch and found that it occasionally timed
out. I've filed a separate bug for this:
https://sourceware.org/bugzilla/show_bug.cgi?id=28961
LGTM. I'll push once my test run completes.
Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
> grp/grp.h | 12 ++++++++----
> gshadow/gshadow.h | 12 ++++++++----
> shadow/shadow.h | 12 ++++++++----
> 3 files changed, 24 insertions(+), 12 deletions(-)
> ---
> diff -urp glibc-2.35.9000-111-g2bbc694df2.orig/grp/grp.h glibc-2.35.9000-111-g2bbc694df2/grp/grp.h
> --- glibc-2.35.9000-111-g2bbc694df2.orig/grp/grp.h 2022-02-28 10:47:38.000000000 -0500
> +++ glibc-2.35.9000-111-g2bbc694df2/grp/grp.h 2022-03-10 11:56:18.733069367 -0500
> @@ -130,7 +130,8 @@ extern struct group *getgrnam (const cha
> # ifdef __USE_GNU
> extern int getgrent_r (struct group *__restrict __resultbuf,
> char *__restrict __buffer, size_t __buflen,
> - struct group **__restrict __result);
> + struct group **__restrict __result)
> + __attr_access ((__write_only__, 2, 3));
> # endif
>
> /* Search for an entry with a matching group ID.
> @@ -139,7 +140,8 @@ extern int getgrent_r (struct group *__r
> marked with __THROW. */
> extern int getgrgid_r (__gid_t __gid, struct group *__restrict __resultbuf,
> char *__restrict __buffer, size_t __buflen,
> - struct group **__restrict __result);
> + struct group **__restrict __result)
> + __attr_access ((__write_only__, 3, 4));
>
> /* Search for an entry with a matching group name.
>
> @@ -148,7 +150,8 @@ extern int getgrgid_r (__gid_t __gid, st
> extern int getgrnam_r (const char *__restrict __name,
> struct group *__restrict __resultbuf,
> char *__restrict __buffer, size_t __buflen,
> - struct group **__restrict __result);
> + struct group **__restrict __result)
> + __attr_access ((__write_only__, 3, 4));
>
> # ifdef __USE_MISC
> /* Read a group entry from STREAM. This function is not standardized
> @@ -161,7 +164,8 @@ extern int getgrnam_r (const char *__res
> extern int fgetgrent_r (FILE *__restrict __stream,
> struct group *__restrict __resultbuf,
> char *__restrict __buffer, size_t __buflen,
> - struct group **__restrict __result);
> + struct group **__restrict __result)
> + __attr_access ((__write_only__, 3, 4));
> # endif
>
> #endif /* POSIX or reentrant */
> diff -urp glibc-2.35.9000-111-g2bbc694df2.orig/gshadow/gshadow.h glibc-2.35.9000-111-g2bbc694df2/gshadow/gshadow.h
> --- glibc-2.35.9000-111-g2bbc694df2.orig/gshadow/gshadow.h 2022-02-28 10:47:38.000000000 -0500
> +++ glibc-2.35.9000-111-g2bbc694df2/gshadow/gshadow.h 2022-03-10 12:10:00.417407391 -0500
> @@ -108,19 +108,23 @@ extern int putsgent (const struct sgrp *
> or due to the implementation they are cancellation points and
> therefore not marked with __THROW. */
> extern int getsgent_r (struct sgrp *__result_buf, char *__buffer,
> - size_t __buflen, struct sgrp **__result);
> + size_t __buflen, struct sgrp **__result)
> + __attr_access ((__write_only__, 2, 3));
>
> extern int getsgnam_r (const char *__name, struct sgrp *__result_buf,
> char *__buffer, size_t __buflen,
> - struct sgrp **__result);
> + struct sgrp **__result)
> + __attr_access ((__write_only__, 3, 4));
>
> extern int sgetsgent_r (const char *__string, struct sgrp *__result_buf,
> char *__buffer, size_t __buflen,
> - struct sgrp **__result);
> + struct sgrp **__result)
> + __attr_access ((__write_only__, 3, 4));
>
> extern int fgetsgent_r (FILE *__stream, struct sgrp *__result_buf,
> char *__buffer, size_t __buflen,
> - struct sgrp **__result);
> + struct sgrp **__result)
> + __attr_access ((__write_only__, 3, 4));
> #endif /* misc */
>
> __END_DECLS
> diff -urp glibc-2.35.9000-111-g2bbc694df2.orig/shadow/shadow.h glibc-2.35.9000-111-g2bbc694df2/shadow/shadow.h
> --- glibc-2.35.9000-111-g2bbc694df2.orig/shadow/shadow.h 2022-02-28 10:47:38.000000000 -0500
> +++ glibc-2.35.9000-111-g2bbc694df2/shadow/shadow.h 2022-03-10 11:59:17.647530571 -0500
> @@ -122,19 +122,23 @@ extern int putspent (const struct spwd *
> or due to the implementation they are cancellation points and
> therefore not marked with __THROW. */
> extern int getspent_r (struct spwd *__result_buf, char *__buffer,
> - size_t __buflen, struct spwd **__result);
> + size_t __buflen, struct spwd **__result)
> + __attr_access ((__write_only__, 2, 3));
>
> extern int getspnam_r (const char *__name, struct spwd *__result_buf,
> char *__buffer, size_t __buflen,
> - struct spwd **__result);
> + struct spwd **__result)
> + __attr_access ((__write_only__, 3, 4));
>
> extern int sgetspent_r (const char *__string, struct spwd *__result_buf,
> char *__buffer, size_t __buflen,
> - struct spwd **__result);
> + struct spwd **__result)
> + __attr_access ((__write_only__, 3, 4));
>
> extern int fgetspent_r (FILE *__stream, struct spwd *__result_buf,
> char *__buffer, size_t __buflen,
> - struct spwd **__result);
> + struct spwd **__result)
> + __attr_access ((__write_only__, 3, 4));
> #endif /* misc */
>
>
>
>
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-03-14 7:59 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-10 22:31 [Patch v2] Add access function attributes to grp and shadow headers Steve Grubb
2022-03-14 7:59 ` Siddhesh Poyarekar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).