x86: Restore CR0.TS in the Skylake MDS handlers
The Skylake variants of the MDS software sequence save CR0 in %rax
(%eax on i386) and then reuse %eax for the clflushopt loop and the
stosb fill byte. The final test of CR0_TS always sees zero and CR0 is
never restored, so the return to user mode leaves TS clear even when
the thread does not own the FPU. The thread then takes no trap to load
its own FPU state, runs with whatever the registers hold, and its FPU
state is not saved on the next context switch. Only hw.mds_disable=2,
or 3 on a CPU without MD_CLEAR, selects these handlers.
Keep the saved CR0 in %rsi on amd64 and in %esi on i386, which the
handlers do not otherwise use.
Reported by: llm-postcr
Reviewed by: kib
Fixes: 7355a02bdd81 ("Mitigations for Microarchitectural...")
MFC after: 3 days
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D62238
bsnmp: drop messages with an unsupported SNMP version
snmp_pdu_decode_header() returned SNMP_CODE_BADENC for an unknown
version. snmp_input_start() treats BADENC as a bad value in a SET and
carries on, so its version check, which runs only for SNMP_CODE_OK, was
skipped. The message then reached snmp_pdu_auth_access(), which with
snmp_vacm loaded switched on pdu->version and called abort() for
SNMP_Verr. A single unauthenticated packet could stop bsnmpd.
Return SNMP_CODE_BADVERS instead, as bsnmplib(3) documents, so the
message is counted in snmpInBadVersions and dropped. Remove the
mapping in snmp_pdu_decode() that tried to do this but was never
reached, and have snmp_pdu_auth_access() deny an unknown version
rather than abort.
Reported by: Hila Cohen, Apiiro (hillalee on github)
Reviewed by: harti
MFC after: 3 days
(cherry picked from commit 72d7d152c2ff4708928ae1f94b940b5528ba5013)
bsnmp: drop messages with an unsupported SNMP version
snmp_pdu_decode_header() returned SNMP_CODE_BADENC for an unknown
version. snmp_input_start() treats BADENC as a bad value in a SET and
carries on, so its version check, which runs only for SNMP_CODE_OK, was
skipped. The message then reached snmp_pdu_auth_access(), which with
snmp_vacm loaded switched on pdu->version and called abort() for
SNMP_Verr. A single unauthenticated packet could stop bsnmpd.
Return SNMP_CODE_BADVERS instead, as bsnmplib(3) documents, so the
message is counted in snmpInBadVersions and dropped. Remove the
mapping in snmp_pdu_decode() that tried to do this but was never
reached, and have snmp_pdu_auth_access() deny an unknown version
rather than abort.
Reported by: Hila Cohen, Apiiro (hillalee on github)
Reviewed by: harti
MFC after: 3 days
(cherry picked from commit 72d7d152c2ff4708928ae1f94b940b5528ba5013)