Check __dso_handle is NULL in non-DSO objects. It should only be non-NULL

when accessed from a shared object.

MFC with:	r339738
Sponsored by:	DARPA, AFRL
This commit is contained in:
Andrew Turner 2018-10-29 17:03:20 +00:00
parent 5201e0f110
commit 235130433a
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=339864

View File

@ -119,11 +119,22 @@ ATF_TC_BODY(fini_array_test, tc)
}
}
extern void *__dso_handle;
ATF_TC_WITHOUT_HEAD(dso_handle_test);
ATF_TC_BODY(dso_handle_test, tc)
{
ATF_REQUIRE_MSG(__dso_handle == NULL,
"Invalid __dso_handle in non-DSO");
}
ATF_TP_ADD_TCS(tp)
{
ATF_TP_ADD_TC(tp, dtors_test);
ATF_TP_ADD_TC(tp, fini_array_test);
ATF_TP_ADD_TC(tp, dso_handle_test);
return (atf_no_error());
}