summaryrefslogtreecommitdiff
path: root/usr/src/uts/common/exec
diff options
context:
space:
mode:
authorDan McDonald <danmcd@joyent.com>2020-11-17 14:48:44 -0500
committerDan McDonald <danmcd@joyent.com>2020-11-17 14:48:44 -0500
commit2d6415143e9c1044d04ebf846f72f232883413cb (patch)
tree555fae9f2f89b0c9a4d8c4bbd66b02b70ded9fc7 /usr/src/uts/common/exec
parent5a1b3228538dfeb09e05cc2bdfad707ee4d698d7 (diff)
parent5a0af8165ce9590e7a18f1ef4f9badc4dd72c6e6 (diff)
downloadillumos-joyent-release-20201119.tar.gz
[illumos-gate merge]release-20201119
commit 5a0af8165ce9590e7a18f1ef4f9badc4dd72c6e6 13274 enable -fstack-protector-strong by default in user land commit 6a817834d81cc75ce12d0d393320837b1fec1e85 5788 Want support for GCC's stack protector in libc commit 350ffdd54baf880f440ddf9697666e283894ded1 13273 want upanic(2) commit 7fdea60d55a95f0e46066fd021c4ef1b1321bafc 13300 mlxcx_cq_setup() doesn't take required locks for ASSERTs Merge notes: - Manifest changes to match package changes (including shipping libssp_ns.a) - Modified lx_vdso tools to not include SSP, to match other build-only tools.
Diffstat (limited to 'usr/src/uts/common/exec')
-rw-r--r--usr/src/uts/common/exec/elf/elf_notes.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/usr/src/uts/common/exec/elf/elf_notes.c b/usr/src/uts/common/exec/elf/elf_notes.c
index 06f9ceb633..a88250b00f 100644
--- a/usr/src/uts/common/exec/elf/elf_notes.c
+++ b/usr/src/uts/common/exec/elf/elf_notes.c
@@ -164,6 +164,13 @@ setup_note_header(Phdr *v, proc_t *p)
v[0].p_filesz += nlwp * sizeof (Note)
+ nlwp * roundup(sizeof (asrset_t), sizeof (Word));
#endif /* __sparc */
+
+ mutex_enter(&p->p_lock);
+ if ((p->p_upanicflag & P_UPF_PANICKED) != 0) {
+ v[0].p_filesz += sizeof (Note) +
+ roundup(sizeof (prupanic_t), sizeof (Word));
+ }
+ mutex_exit(&p->p_lock);
}
int
@@ -186,6 +193,7 @@ write_elfnotes(proc_t *p, int sig, vnode_t *vp, offset_t offset,
priv_impl_info_t prinfo;
struct utsname uts;
prsecflags_t psecflags;
+ prupanic_t upanic;
} *bigwad;
size_t xregsize = prhasx(p)? prgetprxregsize(p) : 0;
@@ -599,6 +607,36 @@ write_elfnotes(proc_t *p, int sig, vnode_t *vp, offset_t offset,
}
ASSERT(nlwp == 0);
+ /*
+ * If a upanic occurred, add a note for it.
+ */
+ mutex_enter(&p->p_lock);
+ if ((p->p_upanicflag & P_UPF_PANICKED) != 0) {
+ bzero(&bigwad->upanic, sizeof (prupanic_t));
+ bigwad->upanic.pru_version = PRUPANIC_VERSION_1;
+ if ((p->p_upanicflag & P_UPF_INVALMSG) != 0) {
+ bigwad->upanic.pru_flags |= PRUPANIC_FLAG_MSG_ERROR;
+ }
+
+ if ((p->p_upanicflag & P_UPF_TRUNCMSG) != 0) {
+ bigwad->upanic.pru_flags |= PRUPANIC_FLAG_MSG_TRUNC;
+ }
+
+ if ((p->p_upanicflag & P_UPF_HAVEMSG) != 0) {
+ bigwad->upanic.pru_flags |= PRUPANIC_FLAG_MSG_VALID;
+ bcopy(p->p_upanic, bigwad->upanic.pru_data,
+ PRUPANIC_BUFLEN);
+ }
+
+ error = elfnote(vp, &offset, NT_UPANIC, sizeof (prupanic_t),
+ &bigwad->upanic, rlimit, credp);
+ if (error != 0) {
+ mutex_exit(&p->p_lock);
+ goto done;
+ }
+ }
+ mutex_exit(&p->p_lock);
+
done:
kmem_free(bigwad, bigsize);
return (error);