From: Cyril Hrubis <chrubis@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH] syscalls/copy_file_range02.c: Compatible with new and old kernels
Date: Fri, 31 May 2019 14:26:30 +0200 [thread overview]
Message-ID: <20190531122630.GA12608@rei.lan> (raw)
In-Reply-To: <CAEemH2erJkdcKU_qg8RsjWUf7A37wj1QgMv=UZ21xUy=vXq9rg@mail.gmail.com>
Hi!
> I have no objection on this. But, is there really make sense to test some
> more non regular files which not being mentioned by Linux Manual Page?
>
> The copy_file_range02 test errors are all extract from manual page, I
> commented that in Christian's first patch version. And I don't think it's
> necessary to test undefined behavior in syscall using, because how do we
> know what error return is the expected?
That's not undefined that's undocummented at best. The kernel code for
vfs_copy_file_range does:
if (S_ISDIR(inode_in->i_mode) || S_ISDIR(inode_out->i_mode))
return -EISDIR;
if (!S_ISREG(inode_in->i_mode) || !S_ISREG(inode_out->i_mode))
return -EINVAL;
Which means that directories are treated as special here and all other file
descriptors that are not regular files are supposed to fail with EINVAL.
So as far as I can tell it makes sense to pass a pipe fd for example and check
for EINVAL. And we should do that both for in_fd and out_fd as well.
--
Cyril Hrubis
chrubis@suse.cz
next prev parent reply other threads:[~2019-05-31 12:26 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-31 8:44 [LTP] [PATCH] syscalls/copy_file_range02.c: Compatible with new and old kernels Jinhui huang
2019-05-31 10:02 ` Li Wang
2019-05-31 10:15 ` Xiao Yang
2019-05-31 12:03 ` Li Wang
2019-05-31 12:26 ` Cyril Hrubis [this message]
2019-05-31 12:46 ` Li Wang
2019-05-31 13:02 ` Amir Goldstein
2019-06-27 8:03 ` Yang Xu
2019-06-27 8:39 ` Amir Goldstein
2019-07-04 10:35 ` Yang Xu
2019-07-04 11:15 ` Amir Goldstein
2019-05-31 11:01 ` Cyril Hrubis
2019-05-31 11:47 ` Li Wang
2019-05-31 12:00 ` Cyril Hrubis
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=20190531122630.GA12608@rei.lan \
--to=chrubis@suse.cz \
--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