standards/172276: POSIX: {get,
set}groups gidsetsize is u_int not int
Ed Maste
emaste at FreeBSD.org
Tue Oct 2 16:00:29 UTC 2012
>Number: 172276
>Category: standards
>Synopsis: POSIX: {get,set}groups gidsetsize is u_int not int
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-standards
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Tue Oct 02 16:00:21 UTC 2012
>Closed-Date:
>Last-Modified:
>Originator: Ed Maste
>Release: FreeBSD 9.0-STABLE i386
>Organization:
ADARA Networks
>Environment:
System: FreeBSD freefall.freebsd.org 9.0-STABLE FreeBSD 9.0-STABLE #6 r235139: Tue May 8 21:19:03 UTC 2012 simon at freefall.freebsd.org:/usr/obj/usr/src/sys/FREEFALL i386
>Description:
GNU Autoconf doesn't like our getgroups:
On some platforms, this function fails to reject a negative count,
even though that is less than the size that would be returned:
>How-To-Repeat:
Run gnulib autoconf,
configure:54098: checking whether getgroups handles negative values
http://pubs.opengroup.org/onlinepubs/9699919799/functions/getgroups.html
>Fix:
--- getsetgroups_arg.diff begins here ---
Index: sys/kern/kern_prot.c
===================================================================
--- sys/kern/kern_prot.c (revision 240919)
+++ sys/kern/kern_prot.c (working copy)
@@ -279,7 +279,7 @@
#ifndef _SYS_SYSPROTO_H_
struct getgroups_args {
- u_int gidsetsize;
+ int gidsetsize;
gid_t *gidset;
};
#endif
@@ -801,7 +801,7 @@
#ifndef _SYS_SYSPROTO_H_
struct setgroups_args {
- u_int gidsetsize;
+ int gidsetsize;
gid_t *gidset;
};
#endif
@@ -812,7 +812,7 @@
gid_t *groups = NULL;
int error;
- if (uap->gidsetsize > ngroups_max + 1)
+ if (uap->gidsetsize < 0 || uap->gidsetsize > ngroups_max + 1)
return (EINVAL);
groups = malloc(uap->gidsetsize * sizeof(gid_t), M_TEMP, M_WAITOK);
error = copyin(uap->gidset, groups, uap->gidsetsize * sizeof(gid_t));
Index: sys/kern/systrace_args.c
===================================================================
--- sys/kern/systrace_args.c (revision 240919)
+++ sys/kern/systrace_args.c (working copy)
@@ -491,7 +491,7 @@
/* getgroups */
case 79: {
struct getgroups_args *p = params;
- uarg[0] = p->gidsetsize; /* u_int */
+ iarg[0] = p->gidsetsize; /* int */
uarg[1] = (intptr_t) p->gidset; /* gid_t * */
*n_args = 2;
break;
@@ -499,7 +499,7 @@
/* setgroups */
case 80: {
struct setgroups_args *p = params;
- uarg[0] = p->gidsetsize; /* u_int */
+ iarg[0] = p->gidsetsize; /* int */
uarg[1] = (intptr_t) p->gidset; /* gid_t * */
*n_args = 2;
break;
Index: sys/kern/syscalls.master
===================================================================
--- sys/kern/syscalls.master (revision 240919)
+++ sys/kern/syscalls.master (working copy)
@@ -183,9 +183,9 @@
77 AUE_NULL OBSOL vlimit
78 AUE_MINCORE STD { int mincore(const void *addr, size_t len, \
char *vec); }
-79 AUE_GETGROUPS STD { int getgroups(u_int gidsetsize, \
+79 AUE_GETGROUPS STD { int getgroups(int gidsetsize, \
gid_t *gidset); }
-80 AUE_SETGROUPS STD { int setgroups(u_int gidsetsize, \
+80 AUE_SETGROUPS STD { int setgroups(int gidsetsize, \
gid_t *gidset); }
81 AUE_GETPGRP STD { int getpgrp(void); }
82 AUE_SETPGRP STD { int setpgid(int pid, int pgid); }
Index: sys/compat/freebsd32/syscalls.master
===================================================================
--- sys/compat/freebsd32/syscalls.master (revision 240919)
+++ sys/compat/freebsd32/syscalls.master (working copy)
@@ -181,9 +181,9 @@
77 AUE_NULL OBSOL vlimit
78 AUE_MINCORE NOPROTO { int mincore(const void *addr, size_t len, \
char *vec); }
-79 AUE_GETGROUPS NOPROTO { int getgroups(u_int gidsetsize, \
+79 AUE_GETGROUPS NOPROTO { int getgroups(int gidsetsize, \
gid_t *gidset); }
-80 AUE_SETGROUPS NOPROTO { int setgroups(u_int gidsetsize, \
+80 AUE_SETGROUPS NOPROTO { int setgroups(int gidsetsize, \
gid_t *gidset); }
81 AUE_GETPGRP NOPROTO { int getpgrp(void); }
82 AUE_SETPGRP NOPROTO { int setpgid(int pid, int pgid); }
--- getsetgroups_arg.diff ends here ---
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-standards
mailing list