Bug 206740

Summary: There is no check for iconv* functions when the libiconv library loaded by dlopen
Product: Base System Reporter: Iouri V. Ivliev <fbsd>
Component: binAssignee: freebsd-bugs (Nobody) <bugs>
Status: Closed Overcome By Events    
Severity: Affects Some People CC: ardovm, vas, w.schwarzenfeld
Priority: --- Keywords: patch
Version: 9.3-STABLE   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
fixes use of iconv* functions from library loaded by dlopen. none

Description Iouri V. Ivliev 2016-01-29 17:42:10 UTC
Created attachment 166274 [details]
fixes use of iconv* functions from library loaded by dlopen.

When the world is compiled without iconv support in libc, some code in the base system tries to use the iconv* functions from the external library (usually converters/libiconv port). For now, the code in libkiconv and libsmb doesn't check the presence of iconv* functions in the loaded library. Starting with libiconv-1.14_9 iconv* rymbols are not exported from libiconv.so. As a result, there is a segmentation faults in the code that uses libkiconv and libsmb.

A set of patches for libkiconv, libsmb and csh fixes some issues when use iconv* functions from libiconv loaded by dlopen(3):
1. allows to load alternative libiconv library using LIBICONV environment variable.
2. tries fallback to iconv_open, iconv and iconv_close functions when libiconv_open, libiconv and libiconv_close symbols are not exported from loaded library.
3. an error will be returned when any functions are missing in the library.

This should fix at least https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=205256 and segfaults in mount_msdosfs.
Comment 1 Walter Schwarzenfeld freebsd_triage 2018-09-03 14:54:17 UTC
see bug #205256. Overcome by events.