From: chrubis@suse.cz
To: Stanislav Kholmanskikh <stanislav.kholmanskikh@oracle.com>
Cc: vasily.isaenko@oracle.com, ltp-list@lists.sourceforge.net,
alexey.kodanev@oracle.com
Subject: Re: [LTP] [PATCH] prot_hsymlinks: explicitly close file descriptors
Date: Mon, 4 Nov 2013 16:26:22 +0100 [thread overview]
Message-ID: <20131104152621.GA11545@rei> (raw)
In-Reply-To: <1383285427-6049-1-git-send-email-stanislav.kholmanskikh@oracle.com>
Hi!
> This test case does not need to keep the file descriptors
> open after doing creat() on them. So we close them right after
> SAFE_CREAT.
>
> Otherwise on NFS it outputs:
>
> TWARN : tst_rmdir: rmobj(/tmpdir/ltp-vdIWJBmrkz/provfaUSg) failed: remove(/tmpdir/ltp-vdIWJBmrkz/provfaUSg/tmp_root/hsym) failed; errno=66: Directory not empty
>
> or:
> TWARN : tst_rmdir: rmobj(/mnt/proXZmq0T) failed: unlink(/mnt/proXZmq0T/root/.nfs00000000000008470000015e) failed; errno=16: Device or resource busy
>
> The same idea as for 8c200cb8e843724afb49fa6617fceec09ac826a5.
>
> Signed-off-by: Stanislav Kholmanskikh <stanislav.kholmanskikh@oracle.com>
> ---
> .../security/prot_hsymlinks/prot_hsymlinks.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/testcases/kernel/security/prot_hsymlinks/prot_hsymlinks.c b/testcases/kernel/security/prot_hsymlinks/prot_hsymlinks.c
> index 558681a..4c05e3f 100644
> --- a/testcases/kernel/security/prot_hsymlinks/prot_hsymlinks.c
> +++ b/testcases/kernel/security/prot_hsymlinks/prot_hsymlinks.c
> @@ -414,7 +414,7 @@ static void ufiles_add(int usr, char *path, int type)
> struct user_file *ufile = &users[usr].file[file];
>
> if (type == IS_FILE)
> - SAFE_CREAT(cleanup, path, 0644);
> + close(SAFE_CREAT(cleanup, path, 0644));
> else
> SAFE_MKDIR(cleanup, path, 0755);
>
There is quite a lot of places in LTP where we do creat() and then
close(), what about adding SAFE_TOUCH() with touch(1) sematics to the
safe_file_ops.h in LTP lib?
--
Cyril Hrubis
chrubis@suse.cz
------------------------------------------------------------------------------
Android is increasing in popularity, but the open development platform that
developers love is also attractive to malware creators. Download this white
paper to learn more about secure code signing practices that can help keep
Android apps secure.
http://pubads.g.doubleclick.net/gampad/clk?id=65839951&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-11-04 15:26 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-01 5:57 [LTP] [PATCH] prot_hsymlinks: explicitly close file descriptors Stanislav Kholmanskikh
2013-11-04 15:26 ` chrubis [this message]
[not found] ` <5278CF8E.7020104@oracle.com>
2013-11-05 16:46 ` chrubis
2013-11-06 8:23 ` [LTP] [PATCH V2 1/2] Implemented SAFE_TOUCH macro Stanislav Kholmanskikh
2013-11-06 11:03 ` chrubis
2013-11-06 8:23 ` [LTP] [PATCH V2 2/2] prot_hsymlinks: use SAFE_TOUCH Stanislav Kholmanskikh
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=20131104152621.GA11545@rei \
--to=chrubis@suse.cz \
--cc=alexey.kodanev@oracle.com \
--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