[PATCH]: S390: Fix handling of needles crossing a page in strstr z15 ifunc-variant. [BZ #25226]

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

[PATCH]: S390: Fix handling of needles crossing a page in strstr z15 ifunc-variant. [BZ #25226]

Stefan Liebler-2
Hi,

if the specified needle crosses a page-boundary, the s390-z15 ifunc
variant of strstr truncates the needle which results in invalid results.

This is fixed by loading the needle beyond the page boundary to v18
instead of v16. The bug is sometimes observable in test-strstr.c in
check1() and check2() as the haystack and needle is stored on stack.
Thus the needle can be on a page boundary.

check2 is now extended to test haystack / needles located on stack, at
end of page and on two pages.

As soon as committed I'll backport it to glibc 2.30 release branch.

Bye
Stefan

20191127_fix_strstr_z15.patch (3K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH]: S390: Fix handling of needles crossing a page in strstr z15 ifunc-variant. [BZ #25226]

Florian Weimer-5
* Stefan Liebler:

> if the specified needle crosses a page-boundary, the s390-z15 ifunc
> variant of strstr truncates the needle which results in invalid
> results.
>
> This is fixed by loading the needle beyond the page boundary to v18
> instead of v16. The bug is sometimes observable in test-strstr.c in
> check1() and check2() as the haystack and needle is stored on
> stack. Thus the needle can be on a page boundary.

(GNU style is “check1 and check2”, no parentheses.)

> check2 is now extended to test haystack / needles located on stack, at
> end of page and on two pages.

The test change looks okay to me.  I haven't reviewed the assembler
change.  I think you can commit that as the architecture maintainer.

We will need help from your team with testing the downstream fix.  Do
you think we should fix this proactively in Red Hat Enterprise Linux 8.1
as well?  It received the backport of the new strstr implementation,
too.

Thanks,
Florian

Reply | Threaded
Open this post in threaded view
|

Re: [PATCH]: S390: Fix handling of needles crossing a page in strstr z15 ifunc-variant. [BZ #25226]

Florian Weimer-5
* Florian Weimer:

> * Stefan Liebler:
>
>> if the specified needle crosses a page-boundary, the s390-z15 ifunc
>> variant of strstr truncates the needle which results in invalid
>> results.
>>
>> This is fixed by loading the needle beyond the page boundary to v18
>> instead of v16. The bug is sometimes observable in test-strstr.c in
>> check1() and check2() as the haystack and needle is stored on
>> stack. Thus the needle can be on a page boundary.
>
> (GNU style is “check1 and check2”, no parentheses.)
>
>> check2 is now extended to test haystack / needles located on stack, at
>> end of page and on two pages.
>
> The test change looks okay to me.  I haven't reviewed the assembler
> change.  I think you can commit that as the architecture maintainer.

One more comment if it is not too late: It would be nice to reference
commit 6f47401bd5fc71209219779a0426170a9a7395b0 ("S390: Add arch13
strstr ifunc variant.") as the commit that introduced this bug.

Although it is very easy to track down in this case.

Thanks,
Florian

Reply | Threaded
Open this post in threaded view
|

Re: [PATCH]: S390: Fix handling of needles crossing a page in strstr z15 ifunc-variant. [BZ #25226]

Stefan Liebler-2
In reply to this post by Florian Weimer-5
On 11/27/19 10:33 AM, Florian Weimer wrote:

> * Stefan Liebler:
>
>> if the specified needle crosses a page-boundary, the s390-z15 ifunc
>> variant of strstr truncates the needle which results in invalid
>> results.
>>
>> This is fixed by loading the needle beyond the page boundary to v18
>> instead of v16. The bug is sometimes observable in test-strstr.c in
>> check1() and check2() as the haystack and needle is stored on
>> stack. Thus the needle can be on a page boundary.
>
> (GNU style is “check1 and check2”, no parentheses.)
>
>> check2 is now extended to test haystack / needles located on stack, at
>> end of page and on two pages.
>
> The test change looks okay to me.  I haven't reviewed the assembler
> change.  I think you can commit that as the architecture maintainer.
>
> We will need help from your team with testing the downstream fix.  Do
> you think we should fix this proactively in Red Hat Enterprise Linux 8.1
> as well?  It received the backport of the new strstr implementation,
> too.
>
> Thanks,
> Florian
>

Committed it with “check1 and check2” and a reference to the commit
6f47401bd5fc71209219779a0426170a9a7395b0.

Regarding RHEL, I've recognized that you've opened a RHEL Bugzilla and
answered there.

Thanks,
Stefan

Reply | Threaded
Open this post in threaded view
|

[2.30 COMMITTED] S390: Fix handling of needles crossing a page in strstr z15 ifunc-variant. [BZ #25226]

Stefan Liebler-2
On 11/27/19 12:53 PM, Stefan Liebler wrote:

> On 11/27/19 10:33 AM, Florian Weimer wrote:
>> * Stefan Liebler:
>>
>>> if the specified needle crosses a page-boundary, the s390-z15 ifunc
>>> variant of strstr truncates the needle which results in invalid
>>> results.
>>>
>>> This is fixed by loading the needle beyond the page boundary to v18
>>> instead of v16. The bug is sometimes observable in test-strstr.c in
>>> check1() and check2() as the haystack and needle is stored on
>>> stack. Thus the needle can be on a page boundary.
>>
>> (GNU style is “check1 and check2”, no parentheses.)
>>
>>> check2 is now extended to test haystack / needles located on stack, at
>>> end of page and on two pages.
>>
>> The test change looks okay to me.  I haven't reviewed the assembler
>> change.  I think you can commit that as the architecture maintainer.
>>
>> We will need help from your team with testing the downstream fix.  Do
>> you think we should fix this proactively in Red Hat Enterprise Linux 8.1
>> as well?  It received the backport of the new strstr implementation,
>> too.
>>
>> Thanks,
>> Florian
>>
>
> Committed it with “check1 and check2” and a reference to the commit
> 6f47401bd5fc71209219779a0426170a9a7395b0.
>
> Regarding RHEL, I've recognized that you've opened a RHEL Bugzilla and
> answered there.
>
> Thanks,
> Stefan
>

I've just committed
https://sourceware.org/git/?p=glibc.git;a=commit;h=f4419b0d0181da28f18cba40068f2e75300f5020