This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] Fixing where test-strncmp could read beyond page boundary
On 12/20/2016 11:29 AM, Richard Henderson wrote:
On 12/20/2016 09:19 AM, Paul Clarke wrote:
This change ensures that the "size" passed to strncmp() contains the
strings within the page.
If there is a known difference or a known EOS before the end of the page, then
SIZE can legitimately be beyond the end of the page and the routine should not
SEGV.
Are you certain you're not removing valid testing for this function?
That's a fair question.
do_random_tests() checks if strncmp() gives correct results for different alignment and length combinations. It checks if strncmp() is not issuing unaligned loads beyond a native alignment: by placing the strings near the end of a page, such loads will provoke a seg fault. This test already takes pains to ensure the string proper does not cross a page boundary by doing various checks, but one check missing is for variable 'size'. The 'size' parameter can be used in the implementation of strncmp() to decide the loop value for the number of loads. So these checks help to make the testcase valid thereby any failure would be in the implementation of strncmp().
Regards,
PC