diff options
| author | Chris Mason <mason@kernel.org> | 2026-10-07 11:00:06 +0000 |
|---|---|---|
| committer | Amir Goldstein <amir73il@gmail.com> | 2026-10-29 13:22:29 +0100 |
| commit | f635192ad223d2009ee640b63adf5ce3198aa338 (patch) | |
| tree | 207a76fff0086e58b491321199deae847814218f /scripts/Makefile.thinlto | |
| parent | 16d319e12328acafeafd3eecdf09c46d7fb43452 (diff) | |
| download | linux-f635192ad223d2009ee640b63adf5ce3198aa338.tar.gz linux-f635192ad223d2009ee640b63adf5ce3198aa338.zip | |
ovl: do not copy up a dentry that was removed
A change to a removed file through an open descriptor replaces whatever
has its old name in the upper layer.
Copy up must only create a name in the upper directory, never replace
one. After an unlink, an rmdir or a rename over a lower dentry, a
dentry that an open file keeps alive still has its old parent and name,
but in the upper directory that name is now a whiteout or a new object.
ovl_copy_up_workdir() renames the copy over it, which brings back the
removed object and destroys whatever took its name.
An unprivileged user opened a lower FIFO and unlinked it, root created
a file at that name, and fchmod on the old descriptor replaced the file
of root with the FIFO.
Fix this by looking up the target name of the rename in
ovl_copy_up_workdir() with LOOKUP_EXCL, so that copy up fails with
-EEXIST if the name is taken, as copy up with O_TMPFILE already does
when it links the copy to the name.
Fixes: e9be9d5e76e3 ("overlay filesystem")
Cc: stable@vger.kernel.org
Signed-off-by: Chris Mason <mason@kernel.org>
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
[amir: use LOOKUP_EXCL instead of relying on d_unhashed()]
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Diffstat (limited to 'scripts/Makefile.thinlto')
0 files changed, 0 insertions, 0 deletions
