Project

General

Profile

Actions

Bug #14840

closed

Modernize lockstat probes

Added by Patrick Mooney 3 months ago. Updated about 2 months ago.

Status:
Closed
Priority:
Normal
Category:
kernel
Start date:
Due date:
% Done:

100%

Estimated time:
Difficulty:
Medium
Tags:
Gerrit CR:
External Bug:

Description

The lockstat probes in lock_prim.s are somewhat tedious to deal with, consisting of hotpatching specially labeled ret instructions in order to allow execution to fall through into the lockstat_probe call itself. In order to make further changes easier (such as the #14829 mitigation), it would be nice to implement those probe sites as a common macro so their handling and hotpatching is consistent.


Related issues

Related to illumos gate - Bug #14829: Mitigate CVE-2022-29900NewPatrick Mooney

Actions
Related to illumos gate - Bug #14839: Untangle erratum 147 from lockstatClosedPatrick Mooney

Actions
Related to illumos gate - Bug #14865: mutex_tryenter:adaptive-acquire probe never firesClosedPatrick Mooney

Actions
Actions #1

Updated by Patrick Mooney 3 months ago

  • Related to Bug #14829: Mitigate CVE-2022-29900 added
Actions #2

Updated by Patrick Mooney 3 months ago

  • Related to Bug #14839: Untangle erratum 147 from lockstat added
Actions #3

Updated by Electric Monk 3 months ago

  • Gerrit CR set to 2256
Actions #4

Updated by Patrick Mooney 2 months ago

  • Related to Bug #14865: mutex_tryenter:adaptive-acquire probe never fires added
Actions #5

Updated by Patrick Mooney 2 months ago

To confirm that the instrumentation is working as expected, I checked the instructions for the involved functions with mdb -k. Without the relevant dtrace probes active, all of the normal ret instructions were present. As I went through and enabled each probe individually, I could then see the ret be replaced with a nop in the expected place. I also enabled all of the lock_prim probes at once while tracing the hotpatching functions to ensure that they were called as expected.

The effected lockstat probes function normally.

Actions #6

Updated by Patrick Mooney about 2 months ago

Per rm's suggestion, I ran dtest (the dtrace test suite) on a machine featuring the 14840 bits. All of the lockstat-related tests passed. There were some failures, but consulting some of my old notes on dtest, I believe they are expected:

ERROR: /opt/SUNWdtrt/tst/common/funcs/tst.strtok.d stdout mismatch; see 1863.out
ERROR: /opt/SUNWdtrt/tst/common/ip/tst.ipv4localicmp.ksh stdout mismatch; see 1936.out
ERROR: /opt/SUNWdtrt/tst/common/pragma/tst.temporal.ksh returned 1 instead of 0
ERROR: /opt/SUNWdtrt/tst/common/preprocessor/err.ifdefnotendif.d returned 0 instead of 1
ERROR: /opt/SUNWdtrt/tst/common/ip/tst.ipv4localtcp.ksh stdout mismatch; see 1941.out
ERROR: /opt/SUNWdtrt/tst/common/ip/tst.ipv4remoteicmp.ksh stdout mismatch; see 1952.out
ERROR: /opt/SUNWdtrt/tst/common/ip/tst.ipv6remoteicmp.ksh returned 3 instead of 0
ERROR: /opt/SUNWdtrt/tst/common/ip/tst.localtcpstate.ksh stdout mismatch; see 1986.out
ERROR: /opt/SUNWdtrt/tst/common/ip/tst.remotetcpstate.ksh stdout mismatch; see 1992.out
ERROR: /opt/SUNWdtrt/tst/common/java_api/tst.Bean.ksh stdout mismatch; see 2003.out
ERROR: /opt/SUNWdtrt/tst/common/java_api/tst.MultiAggPrinta.ksh stdout mismatch; see 2033.out
ERROR: /opt/SUNWdtrt/tst/common/misc/tst.include.ksh returned 9 instead of 0
Actions #7

Updated by Electric Monk about 2 months ago

  • Status changed from In Progress to Closed
  • % Done changed from 0 to 100

git commit ee6ee36a8ff1701c4e61e6f118446b145220478c

commit  ee6ee36a8ff1701c4e61e6f118446b145220478c
Author: Patrick Mooney <pmooney@pfmooney.com>
Date:   2022-08-13T02:56:10.000Z

    14838 Rename erratum 147 handling
    14839 Untangle erratum 147 from lockstat
    14840 Modernize lockstat probes
    14865 mutex_tryenter:adaptive-acquire probe never fires
    Reviewed by: Toomas Soome <tsoome@me.com>
    Reviewed by: Dan McDonald <danmcd@mnx.io>
    Reviewed by: Gergő Mihály Doma <domag02@gmail.com>
    Approved by: Robert Mustacchi <rm@fingolfin.org>

Actions

Also available in: Atom PDF