Commit b6ee896
xfrm/compat: prevent potential spectre v1 gadget in xfrm_xlate32_attr()
int type = nla_type(nla);
if (type > XFRMA_MAX) {
return -EOPNOTSUPP;
}
@type is then used as an array index and can be used
as a Spectre v1 gadget.
if (nla_len(nla) < compat_policy[type].len) {
array_index_nospec() can be used to prevent leaking
content of kernel memory to malicious users.
Fixes: 5106f4a ("xfrm/compat: Add 32=>64-bit messages translator")
Signed-off-by: Eric Dumazet <[email protected]>
Cc: Dmitry Safonov <[email protected]>
Cc: Steffen Klassert <[email protected]>
Reviewed-by: Dmitry Safonov <[email protected]>
Signed-off-by: Steffen Klassert <[email protected]>1 parent eb6c59b commit b6ee896
1 file changed
+2
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| |||
437 | 438 | | |
438 | 439 | | |
439 | 440 | | |
| 441 | + | |
440 | 442 | | |
441 | 443 | | |
442 | 444 | | |
| |||
0 commit comments