Page MenuHomeFreeBSD

ipmi: check compcode from GETMSG
AcceptedPublic

Authored by yuripv on Apr 6 2023, 8:28 PM.
Tags
None
Referenced Files
Unknown Object (File)
Dec 23 2023, 12:13 AM
Unknown Object (File)
Nov 23 2023, 1:48 AM
Unknown Object (File)
Nov 22 2023, 9:33 AM
Unknown Object (File)
Nov 22 2023, 9:23 AM
Unknown Object (File)
Nov 21 2023, 2:49 AM
Unknown Object (File)
Nov 11 2023, 10:38 AM
Unknown Object (File)
Nov 9 2023, 11:30 AM
Unknown Object (File)
Oct 20 2023, 1:49 AM
Subscribers

Details

Reviewers
philip
Summary

Apparently some sensors accessible via IPMB on Dell platforms do not return any data.

Check that GET MSG compcode is not 80h before trying to copyout the reply.

Surprisingly trying to copyout -7 bytes (that is, empty reply and we are trying to get past the header) doesn't seem to have any negative effect on FreeBSD, while I found this on our illumos fork where the calling apps would fail spectacularly with weird back traces.

Nevertheless, fix this in FreeBSD as well, if only for the sake of correctness.

Test Plan

Tested on Dell R740 and R750, where the issue was found originally.

ipmitool sdr
ipmitool sensor list

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

yuripv requested review of this revision.Apr 6 2023, 8:28 PM

I don't have these systems to test on. I trust you've tested this patch well. Your patch compiles and, as far as I can tell, doesn't break the system I've cursorily tested (Supermicro).

I accept this patch but I think we should spend some time going through the magic numbers in this file.

Thanks for the patch!

sys/dev/ipmi/ipmi.c
416–425

We already have a couple of magic values assigned to compcode ... is it time to start #define-ing them?

This revision is now accepted and ready to land.Apr 7 2023, 3:25 AM

the size is typed as size_t and:

/*
 * Check explicitly for non-user addresses.
 * First, prevent address wrapping.
 */
movq    %rsi,%rax
addq    %rdx,%rax
jc      copy_fault

so I would expect the bogus call to fail early without touching any data

I think this code would benefit from future-proofing, maybe apart from the known case above warn once that something went off and reply is too short?

added IPMI_GET_MSG_DATA_NA for 0x80 magic value

This revision now requires review to proceed.Apr 7 2023, 8:12 PM
yuripv added inline comments.
sys/dev/ipmi/ipmi.c
416–425

Done for this one.

This revision is now accepted and ready to land.Apr 8 2023, 4:33 AM