readdir performance when copying to userspace

Bug #1881339 reported by Thadeu Lima de Souza Cascardo
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
linux (Ubuntu)
Fix Released
Undecided
Unassigned
Xenial
Triaged
Low
Unassigned
Bionic
In Progress
Low
Thadeu Lima de Souza Cascardo

Bug Description

The following fixes were backported to bionic and xenial to prevent a potential security issue:

    - Make filldir[64]() verify the directory entry filename is valid
    - filldir[64]: remove WARN_ON_ONCE() for bad directory entries

In that process, they introduced a potential performace impact on readdir. How much is yet to be measured.

9f79b78ef74436c7507bac6bfb7b8b989263bccb Convert filldir[64]() from __put_user() to unsafe_put_user()
c512c69187197fe08026cb5bbe7b9709f4f89b73 uaccess: implement a proper unsafe_copy_to_user() and switch filldir over to it

The two commits above try to mitigate that performance impact. At least on x86 with SMAP, that should have some effect. At any other platforms, at least on bionic and xenial, any improvements should be measured. Though that is true for x86 with SMAP too.

This bug is opened in order to keep track of that possible performance improvement we might add in the future as followup for those two commits.

Cascardo.

no longer affects: kernel-sru-workflow
Changed in linux (Ubuntu Xenial):
status: New → In Progress
Changed in linux (Ubuntu Bionic):
status: New → In Progress
Changed in linux (Ubuntu Xenial):
status: In Progress → Triaged
Changed in linux (Ubuntu Bionic):
assignee: nobody → Thadeu Lima de Souza Cascardo (cascardo)
importance: Undecided → Low
Changed in linux (Ubuntu Xenial):
importance: Undecided → Low
Changed in linux (Ubuntu):
status: New → Fix Released
Revision history for this message
Thadeu Lima de Souza Cascardo (cascardo) wrote :

When using a large directory with large names, I noticed a 50% increase in the time it took to readdir the entire directory. With small names, the increase did not seem noticeable enough. Tested on a VM with bionic, no SMAP involved. Compared before memchr and after memchr. Need to compare before and after uaccess changes, both without SMAP and with SMAP.

Cascardo.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.