[PATCH] Use libc_hidden_proto / _def for hidden wchar ifunc symbols.
Stefan Liebler
stli@linux.vnet.ibm.com
Mon Nov 13 10:16:00 GMT 2017
Hi,
on s390 (31bit) various debug/tst-*chk* testcases are failing as the
tests are ending with a segmentation fault.
One test is e.g. calling wcsnrtombs in debug/tst-chk1.c:1549.
The function wcsnrtombs itself calls __wcsnlen. This function is called
via PLT! The PLT-stub itself loads the address from GOT (r12 is assumed
to be the GOT-pointer). In this case the loaded address is zero and the
following branch leads to the segmentation fault.
Due to the attribute-hidden in commit
44af8a32c341672b5160fdc2839767e9a837ad26 "Mark internal wchar functions
with attribute_hidden [BZ #18822]" for e.g. the __wcsnlen function, r12
is not loaded with the GOT-pointer in wcsnrtombs.
On s390x (64bit), this __wcsnlen call is also using the PLT-stub. But it
is not failing as the GOT-pointer is setup with larl-instruction by the
PLT-stub itself.
Note: On s390x/s390, __wcsnlen is an IFUNC symbol.
On x86_64, __wcsnlen is also an IFUNC symbol and is called via PLT, too.
Further IFUNC symbols on s390 which were marked as hidden by the
mentioned commit are: __wcscat, __wcsncpy, __wcpncpy, __wcschrnul.
This patch adds the libc_hidden_proto / libc_hidden_def construct.
Then the __GI_* symbols are the default-ifunc-variants which can be
called without PLT.
Okay to commit?
Bye.
Stefan
ChangeLog:
* include/wchar.h (__wcsnlen, __wcscat, __wcsncpy, __wcpncpy,
__wcschrnul): Add libc_hidden_proto.
* wcsmbs/wcsnlen.c (__wcsnlen): Add libc_hidden_def.
* wcsmbs/wcscat.c (__wcscat): Likewise.
* wcsmbs/wcschrnul.c (__wcschrnul): Likewise.
* wcsmbs/wcsncpy.c (__wcsncpy): Likewise.
* wcsmbs/wcpncpy.c (__wcpncpy): Likewise.
* sysdeps/x86_64/multiarch/wcsnlen-c.c (__wcsnlen): Add libc_hidden_def
which aliases to default ifunc-variant.
* sysdeps/s390/multiarch/wcsnlen-c.c (__wcsnlen): Likewise.
* sysdeps/s390/multiarch/wcscat-c.c (__wcscat): Likewise.
* sysdeps/s390/multiarch/wcschrnul-c.c (__wcschrnul): Likewise.
* sysdeps/s390/multiarch/wcsncpy-c.c (__wcsncpy): Likewise.
* sysdeps/s390/multiarch/wcpncpy-c.c (__wcpncpy): Likewise.
* sysdeps/s390/multiarch/wcsnlen.c (__wcsnlen): Redirect symbol in
header and use s390_vx_libc_ifunc_redirected instead of
s390_vx_libc_ifunc.
* sysdeps/s390/multiarch/wcscat.c (__wcscat): Likewise.
* sysdeps/s390/multiarch/wcschrnul.c (__wcschrnul): Likewise.
* sysdeps/s390/multiarch/wcsncpy.c (__wcsncpy): Likewise.
* sysdeps/s390/multiarch/wcpncpy.c (__wcpncpy): Likewise.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 20171113_hidden_wchars.patch
Type: text/x-patch
Size: 11855 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20171113/5bcf5e53/attachment.bin>
More information about the Libc-alpha
mailing list