Commit 5603071f authored by Elena Reshetova's avatar Elena Reshetova Committed by Kleber Sacilotto de Souza

ipv6: prevent speculative execution

CVE-2017-5753 (Spectre v1 Intel)

Since the offset value in function raw6_getfrag()
seems to be controllable by userspace and later on
conditionally (upon bound check) used in the
following memcpy, insert an observable speculation
barrier before its usage. This should prevent
observable speculation on that branch and avoid
kernel memory leak.
Signed-off-by: default avatarElena Reshetova <elena.reshetova@intel.com>
Signed-off-by: default avatarAndy Whitcroft <apw@canonical.com>
Signed-off-by: default avatarKleber Sacilotto de Souza <kleber.souza@canonical.com>
parent 98f3f8c3
...@@ -717,6 +717,7 @@ static int raw6_getfrag(void *from, char *to, int offset, int len, int odd, ...@@ -717,6 +717,7 @@ static int raw6_getfrag(void *from, char *to, int offset, int len, int odd,
if (offset < rfv->hlen) { if (offset < rfv->hlen) {
int copy = min(rfv->hlen - offset, len); int copy = min(rfv->hlen - offset, len);
osb();
if (skb->ip_summed == CHECKSUM_PARTIAL) if (skb->ip_summed == CHECKSUM_PARTIAL)
memcpy(to, rfv->c + offset, copy); memcpy(to, rfv->c + offset, copy);
else else
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment