From: chrubis@suse.cz
To: Stanislav Kholmanskikh <stanislav.kholmanskikh@oracle.com>
Cc: vasily.isaenko@oracle.com, ltp-list@lists.sourceforge.net
Subject: Re: [LTP] [PATCH V2 2/2] syscalls/getgroups: added checks for 16-bit getgroups() syscall
Date: Tue, 27 Aug 2013 14:16:25 +0200 [thread overview]
Message-ID: <20130827121625.GH10995@rei.Home> (raw)
In-Reply-To: <1377596129-32367-2-git-send-email-stanislav.kholmanskikh@oracle.com>
Hi!
> Signed-off-by: Stanislav Kholmanskikh <stanislav.kholmanskikh@oracle.com>
> ---
> testcases/kernel/syscalls/getgroups/compat_16.h | 78 +++++++++++++++++++++
> testcases/kernel/syscalls/getgroups/getgroups01.c | 22 +++---
> testcases/kernel/syscalls/getgroups/getgroups03.c | 17 +++--
> 3 files changed, 99 insertions(+), 18 deletions(-)
> create mode 100644 testcases/kernel/syscalls/getgroups/compat_16.h
>
> diff --git a/testcases/kernel/syscalls/getgroups/compat_16.h b/testcases/kernel/syscalls/getgroups/compat_16.h
> new file mode 100644
> index 0000000..79d006e
> --- /dev/null
> +++ b/testcases/kernel/syscalls/getgroups/compat_16.h
> @@ -0,0 +1,78 @@
> +/*
> + * Copyright (c) 2013 Oracle and/or its affiliates. All Rights Reserved.
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License as
> + * published by the Free Software Foundation; either version 2 of
> + * the License, or (at your option) any later version.
> + *
> + * This program is distributed in the hope that it would be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write the Free Software Foundation,
> + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
> + *
> + * Author: Stanislav Kholmanskikh <stanislav.kholmanskikh@oracle.com>
> + *
> + */
> +
> +#ifndef __GETGROUPS_COMPAT_16_H__
> +#define __GETGROUPS_COMPAT_16_H__
> +
> +#include "compat_gid.h"
> +#include "linux_syscall_numbers.h"
> +
> +#ifdef TST_USE_COMPAT16_SYSCALL
> +
> +int SETGROUPS(size_t size, const GID_T *list16)
> +{
> + int r;
> + int i;
> +
> + gid_t *list32;
> + list32 = calloc(size, sizeof(gid_t));
> + if (list32 == NULL)
> + tst_brkm(TBROK | TERRNO, NULL,
> + "calloc() failed to allocate %zu bytes",
> + size * sizeof(gid_t));
> +
> + for (i = 0; i < size; i++)
> + list32[i] = list16[i];
> +
> + r = setgroups(size, list32);
> +
> + free(list32);
> +
> + return r;
> +}
I think that we should just use the 16 bit variant here as well, as
well. It's available if the compat getgroups is and there is no need to
call the 32 bit version.
Or do you want to explicitly assert that the 32 bit syscall returns the
same as the 16 bit? That would make some sense.
> +int GETGROUPS(int size, GID_T *list16)
> +{
> +# if (__NR_getgroups32 != __LTP__NR_INVALID_SYSCALL)
> + /* __NR_getgroups - 16-bit version of getgroups() syscall */
> + return ltp_syscall(__NR_getgroups, size, list16);
> +# else
> + /* The platform has no 16-bit version of getgroups() syscall */
> + tst_brkm(TCONF, NULL,
> + "16-bit version of getgroups() is not supported on your arch");
> +# endif /* __NR_getgroups32 */
> +}
> +
> +#else
> +
> +int SETGROUPS(size_t size, const GID_T *list32)
> +{
> + return setgroups(size, list32);
> +}
> +
> +int GETGROUPS(int size, GID_T *list32)
> +{
> + return getgroups(size, list32);
> +}
> +
> +#endif /* TST_USE_COMPAT16_SYSCALL */
> +
> +#endif /* __GETGROUPS_COMPAT_16_H__ */
But still it duplicates code in the tree, lets move it into some header
under 'LTP/include/sys/' and move compat_gid.h there as well.
--
Cyril Hrubis
chrubis@suse.cz
------------------------------------------------------------------------------
Introducing Performance Central, a new site from SourceForge and
AppDynamics. Performance Central is your source for news, insights,
analysis and resources for efficient Application Performance Management.
Visit us today!
http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
next prev parent reply other threads:[~2013-08-27 12:16 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-16 7:10 [LTP] [PATCH] syscalls/setgroups: fix implicit SETGROUPS parameter casting Stanislav Kholmanskikh
2013-08-22 13:13 ` chrubis
[not found] ` <52174875.9030606@oracle.com>
2013-08-23 11:39 ` chrubis
[not found] ` <521B331D.7050902@oracle.com>
2013-08-26 11:30 ` chrubis
[not found] ` <521B4D82.2060007@oracle.com>
2013-08-26 14:16 ` chrubis
[not found] ` <521B6875.8010202@oracle.com>
2013-08-27 9:35 ` [LTP] [PATCH V2 1/2] syscalls/setgroups: fix 16-bit versions of the testcases Stanislav Kholmanskikh
2013-08-27 9:35 ` [LTP] [PATCH V2 2/2] syscalls/getgroups: added checks for 16-bit getgroups() syscall Stanislav Kholmanskikh
2013-08-27 12:16 ` chrubis [this message]
[not found] ` <521D9C44.8090607@oracle.com>
2013-08-28 9:55 ` chrubis
[not found] ` <1377782535-15955-3-git-send-email-stanislav.kholmanskikh@oracle.com>
2013-09-02 15:23 ` [LTP] [PATCH V3 2/3] fixes for 16-bit syscalls testcases chrubis
[not found] ` <52259811.3000604@oracle.com>
2013-09-03 10:11 ` chrubis
[not found] ` <1378215677-14258-1-git-send-email-stanislav.kholmanskikh@oracle.com>
2013-09-04 13:37 ` [LTP] [PATCH V3.1 2/2] " chrubis
[not found] ` <1378364509-20971-1-git-send-email-stanislav.kholmanskikh@oracle.com>
2013-09-05 11:07 ` [LTP] [PATCH V4] 16-bit syscalls fixes chrubis
2013-09-09 12:07 ` chrubis
[not found] ` <1377782535-15955-4-git-send-email-stanislav.kholmanskikh@oracle.com>
2013-09-02 15:28 ` [LTP] [PATCH V3 3/3] syscalls/getgroups: added checks for 16-bit getgroups() syscall chrubis
[not found] ` <1377782535-15955-2-git-send-email-stanislav.kholmanskikh@oracle.com>
2013-09-02 15:59 ` [LTP] [PATCH V3 1/3] syscalls/utils/compat_16.mk: fix build dependencies chrubis
[not found] ` <52257D67.5020900@oracle.com>
2013-09-03 11:06 ` chrubis
2013-08-27 11:22 ` [LTP] [PATCH] syscalls/setgroups: fix implicit SETGROUPS parameter casting chrubis
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20130827121625.GH10995@rei.Home \
--to=chrubis@suse.cz \
--cc=ltp-list@lists.sourceforge.net \
--cc=stanislav.kholmanskikh@oracle.com \
--cc=vasily.isaenko@oracle.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox