Repository navigation
Commit 043083f
virtiofs: count only shown entries toward a microVM listing's bound
A microVM directory listing that already holds 4,096 entries, `.` and
`..` included, failed with E2BIG when the host listed another entry
that the access policy hides, although the guest never sees that entry
(microsoft/nvx#2093). The same directory listed all 4,096 entries when
the host listed the hidden entries first, so whether the first
FUSE_READDIR or FUSE_READDIRPLUS of a handle failed depended on the
host's enumeration order, which the guest cannot control.
build_microvm_directory_snapshot checked the 4,096-entry bound at the
top of its read_dir callback, before the name check and the policy
filter, so a hidden entry counted toward the bound as if it were
listed. The check now runs where an entry is about to join the
listing, after the filter, beside the check of the 64 KiB bound on
names, which already ran there. Only the entries that the guest can
list count toward either bound, and a 4,097th of them still fails the
listing with E2BIG.
A test at the real bound needs a directory of more than 4,096 entries,
which takes seconds to create on Windows, past the 1 s after which
OpenVMM's CI profile calls a test slow and close to the 10 s after
which it ends one. build_microvm_directory_snapshot therefore lists
through build_microvm_directory_snapshot_within, which takes the bound
as a parameter, so that a test can pass a smaller one.
microvm_listings_count_only_the_entries_that_the_policy_shows hides
each of three files in turn, so that one of them is the last that the
host lists, and expects a bound of four entries to hold `.`, `..`, and
the two shown files, and a bound of three to fail with E2BIG. With the
check back at the top of the callback, it fails with E2BIG for the
file that the host lists last: `c` on NTFS, which lists names in
order, and `a` on the tmpfs of the Linux host, which lists the newest
first.
At feature/microvm/dev d44a113, a one-off test, not committed, that
fills a handle's listing with 4,094 shown files and hides one more file
fails the first FUSE_READDIR and FUSE_READDIRPLUS of the root with
E2BIG when the hidden file is the last that the host lists, and lists
all 4,096 entries when it is the first, on Windows 11 Enterprise (build
26300, NTFS) and on Azure Linux 3 (kernel 6.18, tmpfs). With the fix,
it lists all 4,096 entries in both cases on both hosts, and a listing
of 4,095 shown files still fails with E2BIG; the other tests of the
virtiofs package pass there too.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent 44747bf commit 043083f
2 files changed
Lines changed: 73 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
297 | 297 | | |
298 | 298 | | |
299 | 299 | | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
300 | 306 | | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
301 | 318 | | |
302 | 319 | | |
303 | 320 | | |
| |||
307 | 324 | | |
308 | 325 | | |
309 | 326 | | |
310 | | - | |
311 | | - | |
312 | | - | |
313 | 327 | | |
314 | 328 | | |
315 | 329 | | |
| |||
322 | 336 | | |
323 | 337 | | |
324 | 338 | | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
325 | 344 | | |
326 | 345 | | |
327 | 346 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1383 | 1383 | | |
1384 | 1384 | | |
1385 | 1385 | | |
| 1386 | + | |
| 1387 | + | |
| 1388 | + | |
| 1389 | + | |
| 1390 | + | |
| 1391 | + | |
| 1392 | + | |
| 1393 | + | |
| 1394 | + | |
| 1395 | + | |
| 1396 | + | |
| 1397 | + | |
| 1398 | + | |
| 1399 | + | |
| 1400 | + | |
| 1401 | + | |
| 1402 | + | |
| 1403 | + | |
| 1404 | + | |
| 1405 | + | |
| 1406 | + | |
| 1407 | + | |
| 1408 | + | |
| 1409 | + | |
| 1410 | + | |
| 1411 | + | |
| 1412 | + | |
| 1413 | + | |
| 1414 | + | |
| 1415 | + | |
| 1416 | + | |
| 1417 | + | |
| 1418 | + | |
| 1419 | + | |
| 1420 | + | |
| 1421 | + | |
| 1422 | + | |
| 1423 | + | |
| 1424 | + | |
| 1425 | + | |
| 1426 | + | |
| 1427 | + | |
| 1428 | + | |
| 1429 | + | |
| 1430 | + | |
| 1431 | + | |
| 1432 | + | |
| 1433 | + | |
| 1434 | + | |
| 1435 | + | |
| 1436 | + | |
1386 | 1437 | | |
1387 | 1438 | | |
1388 | 1439 | | |
| |||
0 commit comments