[LTP] [PATCH v6 1/3] syscalls/modify_ldt: Add lapi/ldt.h
Ricardo B. Marlière
rbm@suse.com
Mon Apr 7 14:18:16 CEST 2025
On Mon Apr 7, 2025 at 9:09 AM -03, Cyril Hrubis wrote:
> Hi!
>> +static inline int modify_ldt(int func, const struct user_desc *ptr,
>> + unsigned long bytecount)
>> +{
>> + return tst_syscall(__NR_modify_ldt, func, ptr, bytecount);
>> +}
>> +
>> +static inline int safe_modify_ldt(const char *file, const int lineno, int func,
>> + const struct user_desc *ptr,
>> + unsigned long bytecount)
>> +{
>> + int rval;
>> +
>> + rval = modify_ldt(func, ptr, bytecount);
>> + if (rval == -1)
>> + tst_brk_(file, lineno, TBROK | TERRNO,
>> + "modify_ldt(%d, %p, %lu)", func, ptr, bytecount);
>
> We should make sure that we only accept the success value here (as we do
> in the rest of the safe macros) so that we catch the cases when kernel
> returns an invalid value.
>
> This should be:
>
> if (rval == -1) {
> tst_brk_(...);
> } else if (rval) {
> tst_brk_("modify_ltd(...) invalid retval %i", ...);
> }
Makes sense! Unfortunately I just sent a v7, will wait some more before
sending the next one :)
>
>
> With that fixed:
>
> Reviewed-by: Cyril Hrubis <chrubis@suse.cz>
Thanks for reviewing,
- Ricardo.
More information about the ltp
mailing list