]> git.ipfire.org Git - thirdparty/coreutils.git/commit
cp: fclonefileat security fix + CLONE_ACL + fixups
authorPaul Eggert <eggert@cs.ucla.edu>
Fri, 10 Feb 2023 21:34:54 +0000 (13:34 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Thu, 16 Feb 2023 23:40:06 +0000 (15:40 -0800)
commit4b0573916804b8b3a3ce73b6f8345c06bda6056e
tree77608060ba4fcd6df8b8c8f162d4a9ffef22e2c2
parentcf80f988eeb97cc3f8c65ae58e735d36f865277b
cp: fclonefileat security fix + CLONE_ACL + fixups

* src/copy.c: Some changes if HAVE_FCLONEFILEAT && !USE_XATTR.
(fd_has_acl): New function.
(CLONE_ACL): Default to 0.
(copy_reg): Use CLONE_NOFOLLOW to avoid races like CVE-2021-30995
<https://www.trendmicro.com/en_us/research/22/a/
analyzing-an-old-bug-and-discovering-cve-2021-30995-.html>.
Use CLONE_ACL if available and working, falling back to cloning
without it if it fails due to EINVAL.
If the only problem with fclonefileat is that it would create the
file with the wrong timestamp, or with too few permissions,
do that but fix the timestamp and permissions afterwards,
rather than falling back on a traditional copy.
NEWS
src/copy.c