In the stdio cleanup push and pop wrappers, always call libc stubs for
__pthread_cleanup_push/pop_imp instead of symbols also exported from libthr. This prevents calls into libthr if libthr is not yet initialized. The situation occurs e.g. when an LD_PRELOADed object is not linked against libthr, but the main binary is. Reported and tested by: jbeich PR: 220381 Discussed with: vangyzen Sponsored by: The FreeBSD Foundation MFC after: 13 days
This commit is contained in:
parent
6c738c519a
commit
30e6670850
@ -415,6 +415,11 @@ void __libc_map_stacks_exec(void);
|
|||||||
void _pthread_cancel_enter(int);
|
void _pthread_cancel_enter(int);
|
||||||
void _pthread_cancel_leave(int);
|
void _pthread_cancel_leave(int);
|
||||||
|
|
||||||
|
struct _pthread_cleanup_info;
|
||||||
|
void ___pthread_cleanup_push_imp(void (*)(void *), void *,
|
||||||
|
struct _pthread_cleanup_info *);
|
||||||
|
void ___pthread_cleanup_pop_imp(int);
|
||||||
|
|
||||||
void __throw_constraint_handler_s(const char * restrict msg, int error);
|
void __throw_constraint_handler_s(const char * restrict msg, int error);
|
||||||
|
|
||||||
#endif /* _LIBC_PRIVATE_H_ */
|
#endif /* _LIBC_PRIVATE_H_ */
|
||||||
|
@ -148,11 +148,11 @@ void __stdio_cancel_cleanup(void *);
|
|||||||
struct _pthread_cleanup_info __cleanup_info__; \
|
struct _pthread_cleanup_info __cleanup_info__; \
|
||||||
if (__isthreaded) { \
|
if (__isthreaded) { \
|
||||||
_FLOCKFILE(fp); \
|
_FLOCKFILE(fp); \
|
||||||
__pthread_cleanup_push_imp( \
|
___pthread_cleanup_push_imp( \
|
||||||
__stdio_cancel_cleanup, (fp), \
|
__stdio_cancel_cleanup, (fp), \
|
||||||
&__cleanup_info__); \
|
&__cleanup_info__); \
|
||||||
} else { \
|
} else { \
|
||||||
__pthread_cleanup_push_imp( \
|
___pthread_cleanup_push_imp( \
|
||||||
__stdio_cancel_cleanup, NULL, \
|
__stdio_cancel_cleanup, NULL, \
|
||||||
&__cleanup_info__); \
|
&__cleanup_info__); \
|
||||||
} \
|
} \
|
||||||
@ -160,7 +160,7 @@ void __stdio_cancel_cleanup(void *);
|
|||||||
#define FUNLOCKFILE_CANCELSAFE() \
|
#define FUNLOCKFILE_CANCELSAFE() \
|
||||||
(void)0; \
|
(void)0; \
|
||||||
} \
|
} \
|
||||||
__pthread_cleanup_pop_imp(1); \
|
___pthread_cleanup_pop_imp(1); \
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* _STDIO_LOCAL_H */
|
#endif /* _STDIO_LOCAL_H */
|
||||||
|
Loading…
Reference in New Issue
Block a user