From: Yang Xu <xuyang2018.jy@cn.fujitsu.com>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH] semctl09: Fix heap smash
Date: Mon, 18 Jan 2021 17:10:57 +0800 [thread overview]
Message-ID: <600550A1.3000605@cn.fujitsu.com> (raw)
In-Reply-To: <20210115151910.3592-1-mdoucha@suse.cz>
Hi Martin
LGTM, pushed. Thanks.
Best Regards
Yang Xu
> semctl() expects pointer to a buffer as its fourth argument, not pointer
> to a pointer. Passing&un.buf results in heap smash that corrupts internal
> LTP data structures on some archs.
>
> CC: Feiyu Zhu<zhufy.jy@cn.fujitsu.com>
> Signed-off-by: Martin Doucha<mdoucha@suse.cz>
> ---
> testcases/kernel/syscalls/ipc/semctl/semctl09.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/testcases/kernel/syscalls/ipc/semctl/semctl09.c b/testcases/kernel/syscalls/ipc/semctl/semctl09.c
> index 131bfbc07..d36ba62e5 100644
> --- a/testcases/kernel/syscalls/ipc/semctl/semctl09.c
> +++ b/testcases/kernel/syscalls/ipc/semctl/semctl09.c
> @@ -51,11 +51,15 @@ static union semun un;
> */
> static inline int do_semctl(int semid, int semnum, int cmd)
> {
> + struct semid_ds info;
> +
> + un.buf =&info;
> +
> switch (tst_variant) {
> case 0:
> - return tst_syscall(__NR_semctl, semid, semnum, cmd,&un.buf);
> + return tst_syscall(__NR_semctl, semid, semnum, cmd, un);
> case 1:
> - return semctl(semid, semnum, cmd,&un.buf);
> + return semctl(semid, semnum, cmd, un);
> }
> return -1;
> }
prev parent reply other threads:[~2021-01-18 9:10 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-15 15:19 [LTP] [PATCH] semctl09: Fix heap smash Martin Doucha
2021-01-18 9:10 ` Yang Xu [this message]
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=600550A1.3000605@cn.fujitsu.com \
--to=xuyang2018.jy@cn.fujitsu.com \
--cc=ltp@lists.linux.it \
/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