diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/test_bpf.c | 94 |
1 files changed, 94 insertions, 0 deletions
diff --git a/lib/test_bpf.c b/lib/test_bpf.c index da34e337f45b..af677cb718f5 100644 --- a/lib/test_bpf.c +++ b/lib/test_bpf.c | |||
@@ -1391,6 +1391,100 @@ static struct bpf_test tests[] = { | |||
1391 | { }, | 1391 | { }, |
1392 | { } | 1392 | { } |
1393 | }, | 1393 | }, |
1394 | { | ||
1395 | "JUMPS + HOLES", | ||
1396 | .u.insns = { | ||
1397 | BPF_STMT(BPF_LD | BPF_H | BPF_ABS, 0), | ||
1398 | BPF_JUMP(BPF_JMP | BPF_JGE, 0, 13, 15), | ||
1399 | BPF_STMT(BPF_LD | BPF_H | BPF_ABS, 0), | ||
1400 | BPF_STMT(BPF_LD | BPF_H | BPF_ABS, 0), | ||
1401 | BPF_STMT(BPF_LD | BPF_H | BPF_ABS, 0), | ||
1402 | BPF_STMT(BPF_LD | BPF_H | BPF_ABS, 0), | ||
1403 | BPF_STMT(BPF_LD | BPF_H | BPF_ABS, 0), | ||
1404 | BPF_STMT(BPF_LD | BPF_H | BPF_ABS, 0), | ||
1405 | BPF_STMT(BPF_LD | BPF_H | BPF_ABS, 0), | ||
1406 | BPF_STMT(BPF_LD | BPF_H | BPF_ABS, 0), | ||
1407 | BPF_STMT(BPF_LD | BPF_H | BPF_ABS, 0), | ||
1408 | BPF_STMT(BPF_LD | BPF_H | BPF_ABS, 0), | ||
1409 | BPF_STMT(BPF_LD | BPF_H | BPF_ABS, 0), | ||
1410 | BPF_STMT(BPF_LD | BPF_H | BPF_ABS, 0), | ||
1411 | BPF_STMT(BPF_LD | BPF_H | BPF_ABS, 0), | ||
1412 | BPF_JUMP(BPF_JMP | BPF_JEQ, 0x90c2894d, 3, 4), | ||
1413 | BPF_STMT(BPF_LD | BPF_H | BPF_ABS, 0), | ||
1414 | BPF_JUMP(BPF_JMP | BPF_JEQ, 0x90c2894d, 1, 2), | ||
1415 | BPF_STMT(BPF_LD | BPF_H | BPF_ABS, 0), | ||
1416 | BPF_JUMP(BPF_JMP | BPF_JGE, 0, 14, 15), | ||
1417 | BPF_JUMP(BPF_JMP | BPF_JGE, 0, 13, 14), | ||
1418 | BPF_STMT(BPF_LD | BPF_H | BPF_ABS, 0), | ||
1419 | BPF_STMT(BPF_LD | BPF_H | BPF_ABS, 0), | ||
1420 | BPF_STMT(BPF_LD | BPF_H | BPF_ABS, 0), | ||
1421 | BPF_STMT(BPF_LD | BPF_H | BPF_ABS, 0), | ||
1422 | BPF_STMT(BPF_LD | BPF_H | BPF_ABS, 0), | ||
1423 | BPF_STMT(BPF_LD | BPF_H | BPF_ABS, 0), | ||
1424 | BPF_STMT(BPF_LD | BPF_H | BPF_ABS, 0), | ||
1425 | BPF_STMT(BPF_LD | BPF_H | BPF_ABS, 0), | ||
1426 | BPF_STMT(BPF_LD | BPF_H | BPF_ABS, 0), | ||
1427 | BPF_STMT(BPF_LD | BPF_H | BPF_ABS, 0), | ||
1428 | BPF_STMT(BPF_LD | BPF_H | BPF_ABS, 0), | ||
1429 | BPF_STMT(BPF_LD | BPF_H | BPF_ABS, 0), | ||
1430 | BPF_STMT(BPF_LD | BPF_H | BPF_ABS, 0), | ||
1431 | BPF_JUMP(BPF_JMP | BPF_JEQ, 0x2ac28349, 2, 3), | ||
1432 | BPF_JUMP(BPF_JMP | BPF_JEQ, 0x2ac28349, 1, 2), | ||
1433 | BPF_STMT(BPF_LD | BPF_H | BPF_ABS, 0), | ||
1434 | BPF_JUMP(BPF_JMP | BPF_JGE, 0, 14, 15), | ||
1435 | BPF_JUMP(BPF_JMP | BPF_JGE, 0, 13, 14), | ||
1436 | BPF_STMT(BPF_LD | BPF_H | BPF_ABS, 0), | ||
1437 | BPF_STMT(BPF_LD | BPF_H | BPF_ABS, 0), | ||
1438 | BPF_STMT(BPF_LD | BPF_H | BPF_ABS, 0), | ||
1439 | BPF_STMT(BPF_LD | BPF_H | BPF_ABS, 0), | ||
1440 | BPF_STMT(BPF_LD | BPF_H | BPF_ABS, 0), | ||
1441 | BPF_STMT(BPF_LD | BPF_H | BPF_ABS, 0), | ||
1442 | BPF_STMT(BPF_LD | BPF_H | BPF_ABS, 0), | ||
1443 | BPF_STMT(BPF_LD | BPF_H | BPF_ABS, 0), | ||
1444 | BPF_STMT(BPF_LD | BPF_H | BPF_ABS, 0), | ||
1445 | BPF_STMT(BPF_LD | BPF_H | BPF_ABS, 0), | ||
1446 | BPF_STMT(BPF_LD | BPF_H | BPF_ABS, 0), | ||
1447 | BPF_STMT(BPF_LD | BPF_H | BPF_ABS, 0), | ||
1448 | BPF_STMT(BPF_LD | BPF_H | BPF_ABS, 0), | ||
1449 | BPF_JUMP(BPF_JMP | BPF_JEQ, 0x90d2ff41, 2, 3), | ||
1450 | BPF_JUMP(BPF_JMP | BPF_JEQ, 0x90d2ff41, 1, 2), | ||
1451 | BPF_STMT(BPF_LD | BPF_H | BPF_ABS, 0), | ||
1452 | BPF_STMT(BPF_RET | BPF_A, 0), | ||
1453 | BPF_STMT(BPF_RET | BPF_A, 0), | ||
1454 | }, | ||
1455 | CLASSIC, | ||
1456 | { 0x00, 0x1b, 0x21, 0x3c, 0x9d, 0xf8, 0x90, 0xe2, | ||
1457 | 0xba, 0x0a, 0x56, 0xb4, 0x08, 0x00, 0x45, 0x00, | ||
1458 | 0x00, 0x28, 0x00, 0x00, 0x20, 0x00, 0x40, 0x11, | ||
1459 | 0x00, 0x00, 0xc0, 0xa8, 0x33, 0x01, 0xc0, 0xa8, | ||
1460 | 0x33, 0x02, 0xbb, 0xb6, 0xa9, 0xfa, 0x00, 0x14, | ||
1461 | 0x00, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, | ||
1462 | 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, | ||
1463 | 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, | ||
1464 | 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, | ||
1465 | 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, | ||
1466 | 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc }, | ||
1467 | { { 88, 0x001b } } | ||
1468 | }, | ||
1469 | { | ||
1470 | "check: RET X", | ||
1471 | .u.insns = { | ||
1472 | BPF_STMT(BPF_RET | BPF_X, 0), | ||
1473 | }, | ||
1474 | CLASSIC | FLAG_NO_DATA | FLAG_EXPECTED_FAIL, | ||
1475 | { }, | ||
1476 | { }, | ||
1477 | }, | ||
1478 | { | ||
1479 | "check: LDX + RET X", | ||
1480 | .u.insns = { | ||
1481 | BPF_STMT(BPF_LDX | BPF_IMM, 42), | ||
1482 | BPF_STMT(BPF_RET | BPF_X, 0), | ||
1483 | }, | ||
1484 | CLASSIC | FLAG_NO_DATA | FLAG_EXPECTED_FAIL, | ||
1485 | { }, | ||
1486 | { }, | ||
1487 | }, | ||
1394 | }; | 1488 | }; |
1395 | 1489 | ||
1396 | static struct net_device dev; | 1490 | static struct net_device dev; |