This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 2/7] tunables: Add support for tunables of uint64_t type



On 17/05/2017 04:07, Siddhesh Poyarekar wrote:
> On Tuesday 16 May 2017 03:39 AM, Adhemerval Zanella wrote:
>> As for previous patch we should update README.tunables with this new allowed
>> type.  Also, I think we should add that both hexadecimal and octal are also
>> supported.
> 
> I've added this.
> 
>> I think this does not really handle overflows correctly and I would suggest
>> to actually use the new check_mul_overflow_size_t macro from reallocarray
>> patch to actually check it and result UINT64_MAX for the case.
> 
> I don't understand, can you please elaborate?  I am specifically trying
> to ensure that the computation does not overflow at all and saturating
> the result at UINT64_MAX if the result is too large.  The subsequent
> TUNABLE_SET_VAL_IF_VALID_RANGE check should then do a range check before
> setting the tunable value and refuse to set it if it is beyond the
> bounds of the tunable type.
> 

My mistake here, I noticed after fire up the email that it is indeed
checking correctly for overflow.

>> Also, do we have any generic value range input test for tunable interface
>> (to check for validation, overflow, underflow, etc.)?
> 
> TUNABLE_SET_VAL_IF_VALID_RANGE does the range check and avoids setting
> the tunable if the value is not within the range of its type or the set
> range, whichever is smaller.
> 
> Siddhesh

Sorry, I meant an external testcase to stress out such cases.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]