Activity log for bug #1745364

Date Who What changed Old value New value Message
2018-01-25 12:40:33 Daniel Axtens bug added bug
2018-01-25 12:41:03 Daniel Axtens description Coverity reports: *** CID 1464330: Uninitialized variables (MISSING_RETURN) /arch/x86/net/bpf_jit_comp.c: 1088 in bpf_int_jit_compile() 1082 int i; 1083 1084 if (!bpf_jit_enable) 1085 return prog; 1086 1087 if (!prog || !prog->len) >>> CID 1464330: Uninitialized variables (MISSING_RETURN) >>> Arriving at the end of a function without returning a value. 1088 return; 1089 1090 addrs = kmalloc(prog->len * sizeof(*addrs), GFP_KERNEL); 1091 if (!addrs) 1092 return prog; 1093 This is a result of 3098d8eae421 ("bpf: prepare bpf_int_jit_compile/bpf_prog_select_runtime apis"), which is a cherry-pick of d1c55ab5e41f upstream. In that patch, the return type of bpf_int_jit_compile was changed from void to struct bpf_prog*. That patch changed some of the return statements. It did not, however, change the return statement of the (!prog || !prog->len) check, as in upstream the (!prog || !prog->len) check was dropped in 93a73d442d37 ("bpf, x86/arm64: remove useless checks on prog"): """ There is never such a situation, where bpf_int_jit_compile() is called with either prog as NULL or len as 0, so the tests are unnecessary and confusing as people would just copy them. """ However, we haven't picked up 93a73d442d37, so when we cherry-picked d1c55ab5e41f, that branch remained unmodified, hence the static analysis warning. Impact ====== If the branch is not dead and someone can hit it, an undefined value can be returned, which could cause issues. Fix === For consistency and in case the branch is not actually dead on Xenial, we should do a fixup to 'return prog;' Regression Potential ==================== Limited to the BPF jit which is off by default. Limited to a branch that should be dead code anyway. Limited to an error handling path. SRU Justification ================= Coverity reports: *** CID 1464330: Uninitialized variables (MISSING_RETURN) /arch/x86/net/bpf_jit_comp.c: 1088 in bpf_int_jit_compile() 1082 int i; 1083 1084 if (!bpf_jit_enable) 1085 return prog; 1086 1087 if (!prog || !prog->len) >>> CID 1464330: Uninitialized variables (MISSING_RETURN) >>> Arriving at the end of a function without returning a value. 1088 return; 1089 1090 addrs = kmalloc(prog->len * sizeof(*addrs), GFP_KERNEL); 1091 if (!addrs) 1092 return prog; 1093 This is a result of 3098d8eae421 ("bpf: prepare bpf_int_jit_compile/bpf_prog_select_runtime apis"), which is a cherry-pick of d1c55ab5e41f upstream. In that patch, the return type of bpf_int_jit_compile was changed from void to struct bpf_prog*. That patch changed some of the return statements. It did not, however, change the return statement of the (!prog || !prog->len) check, as in upstream the (!prog || !prog->len) check was dropped in 93a73d442d37 ("bpf, x86/arm64: remove useless checks on prog"): """ There is never such a situation, where bpf_int_jit_compile() is called with either prog as NULL or len as 0, so the tests are unnecessary and confusing as people would just copy them. """ However, we haven't picked up 93a73d442d37, so when we cherry-picked d1c55ab5e41f, that branch remained unmodified, hence the static analysis warning. Impact ====== If the branch is not dead and someone can hit it, an undefined value can be returned, which could cause issues. Fix === For consistency and in case the branch is not actually dead on Xenial, we should do a fixup to 'return prog;' Regression Potential ==================== Limited to the BPF jit which is off by default. Limited to a branch that should be dead code anyway. Limited to an error handling path.
2018-01-25 20:48:58 Joseph Salisbury linux (Ubuntu): importance Undecided Medium
2018-01-25 20:58:41 Joseph Salisbury nominated for series Ubuntu Xenial
2018-01-25 20:58:41 Joseph Salisbury bug task added linux (Ubuntu Xenial)
2018-01-25 20:58:48 Joseph Salisbury linux (Ubuntu Xenial): status New Triaged
2018-01-25 20:58:51 Joseph Salisbury linux (Ubuntu): status Confirmed Triaged
2018-01-25 20:58:54 Joseph Salisbury linux (Ubuntu Xenial): importance Undecided Medium
2018-02-28 14:18:14 Kleber Sacilotto de Souza linux (Ubuntu Xenial): status Triaged Fix Committed
2018-03-19 10:55:42 Stefan Bader tags verification-needed-xenial
2018-03-21 09:56:58 Daniel Axtens tags verification-needed-xenial verification-done-xenial
2018-04-04 09:27:25 Launchpad Janitor linux (Ubuntu Xenial): status Fix Committed Fix Released
2018-04-04 09:27:25 Launchpad Janitor cve linked 2017-15129
2018-04-04 09:27:25 Launchpad Janitor cve linked 2017-16995
2018-04-04 09:27:25 Launchpad Janitor cve linked 2017-17448
2018-04-04 09:27:25 Launchpad Janitor cve linked 2017-17450
2018-04-04 09:27:25 Launchpad Janitor cve linked 2017-17741
2018-04-04 09:27:25 Launchpad Janitor cve linked 2017-17862
2018-04-04 09:27:25 Launchpad Janitor cve linked 2017-5753
2018-04-04 09:27:25 Launchpad Janitor cve linked 2018-1000026
2018-04-04 09:27:25 Launchpad Janitor cve linked 2018-5333
2018-04-04 09:27:25 Launchpad Janitor cve linked 2018-5344
2018-04-04 09:27:25 Launchpad Janitor cve linked 2018-8043