137 if (sval_cmp(tmp->max, sval) >= 0)
138 return 1;
139 } END_FOR_EACH_PTR(tmp);
140 return 0;
141 }
142
143 int rl_range_has_min_value(struct range_list *rl, sval_t sval)
144 {
145 struct data_range *tmp;
146
147 FOR_EACH_PTR(rl, tmp) {
148 if (!sval_cmp(tmp->min, sval)) {
149 return 1;
150 }
151 } END_FOR_EACH_PTR(tmp);
152 return 0;
153 }
154
155 static bool rl_is_tagged(struct range_list *rl)
156 {
157 sval_t invalid = { .type = &ullong_ctype, .value = (1ULL << 56) };
158 sval_t invalid_kernel = { .type = &ullong_ctype, .value = (0xff8ULL << 52) };
159
160 /*
161 * We only care for tagged addresses, thus ignore anything where the
162 * ranges of potential values cannot possibly have any of the top byte
163 * bits set.
164 */
165 if (!rl_is_larger_or_equal(rl, invalid))
166 return false;
167
168 /*
169 * Tagged addresses are untagged in the kernel by using sign_extend64 in
170 * the untagged_addr macro. For userspace addresses bit 55 will always
171 * be 0 and thus this has the effect of clearing the top byte. However
172 * for kernel addresses this is not true and the top bits end up set to
173 * all 1s. The untagged_addr macro results in leaving a gap in the range
174 * of possible values which can exist, thus let's look for a tell-tale
175 * range which starts from (0xff8ULL << 52).
176 */
177 if (rl_range_has_min_value(rl, invalid_kernel))
178 return false;
179
|
137 if (sval_cmp(tmp->max, sval) >= 0)
138 return 1;
139 } END_FOR_EACH_PTR(tmp);
140 return 0;
141 }
142
143 int rl_range_has_min_value(struct range_list *rl, sval_t sval)
144 {
145 struct data_range *tmp;
146
147 FOR_EACH_PTR(rl, tmp) {
148 if (!sval_cmp(tmp->min, sval)) {
149 return 1;
150 }
151 } END_FOR_EACH_PTR(tmp);
152 return 0;
153 }
154
155 static bool rl_is_tagged(struct range_list *rl)
156 {
157 sval_t invalid;
158 sval_t invalid_kernel;
159
160 invalid.type = &ullong_ctype;
161 invalid.value = 1ULL << 56;
162 invalid_kernel.type = &ullong_ctype;
163 invalid_kernel.value = 0xff8ULL << 52;
164
165 /*
166 * We only care for tagged addresses, thus ignore anything where the
167 * ranges of potential values cannot possibly have any of the top byte
168 * bits set.
169 */
170 if (!rl_is_larger_or_equal(rl, invalid))
171 return false;
172
173 /*
174 * Tagged addresses are untagged in the kernel by using sign_extend64 in
175 * the untagged_addr macro. For userspace addresses bit 55 will always
176 * be 0 and thus this has the effect of clearing the top byte. However
177 * for kernel addresses this is not true and the top bits end up set to
178 * all 1s. The untagged_addr macro results in leaving a gap in the range
179 * of possible values which can exist, thus let's look for a tell-tale
180 * range which starts from (0xff8ULL << 52).
181 */
182 if (rl_range_has_min_value(rl, invalid_kernel))
183 return false;
184
|