)]}'
{
  "commit": "449134c6e35feee24a896395d24acd9f1afc76d1",
  "tree": "11a02931a8b058cbe07f76ed38095bdc477120e4",
  "parents": [
    "bd3282a1cf1025c7869a8664c2d54266a4dded44"
  ],
  "author": {
    "name": "Li Bingzhuo",
    "email": "lbz2770828522@gmail.com",
    "time": "Sun Oct 04 21:03:41 2026 +0800"
  },
  "committer": {
    "name": "Li Bingzhuo",
    "email": "lbz2770828522@gmail.com",
    "time": "Thu Oct 15 16:14:33 2026 +0800"
  },
  "message": "mlx5: Fix underflow and stale data in dr_ste_copy_param()\n\ndr_ste_copy_param() parses the caller\u0027s match mask one section at a time.\nA section that the mask does not reach was parsed from a single shared\nscratch buffer:\n\n  char tail_param[DEVX_ST_SZ_BYTES(dr_match_param)] \u003d {};\n  ...\n  if (match_criteria \u0026 DR_MATCHER_CRITERIA_MISC) {\n          if (mask_sz \u003c param_location +\n              DEVX_ST_SZ_BYTES(dr_match_set_misc)) {\n                  memcpy(tail_param, data + param_location,\n                         mask_sz - param_location);\n                  buff \u003d tail_param;\n          } else {\n                  buff \u003d data + param_location;\n          }\n          dr_ste_copy_mask_misc(buff, \u0026set_param-\u003emisc, clear);\n  }\n\nTwo defects follow from that.\n\nFirst, the copy length is computed without establishing that the mask\nreaches the section.  When mask_sz is smaller than param_location the\nsubtraction is done in size_t and underflows, so memcpy() is asked for\nabout SIZE_MAX bytes: it reads far past the caller\u0027s buffer and writes\npast the 448 byte scratch buffer.  The rule path checks the mask for an\nupper bound and alignment only (dr_rule.c), never for a lower one.\n\nSecond, the buffer is shared by all seven sections and was initialised\nonly once at function entry.  A section whose mask_sz falls inside it\ncopies the bytes that are present and leaves the remainder holding what\nthe previous section left behind.  Those bytes are then read as if the\ncaller had supplied them, so fields the caller never specified take\nvalues from a different section of its own mask.  The initialiser shows\nthe intent is for the absent part to read as zero.\n\nA section is now parsed only when the mask reaches into it, and the\nscratch buffer is cleared before each partial copy, so the absent part\nreads as zero:\n\n  if ((match_criteria \u0026 DR_MATCHER_CRITERIA_MISC) \u0026\u0026\n      (mask_sz \u003e param_location)) {\n          if (mask_sz \u003e\u003d param_location +\n              DEVX_ST_SZ_BYTES(dr_match_set_misc)) {\n                  buff \u003d data + param_location;\n          } else {\n                  memset(tail_param, 0, sizeof(tail_param));\n                  memcpy(tail_param, data + param_location,\n                         mask_sz - param_location);\n                  buff \u003d tail_param;\n          }\n          dr_ste_copy_mask_misc(buff, \u0026set_param-\u003emisc, clear);\n  }\n\nA mask shorter than the match header then behaves exactly as the same\nmask zero padded to DEVX_ST_SZ_BYTES(dr_match_param).  set_param is\nzeroed by the caller that can reach the partial path, and the other\ncaller, dr_matcher_copy_mask(), always passes a full size buffer, so it\ntakes the direct path and is unaffected.\n\nFixes: 7ec30b8cba29 (\"mlx5: Add Steering entry (STE) utilities\")\nSigned-off-by: Li Bingzhuo \u003clbz2770828522@gmail.com\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "4f88a4f8bad06bc84f605bc5f24a46864f3e6855",
      "old_mode": 33188,
      "old_path": "providers/mlx5/dr_ste.c",
      "new_id": "8f0ea56d08c6779481e44846292d0799a5704af0",
      "new_mode": 33188,
      "new_path": "providers/mlx5/dr_ste.c"
    }
  ]
}
