From: Petr Vorel <pvorel@suse.cz>
To: Cyril Hrubis <chrubis@suse.cz>
Cc: ltp@lists.linux.it, Richard Palethorpe <rpalethorpe@suse.com>
Subject: Re: [LTP] [PATCH v2 2/2] Refactor getegid02 using new LTP API
Date: Tue, 17 Oct 2023 14:41:54 +0200 [thread overview]
Message-ID: <20231017124154.GA934761@pevik> (raw)
In-Reply-To: <ZS6A3Ug9qkTKPah9@yuki>
> Hi!
> > This code is based on Cyril's suggestion in v1 [1]
> > if (GID_SIZE_CHECK(st_egid))
> > TST_EXP_EQ_LI(gid, st_egid);
> > else
> > tst_res(TPASS, "getegid() passed");
> > I wonder which system returns 16 bit gid?
> > man getgid(2) says that originally there was only 16 bit, than kernel 2.4 added
> > support for 32 bit and the glibc getegid() wrapper transparently deal with this.
> > Because even I compile as 32 bit:
> > $ file getegid01_16
> > getegid01_16: ELF 32-bit LSB pie executable, Intel 80386
> > I get comparison, thus 32 bit:
> > $ ./getegid01_16
> > ...
> > getegid01.c:25: TPASS: gid == st_egid (1000)
> > What am I missing?
> This obviously works since 1000 < 32767. As long as the GID fits 16bit
> integer everything works fine with 16bit syscalls. The check returns if
> the egid does fit and returns true if so.
> When the GID does not fit, kernel returns overflow GID, i.e. for all
> values bigger than 16 bit you get the same GID value that does not
> correspond to the actual GID value at all.
> So to make the check false, you have to set up the test user so that it
> has GID > 16bit integer maximum value.
Thanks a lot, Cyril!
Kind regards,
Petr
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2023-10-17 12:42 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-08 14:14 [LTP] [PATCH v2 0/2] Refactor getegid testing suite Andrea Cervesato
2023-09-08 14:14 ` [LTP] [PATCH v2 1/2] Refactor getegid01 using new LTP API Andrea Cervesato
2023-09-08 14:14 ` [LTP] [PATCH v2 2/2] Refactor getegid02 " Andrea Cervesato
2023-10-17 11:35 ` Petr Vorel
2023-10-17 12:41 ` Cyril Hrubis
2023-10-17 12:41 ` Petr Vorel [this message]
2023-10-17 11:40 ` Petr Vorel
2023-10-17 8:24 ` [LTP] [PATCH v2 0/2] Refactor getegid testing suite Richard Palethorpe
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=20231017124154.GA934761@pevik \
--to=pvorel@suse.cz \
--cc=chrubis@suse.cz \
--cc=ltp@lists.linux.it \
--cc=rpalethorpe@suse.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