files: try to change fsuid only if linkat() failed
We found that linkat for "unsafe" files doesn't work in userns if a file uid isn't equal to the currect fsuid. This issue was fixed by changing fsuid before calling linkat. But in this case we are not able to createa link if a target directory doesn't have write premissions. Starting with the 4.3 kernel, it's possible to create links of "unsafe files": f2ca379642d7 ("namei: permit linking with CAP_FOWNER in userns") So we can try to call linkat() without changing fsuid and make one more attempt with changing fsuid if the first one failed with EPERM. Signed-off-by:Andrew Vagin <avagin@virtuozzo.com> Signed-off-by:
Pavel Emelyanov <xemul@virtuozzo.com>
Showing
Please
register
or
sign in
to comment