From: Daniel G. <dg...@su...> - 2008-10-20 13:07:58
|
On Monday 20 October 2008 14:47:36 Subrata Modak wrote: > > > > > > Not sure why ?? > > > > I just sent some patches for setgroups02_16 - looks like it's a similar > > problem for setgroups01_16 (for some reason setgroups01_16 didn't failed for > > me, only setgroups02_16) > > > > Anyway, i guess the reason is the use of the uninitialized groups list and > > passing the _full_ length to the syscalls. > > > > Could you try attached patch? > > Yes, the attached Patch solves the problem reported on x86_64 and does > not interfere with architectures where it was already passing. Thanks > for this. Not quite sure whats going on with sourceforge today - patch queue got actually sent out few hours ago. I just attach both patches here once again: ------------------------------->8--------------------------------------- Subject: fix setgroups02 by calling setgroups()/getgroups with correct list size setgroups02(_16) is working with an uninitialized list, expect the first GID field. setgroups() and getgroups() additionally get called with the full length of the uninitialized list. The uninitialized values cause setgroups02_16 to fail: === setgroups02_16 1 BROK : gid returned from getgroups is too large for testing setgroups32 === Since the uninitialized values could be greater then 0xffff. Signed-off-by: Daniel Gollub <dg...@su...> --- Index: ltp-full-20081017/testcases/kernel/syscalls/setgroups/setgroups02.c =================================================================== --- ltp-full-20081017.orig/testcases/kernel/syscalls/setgroups/setgroups02.c +++ ltp-full-20081017/testcases/kernel/syscalls/setgroups/setgroups02.c @@ -91,7 +91,7 @@ main(int ac, char **av) { int lc,i; /* loop counters */ char *msg; /* message returned from parse_opts */ - int gidsetsize = NGROUPS; /* total groups */ + int gidsetsize = 1; /* only one GID, the GID of TESTUSER */ int PASS_FLAG = 0; /* used for checking group array */ /* Parse standard options given to run the test. */ ----------------------------------------->8------------------------------------ Subject: corrected signed/unsigned types of SETGROUPS/GETGROUPS compat functions in setgroups/compat_16.h Change argument list of GETGROUPS/SETGROUPS to represent the argument list of the syscalls. getgroups() first argument is a signed int! Signed-off-by: Daniel Gollub <dg...@su...> --- testcases/kernel/syscalls/setgroups/compat_16.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) Index: ltp-full-20081020/testcases/kernel/syscalls/setgroups/compat_16.h =================================================================== --- ltp-full-20081020.orig/testcases/kernel/syscalls/setgroups/compat_16.h +++ ltp-full-20081020/testcases/kernel/syscalls/setgroups/compat_16.h @@ -32,13 +32,13 @@ extern void cleanup(void); #ifdef TST_USE_COMPAT16_SYSCALL long -SETGROUPS(int gidsetsize, GID_T *list) +SETGROUPS(size_t gidsetsize, GID_T *list) { return syscall(__NR_setgroups, gidsetsize, list); } int -GETGROUPS(size_t size16, GID_T *list16) +GETGROUPS(int size16, GID_T *list16) { int r; int i; @@ -75,7 +75,7 @@ SETGROUPS(size_t size, const GID_T *list } int -GETGROUPS(size_t size, GID_T *list) +GETGROUPS(int size, GID_T *list) { return getgroups(size, list); } |