diff options
author | Patrick Mooney <pmooney@pfmooney.com> | 2022-09-11 19:30:39 +0000 |
---|---|---|
committer | Andy Fiddaman <illumos@fiddaman.net> | 2022-09-13 19:40:22 +0000 |
commit | 4e18e297380f99d39327599157792494d044942a (patch) | |
tree | 0548e8cb58c09ef1cb181f2ff96c94ba609f8324 /usr/src/uts/common/fs/proc/prsubr.c | |
parent | f8e9c7b3ba7100b047717589235b6d05ec43646c (diff) | |
download | illumos-gate-4e18e297380f99d39327599157792494d044942a.tar.gz |
14236 signed math leads getelfshdr astray
14242 programs that lack PT_PHDR are not properly loaded
Portions contributed by: Bryan Cantrill <bryan@joyent.com>
Portions contributed by: Andy Fiddaman <illumos@fiddaman.net>
Reviewed by: Robert Mustacchi <rm+illumos@fingolfin.org>
Reviewed by: Patrick Mooney <pmooney@pfmooney.com>
Reviewed by: Andy Fiddaman <illumos@fiddaman.net>
Approved by: Rich Lowe <richlowe@richlowe.net>
Diffstat (limited to 'usr/src/uts/common/fs/proc/prsubr.c')
-rw-r--r-- | usr/src/uts/common/fs/proc/prsubr.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/usr/src/uts/common/fs/proc/prsubr.c b/usr/src/uts/common/fs/proc/prsubr.c index 021d2b4b49..da43f59092 100644 --- a/usr/src/uts/common/fs/proc/prsubr.c +++ b/usr/src/uts/common/fs/proc/prsubr.c @@ -21,7 +21,7 @@ /* * Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright 2017, Joyent, Inc. + * Copyright 2019 Joyent, Inc. * Copyright 2020 OmniOS Community Edition (OmniOSce) Association. * Copyright 2022 MNX Cloud, Inc. */ @@ -1409,10 +1409,10 @@ prgetaction32(proc_t *p, user_t *up, uint_t sig, struct sigaction32 *sp) /* * Count the number of segments in this process's address space. */ -int +uint_t prnsegs(struct as *as, int reserved) { - int n = 0; + uint_t n = 0; struct seg *seg; ASSERT(as != &kas && AS_WRITE_HELD(as)); @@ -1429,8 +1429,21 @@ prnsegs(struct as *as, int reserved) for (saddr = seg->s_base; saddr < eaddr; saddr = naddr) { (void) pr_getprot(seg, reserved, &tmp, &saddr, &naddr, eaddr); - if (saddr != naddr) + if (saddr != naddr) { n++; + /* + * prnsegs() was formerly designated to return + * an 'int' despite having no ability or use + * for negative results. As part of changing + * it to 'uint_t', keep the old effective limit + * of INT_MAX in place. + */ + if (n == INT_MAX) { + pr_getprot_done(&tmp); + ASSERT(tmp == NULL); + return (n); + } + } } ASSERT(tmp == NULL); |