Repository navigation
Commit eed84f9
bpf: fix sanitation of alu op with pointer / scalar type from different paths
[ commit d3bd741 upstream ]
While 979d63d ("bpf: prevent out of bounds speculation on pointer
arithmetic") took care of rejecting alu op on pointer when e.g. pointer
came from two different map values with different map properties such as
value size, Jann reported that a case was not covered yet when a given
alu op is used in both "ptr_reg += reg" and "numeric_reg += reg" from
different branches where we would incorrectly try to sanitize based
on the pointer's limit. Catch this corner case and reject the program
instead.
Fixes: 979d63d ("bpf: prevent out of bounds speculation on pointer arithmetic")
Reported-by: Jann Horn <jannh@google.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>1 parent f92a819 commit eed84f9
2 files changed
Lines changed: 49 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
147 | 147 | | |
148 | 148 | | |
149 | 149 | | |
| 150 | + | |
150 | 151 | | |
151 | 152 | | |
152 | 153 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2734 | 2734 | | |
2735 | 2735 | | |
2736 | 2736 | | |
| 2737 | + | |
| 2738 | + | |
| 2739 | + | |
| 2740 | + | |
| 2741 | + | |
| 2742 | + | |
| 2743 | + | |
| 2744 | + | |
| 2745 | + | |
| 2746 | + | |
| 2747 | + | |
| 2748 | + | |
| 2749 | + | |
| 2750 | + | |
| 2751 | + | |
| 2752 | + | |
| 2753 | + | |
| 2754 | + | |
| 2755 | + | |
| 2756 | + | |
| 2757 | + | |
| 2758 | + | |
| 2759 | + | |
| 2760 | + | |
| 2761 | + | |
| 2762 | + | |
| 2763 | + | |
| 2764 | + | |
| 2765 | + | |
| 2766 | + | |
| 2767 | + | |
| 2768 | + | |
| 2769 | + | |
| 2770 | + | |
2737 | 2771 | | |
2738 | 2772 | | |
2739 | 2773 | | |
| |||
2748 | 2782 | | |
2749 | 2783 | | |
2750 | 2784 | | |
2751 | | - | |
| 2785 | + | |
2752 | 2786 | | |
2753 | 2787 | | |
2754 | 2788 | | |
| |||
2764 | 2798 | | |
2765 | 2799 | | |
2766 | 2800 | | |
2767 | | - | |
2768 | | - | |
2769 | | - | |
2770 | | - | |
2771 | | - | |
2772 | | - | |
2773 | | - | |
| 2801 | + | |
2774 | 2802 | | |
2775 | | - | |
2776 | | - | |
2777 | | - | |
2778 | | - | |
2779 | | - | |
2780 | 2803 | | |
2781 | 2804 | | |
2782 | 2805 | | |
| |||
3048 | 3071 | | |
3049 | 3072 | | |
3050 | 3073 | | |
| 3074 | + | |
| 3075 | + | |
3051 | 3076 | | |
3052 | 3077 | | |
3053 | 3078 | | |
| |||
3082 | 3107 | | |
3083 | 3108 | | |
3084 | 3109 | | |
| 3110 | + | |
| 3111 | + | |
| 3112 | + | |
| 3113 | + | |
| 3114 | + | |
3085 | 3115 | | |
3086 | 3116 | | |
3087 | 3117 | | |
| |||
3101 | 3131 | | |
3102 | 3132 | | |
3103 | 3133 | | |
| 3134 | + | |
| 3135 | + | |
| 3136 | + | |
| 3137 | + | |
| 3138 | + | |
3104 | 3139 | | |
3105 | 3140 | | |
3106 | 3141 | | |
| |||
0 commit comments