Opened 4 years ago

Last modified 4 years ago

#4767 new enhancement

Tweak ECM Doublecheck

Reported by: Mic Owned by:
Priority: major Component: Reader
Severity: high Keywords:
Cc: Sensitive: no

Description

Revision

any

Issue Description

At this moment ECM doublecheck does not cope well when doublecheck fails. For example if loadbalancer selects 2 readers, and their answers differ, we need 2 more correct answers (4 readers) - that easily makes timeouts. We could do some improvements:

  • If we get same CW for a second time, we can assume it is correct (example: 1st reader sends CW1, 2nd sends CW2, 3rd sends CW2 - we know CW1 is invalid and CW2 is OK).
  • Change priority of logging - push log only when check failed, in other case put debug log
  • Print which reader provided correct CW (we could find out which reader sends bad CW)

These are included in attached patch. Explanation:

  • we cut cw_checked in half to allow storing both CWs. But to not extend cw_checked, we decided to store only 5,6,7,8,9,10,11,12 bytes of CW, it is more than sufficient.
  • we don't decrease checked value - as we know both responses, we will manage to compare third response

Possible TODO:

  • Copy behaviour from CWCycle check (as in cwcycle_allowbadfromffb) to doublecheck - and Mark CWs from Fallback Reader as always correct
  • Consider marking failed reader in stats

How the issue is reproducable

when ECM doublecheck is enabled

Attachments (1)

002-rewrite_doublecheck_logic.patch (1.9 KB ) - added by Mic 4 years ago.

Download all attachments as: .zip

Change History (3)

comment:1 by Mic, 4 years ago

Such code could help for first TODO

if(cfg.cwcycle_allowbadfromffb && chk_is_fixed_fallback(er->selected_reader, er)) {

er->checked = 2;
cs_debug_mask(D_TRACE, "DOUBLE CHECK CW PASS BY FALLBACK READER %s", er->selected_reader->label);

}

comment:2 by savan, 4 years ago

Your code is potential for remote root exploit! You must check sizeof of the variables before you use memcpy.

Note: See TracTickets for help on using tickets.