Page MenuHomeFreeBSD

mpi3mr: Check for copyin errors in mpi3mr_map_data_buffer_dma()
ClosedPublic

Authored by markj on Dec 19 2023, 3:13 AM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Jan 10, 12:06 AM
Unknown Object (File)
Dec 1 2024, 4:43 AM
Unknown Object (File)
Oct 3 2024, 8:07 PM
Unknown Object (File)
Oct 3 2024, 3:59 PM
Unknown Object (File)
Oct 3 2024, 12:16 PM
Unknown Object (File)
Oct 3 2024, 11:10 AM
Unknown Object (File)
Oct 3 2024, 9:57 AM
Unknown Object (File)
Oct 2 2024, 5:03 PM
Subscribers
None

Details

Summary

A failed copyin will cause the driver to use the contents of
uninitialized buffers instead, which is unlikely to be the behaviour
that we want. Check for errors.

This is in preparation for annotating copyin() and related functions
with __result_use_check.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

markj requested review of this revision.Dec 19 2023, 3:13 AM
markj created this revision.
sys/dev/mpi3mr/mpi3mr_app.c
586

This seems kinda noisy. Wouldn't the application just fail the I/O? And isn't that enoguh?

sys/dev/mpi3mr/mpi3mr_app.c
586

It'd only be due to a bug in the application, or something malicious happening. I can remove it, I was just following the example of an earlier error on line 551. If you still think it's better to remove the print I'm happy to.

imp added inline comments.
sys/dev/mpi3mr/mpi3mr_app.c
586

They both seem kinda dubious. They are both programming errors, and aren't something we generally warn about in drivers... And we know that there's a lot of 'warnings' that just scare the horses (eg, it's an expected failure because, for example, they are probing the maximum size)... but this does seem like an actual problem.... I half suspect we'll need to remove it in the future if we leave it in now...

tl;dr: Looking at the rest of the driver, this is fine, since you can't get to this point w/o permission to open the device which means it can't be used easily to ddos the logs...

This revision is now accepted and ready to land.Dec 19 2023, 5:05 AM