]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
rtld: preserve the 'seen' state of the dlerror message in errmsg_save()
authorKonstantin Belousov <kib@FreeBSD.org>
Mon, 10 May 2021 19:02:19 +0000 (22:02 +0300)
committerKonstantin Belousov <kib@FreeBSD.org>
Mon, 10 May 2021 23:47:00 +0000 (02:47 +0300)
commit630caa95d46191220dd457c2ae2d06460cb4f71b
treec3631054a3f71b1a7688c2a846bdb39e047a02b7
parent5e7cdf1817924f8ae0333c0b53c2da32f35b65ea
rtld: preserve the 'seen' state of the dlerror message in errmsg_save()

rtld preserves its current error message around calls to user init/fini
lists, to not override original error with potential secondary errors
caused by user code recursing into rtld.  After 4d9128da54f8f8e2a29190,
the preservation of the string itself is not enough, the 'seen'
indicator must be preserved as well.  Otherwise, since new code does not
clear string (it cannot), call to _rtld_error() from errmsg_restore()
revived whatever message was consumed last.

Change errmsg_save() to return structure recording both 'seen' indicator
and the message, if any.

PR: 255698
Reported by: Eugene M. Kim <astralblue@gmail.com>
Sponsored by: The FreeBSD Foundation
MFC after: 3 days
libexec/rtld-elf/rtld.c