)]}'
{
  "commit": "b53b63dbf3748eca32e8d19d56dba43ddfec78e6",
  "tree": "19ca27b2d85727299d5fa93f3a085bf3bef71b4a",
  "parents": [
    "556a399406635566413f9c71b134d5d287b25b29",
    "f932a8e4824b529e455b7e3eb3e5118beceb3e32"
  ],
  "author": {
    "name": "Alexei Starovoitov",
    "email": "ast@kernel.org",
    "time": "Thu Jan 16 17:51:10 2025 -0800"
  },
  "committer": {
    "name": "Alexei Starovoitov",
    "email": "ast@kernel.org",
    "time": "Thu Jan 16 17:51:11 2025 -0800"
  },
  "message": "Merge branch \u0027support-eliding-map-lookup-nullness\u0027\n\nDaniel Xu says:\n\n\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\nSupport eliding map lookup nullness\n\nThis patch allows progs to elide a null check on statically known map\nlookup keys. In other words, if the verifier can statically prove that\nthe lookup will be in-bounds, allow the prog to drop the null check.\n\nThis is useful for two reasons:\n\n1. Large numbers of nullness checks (especially when they cannot fail)\n   unnecessarily pushes prog towards BPF_COMPLEXITY_LIMIT_JMP_SEQ.\n2. It forms a tighter contract between programmer and verifier.\n\nFor (1), bpftrace is starting to make heavier use of percpu scratch\nmaps. As a result, for user scripts with large number of unrolled loops,\nwe are starting to hit jump complexity verification errors.  These\npercpu lookups cannot fail anyways, as we only use static key values.\nEliding nullness probably results in less work for verifier as well.\n\nFor (2), percpu scratch maps are often used as a larger stack, as the\ncurrrent stack is limited to 512 bytes. In these situations, it is\ndesirable for the programmer to express: \"this lookup should never fail,\nand if it does, it means I messed up the code\". By omitting the null\ncheck, the programmer can \"ask\" the verifier to double check the logic.\n\n\u003d\u003d\u003d Changelog \u003d\u003d\u003d\n\nChanges in v7:\n* Use more accurate frame number when marking precise\n* Add test for non-stack key\n* Test for marking stack slot precise\n\nChanges in v6:\n* Use is_spilled_scalar_reg() helper and remove unnecessary comment\n* Add back deleted selftest with different helper to dirty dst buffer\n* Check size of spill is exactly key_size and update selftests\n* Read slot_type from correct offset into the spi\n* Rewrite selftests in C where possible\n* Mark constant map keys as precise\n\nChanges in v5:\n* Dropped all acks\n* Use s64 instead of long for const_map_key\n* Ensure stack slot contains spilled reg before accessing spilled_ptr\n* Ensure spilled reg is a scalar before accessing tnum const value\n* Fix verifier selftest for 32-bit write to write at 8 byte alignment\n  to ensure spill is tracked\n* Introduce more precise tracking of helper stack accesses\n* Do constant map key extraction as part of helper argument processing\n  and then remove duplicated stack checks\n* Use ret_flag instead of regs[BPF_REG_0].type\n* Handle STACK_ZERO\n* Fix bug in bpf_load_hdr_opt() arg annotation\n\nChanges in v4:\n* Only allow for CAP_BPF\n* Add test for stack growing upwards\n* Improve comment about stack growing upwards\n\nChanges in v3:\n* Check if stack is (erroneously) growing upwards\n* Mention in commit message why existing tests needed change\n\nChanges in v2:\n* Added a check for when R2 is not a ptr to stack\n* Added a check for when stack is uninitialized (no stack slot yet)\n* Updated existing tests to account for null elision\n* Added test case for when R2 can be both const and non-const\n\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\n\nLink: https://patch.msgid.link/cover.1736886479.git.dxu@dxuuu.xyz\nSigned-off-by: Alexei Starovoitov \u003cast@kernel.org\u003e\n",
  "tree_diff": []
}
