Chrysler: reliable fuzzy fingerprinting - #3725
Conversation
Chrysler FW versions are Mopar part numbers: an 8 character base part number plus a two letter revision that is bumped for running software changes. Only the generic fuzzy matcher runs for Chrysler today, and it needs exact FW strings, so a dealer flash makes a known car unfingerprintable. Match on the part number and ignore the revision, in the same shape as Ford and Hyundai. Platform code ECUs are ABS, cluster and SRS; one may carry an unseen part number or be missing, which is what a new model year usually looks like. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
There was a problem hiding this comment.
Thanks for contributing to opendbc! In order for us to review your PR as quickly as possible, check the following:
- Convert your PR to a draft unless it's ready to review
- Read the contributing docs
- Before marking as "ready for review", ensure:
- the goal is clearly stated in the description
- all the tests are passing
- include a route or your device' dongle ID if relevant
Car behavior reportReplays driving segments through this PR and compares the behavior to master. Testing 40 segments for: CHRYSLER_PACIFICA_2018_HYBRID, CHRYSLER_PACIFICA_2019_HYBRID, CHRYSLER_PACIFICA_2018, CHRYSLER_PACIFICA_2020 ✅ 0 changed, 40 passed, 0 errors |
|
Separate from the code review, a note on the bounty for this one. I'd like to skip the payout entirely. No cash, no shop credit. What I'd rather have is a comma four, and I'm happy to put that in writing as a loan: if I haven't got something working in six months, I ship it back. Here's what I want to do with it. I work as a senior software engineer at Google on hardware, and I'd like to take a run at FlexRay. I have a 2018 Range Rover Evoque Convertible with lane keep assist and adaptive cruise, which makes it a reasonable test car if the EPAS turns out to be reachable. FlexRay is the part I actually know, and it's the reason I'm asking for hardware rather than money. I'm aware of what I'd be walking into. CARS.md says Land Rover is FlexRay and that there are no immediate plans to support it, and For context on whether I'd actually finish it, this PR and commaai/openpilot#38815 are what I've contributed so far. Both are green, both came with measurements rather than assertions, and the openpilot one turned up a buffer sizing bug that had been breaking the simulator on every platform. If GitHub isn't the right place for this, tell me where to take it and I'll move it there. |
Closes #1092.
The problem
Chrysler FW versions are Mopar part numbers: an 8 character base part number followed by a two letter revision, so
b'68227902AF'is part68227902at revisionAF. The revision gets bumped for running software changes that don't change the platform.Chrysler has no brand fuzzy matcher, so it falls back to the generic one, which can only match FW strings it has literally seen. That means a dealer flash moving any ECU from
AFtoAGmakes a known car unfingerprintable until someone submits a new route.The change
A
match_fw_to_car_fuzzyfor Chrysler in the same shape as Ford and Hyundai: match on the part number, ignore the revision. Platform code ECUs are ABS, cluster and SRS, and one of them is allowed to carry an unseen part number or be missing, as long as the other two agree.Why those ECUs, and why one is tolerated
I measured this over the whole checked-in database rather than picking. 10 platforms, 652 FW versions, 200 draws per platform per scenario, plus a replay of every commit that has ever added Chrysler FW.
Two things fall out of that.
Precision doesn't decide it. Every variant has zero cross-platform false accepts, so choosing ECUs on specificity grounds is choosing between ties. What actually separates them is recall on firmware we haven't seen.
The historical replay does decide it. For every commit that added FW to an existing Chrysler platform, I built the car as it would have reported afterwards and matched it against the database as it stood before that commit.
abs+cluster+srswith one tolerated ECU fingerprints 27 of 30, against 20 for the same set with no tolerance and 25 for every variant that includes EPS. Zero mismatches in all eight variants, which is the number that matters: an unmatched car is the safe outcome, a wrong match is not.The three remaining misses are genuinely new hardware, on two or more platform code ECUs at once:
7689bdd2(2018 Grand Cherokee Trackhawk),725fe0e8(Pacifica 2019 hybrid),d8abecb8(RAM 1500).EPS and radar are excluded because their part numbers are shared between sibling platforms, and engine and transmission because they change with nearly every calibration. Neither adds discrimination here.
Why tolerating one ECU is safe
A false accept needs a car to satisfy all but one of another platform's platform code ECUs. I measured that distance for every ordered pair of platforms and the minimum is 2, so one unseen ECU can never turn a platform into its sibling.
test_platforms_distinguishableasserts exactly that, and it fails the moment a future fingerprint submission erodes the margin, which is the signal to revisit the tolerance rather than finding out on a car.The rule also degrades safely on its own. The two Pacifica hybrids have no ABS entry, so they only have two platform code ECUs and can't spare one. That's the
1600/2000above rather than a gap.Tests
opendbc/car/chrysler/tests/test_chrysler.py, modelled on the Ford suite, 12 tests. Every FW in the database parses (b'22DTRHD_AA'is the one that isn't a part number, and it sits on the radar, so it never contributes a platform code). A fuzz test thatget_platform_codesnever raises. A spot check including a trailing-space engine FW. Every platform matches only itself. Unseen revisions still match, one unseen part number still matches, two never do. And a synthetic four-ECU database that pins the tolerance itself rather than whatever the current database happens to allow.I checked each test by reverting the thing it covers:
PLATFORM_CODE_ECUSto every ECUtest_custom_fuzzy_matchintest_fw_fingerprint.pystops skipping for the 10 Chrysler platforms, so the brand function is now checked against the generic one instead of being silently absent. Skips go from 702 to 692.Validation
./test.sh: 3983 tests, 0 failures, up from 3971. ruff, ty, codespell, cpplint and MISRA all clean../test.shon ubuntu-24.04 and macos-latest, safety, safety mutation on both, all fourtest modelsshards, andcar diff.car diff: 0 changed, 40 passed, 0 errors over 40 Chrysler segments.Request, sotest_fw_query_timing's'chrysler': 0.3and total8.3are untouched.Route
n/a. This only changes offline fingerprint matching, with no CAN or control behaviour, and the
car diffreplay above is the evidence for that.🤖 Generated with Claude Code