Repository navigation
Commit d93f655
bpf: Handle return value of BPF_PROG_TYPE_STRUCT_OPS prog
[ Upstream commit 356ed64 ]
Currently if a function ptr in struct_ops has a return value, its
caller will get a random return value from it, because the return
value of related BPF_PROG_TYPE_STRUCT_OPS prog is just dropped.
So adding a new flag BPF_TRAMP_F_RET_FENTRY_RET to tell bpf trampoline
to save and return the return value of struct_ops prog if ret_size of
the function ptr is greater than 0. Also restricting the flag to be
used alone.
Fixes: 85d33df ("bpf: Introduce BPF_MAP_TYPE_STRUCT_OPS")
Signed-off-by: Hou Tao <houtao1@huawei.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Martin KaFai Lau <kafai@fb.com>
Link: https://lore.kernel.org/bpf/20210914023351.3664499-1-houtao1@huawei.com
Signed-off-by: Sasha Levin <sashal@kernel.org>1 parent 12cbdae commit d93f655
3 files changed
Lines changed: 47 additions & 15 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1547 | 1547 | | |
1548 | 1548 | | |
1549 | 1549 | | |
1550 | | - | |
| 1550 | + | |
1551 | 1551 | | |
1552 | 1552 | | |
1553 | 1553 | | |
| |||
1573 | 1573 | | |
1574 | 1574 | | |
1575 | 1575 | | |
1576 | | - | |
| 1576 | + | |
| 1577 | + | |
1577 | 1578 | | |
1578 | 1579 | | |
| 1580 | + | |
| 1581 | + | |
| 1582 | + | |
1579 | 1583 | | |
1580 | | - | |
| 1584 | + | |
1581 | 1585 | | |
1582 | 1586 | | |
1583 | 1587 | | |
| |||
1645 | 1649 | | |
1646 | 1650 | | |
1647 | 1651 | | |
1648 | | - | |
| 1652 | + | |
| 1653 | + | |
1649 | 1654 | | |
1650 | 1655 | | |
1651 | 1656 | | |
1652 | 1657 | | |
1653 | 1658 | | |
1654 | | - | |
| 1659 | + | |
| 1660 | + | |
1655 | 1661 | | |
1656 | 1662 | | |
1657 | 1663 | | |
| |||
1694 | 1700 | | |
1695 | 1701 | | |
1696 | 1702 | | |
| 1703 | + | |
| 1704 | + | |
| 1705 | + | |
| 1706 | + | |
| 1707 | + | |
| 1708 | + | |
| 1709 | + | |
| 1710 | + | |
| 1711 | + | |
| 1712 | + | |
| 1713 | + | |
| 1714 | + | |
| 1715 | + | |
| 1716 | + | |
| 1717 | + | |
| 1718 | + | |
| 1719 | + | |
1697 | 1720 | | |
1698 | 1721 | | |
1699 | 1722 | | |
| |||
1766 | 1789 | | |
1767 | 1790 | | |
1768 | 1791 | | |
| 1792 | + | |
1769 | 1793 | | |
1770 | 1794 | | |
1771 | 1795 | | |
1772 | 1796 | | |
1773 | 1797 | | |
1774 | | - | |
1775 | | - | |
| 1798 | + | |
1776 | 1799 | | |
1777 | 1800 | | |
1778 | | - | |
1779 | | - | |
| 1801 | + | |
| 1802 | + | |
| 1803 | + | |
| 1804 | + | |
1780 | 1805 | | |
1781 | 1806 | | |
1782 | 1807 | | |
| |||
1803 | 1828 | | |
1804 | 1829 | | |
1805 | 1830 | | |
1806 | | - | |
| 1831 | + | |
| 1832 | + | |
1807 | 1833 | | |
1808 | 1834 | | |
1809 | 1835 | | |
| |||
1850 | 1876 | | |
1851 | 1877 | | |
1852 | 1878 | | |
1853 | | - | |
| 1879 | + | |
1854 | 1880 | | |
1855 | 1881 | | |
1856 | 1882 | | |
| |||
1870 | 1896 | | |
1871 | 1897 | | |
1872 | 1898 | | |
1873 | | - | |
1874 | | - | |
1875 | 1899 | | |
| 1900 | + | |
| 1901 | + | |
| 1902 | + | |
1876 | 1903 | | |
1877 | 1904 | | |
1878 | 1905 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
526 | 526 | | |
527 | 527 | | |
528 | 528 | | |
| 529 | + | |
| 530 | + | |
529 | 531 | | |
530 | 532 | | |
531 | 533 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
367 | 367 | | |
368 | 368 | | |
369 | 369 | | |
| 370 | + | |
370 | 371 | | |
371 | 372 | | |
372 | 373 | | |
| |||
430 | 431 | | |
431 | 432 | | |
432 | 433 | | |
| 434 | + | |
| 435 | + | |
433 | 436 | | |
434 | 437 | | |
435 | | - | |
436 | | - | |
| 438 | + | |
| 439 | + | |
437 | 440 | | |
438 | 441 | | |
439 | 442 | | |
| |||
0 commit comments