summaryrefslogtreecommitdiff
path: root/usr/src
diff options
context:
space:
mode:
authorRichard Lowe <richlowe@richlowe.net>2021-12-02 15:15:52 -0600
committerRichard Lowe <richlowe@richlowe.net>2021-12-12 15:40:06 -0600
commit01355ae8e99e2965e664160bdd8ac9f0fdc1329c (patch)
treedbea1f257da6813eadfb9b9b4143d39b34ce73a4 /usr/src
parent47c607a3073a2acd65c934fe1e6967b2aa0094d8 (diff)
downloadillumos-gate-01355ae8e99e2965e664160bdd8ac9f0fdc1329c.tar.gz
14283 ldd should not complain about non-executable shared objects
Reviewed by: Jason King <jason.brian.king@gmail.com> Reviewed by: Andy Fiddaman <andy@omnios.org> Reviewed by: Toomas Soome <tsoome@me.com> Approved by: Dan McDonald <danmcd@joyent.com>
Diffstat (limited to 'usr/src')
-rw-r--r--usr/src/cmd/sgs/ldd/common/ldd.c16
-rw-r--r--usr/src/cmd/sgs/ldd/common/ldd.msg3
-rw-r--r--usr/src/cmd/sgs/tools/SUNWonld-README1
-rw-r--r--usr/src/uts/common/os/grow.c21
4 files changed, 13 insertions, 28 deletions
diff --git a/usr/src/cmd/sgs/ldd/common/ldd.c b/usr/src/cmd/sgs/ldd/common/ldd.c
index 00e0ec1478..c686b51e0e 100644
--- a/usr/src/cmd/sgs/ldd/common/ldd.c
+++ b/usr/src/cmd/sgs/ldd/common/ldd.c
@@ -470,18 +470,12 @@ elf_check(int nfile, char *fname, char *cname, Elf *elf, int fflag)
/*
* Check that the file is executable. Dynamic executables must be
- * executable to be exec'ed. Shared objects need not be executable to
- * be mapped with a dynamic executable, however, by convention they're
- * supposed to be executable.
+ * executable to be exec'ed for ldd(1) to function.
*/
- if (access(fname, X_OK) != 0) {
- if (ehdr.e_type == ET_EXEC) {
- (void) fprintf(stderr, MSG_INTL(MSG_USP_NOTEXEC_1),
- cname, fname);
- return (1);
- }
- (void) fprintf(stderr, MSG_INTL(MSG_USP_NOTEXEC_2), cname,
- fname);
+ if ((access(fname, X_OK) != 0) && (ehdr.e_type == ET_EXEC)) {
+ (void) fprintf(stderr, MSG_INTL(MSG_USP_NOTEXEC),
+ cname, fname);
+ return (1);
}
/*
diff --git a/usr/src/cmd/sgs/ldd/common/ldd.msg b/usr/src/cmd/sgs/ldd/common/ldd.msg
index beb2ee88d0..2f2301cd44 100644
--- a/usr/src/cmd/sgs/ldd/common/ldd.msg
+++ b/usr/src/cmd/sgs/ldd/common/ldd.msg
@@ -47,8 +47,7 @@
@ MSG_USP_UNKNOWN "%s: %s: unsupported or unknown file type\n"
@ MSG_USP_ELFINS "%s: %s: file has insecure interpreter %s\n"
@ MSG_USP_AOUTINS "%s: %s: insecure a.out file\n"
-@ MSG_USP_NOTEXEC_1 "%s: %s: is not executable\n"
-@ MSG_USP_NOTEXEC_2 "warning: %s: %s: is not executable\n"
+@ MSG_USP_NOTEXEC "%s: %s: is not executable\n"
# ELF messages
diff --git a/usr/src/cmd/sgs/tools/SUNWonld-README b/usr/src/cmd/sgs/tools/SUNWonld-README
index 50f2f457dc..550e8423fb 100644
--- a/usr/src/cmd/sgs/tools/SUNWonld-README
+++ b/usr/src/cmd/sgs/tools/SUNWonld-README
@@ -1682,3 +1682,4 @@ Bugid Risk Synopsis
14207 want updated ELF relocation definitions from the psABI
14209 partial support for new relaxable relocations
14250 ld should resolve discarded COMDAT symbols against their mates
+14283 ldd should not complain about non-executable shared objects
diff --git a/usr/src/uts/common/os/grow.c b/usr/src/uts/common/os/grow.c
index de2a4f26c4..da53bce24e 100644
--- a/usr/src/uts/common/os/grow.c
+++ b/usr/src/uts/common/os/grow.c
@@ -30,7 +30,7 @@
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
+/* All Rights Reserved */
#include <sys/types.h>
#include <sys/inttypes.h>
@@ -758,20 +758,11 @@ smmap_common(caddr_t *addrp, size_t len,
}
/*
- * XXX - Do we also adjust maxprot based on protections
- * of the vnode? E.g. if no execute permission is given
- * on the vnode for the current user, maxprot probably
- * should disallow PROT_EXEC also? This is different
- * from the write access as this would be a per vnode
- * test as opposed to a per fd test for writability.
- */
-
- /*
- * Verify that the specified protections are not greater than
- * the maximum allowable protections. Also test to make sure
- * that the file descriptor does allows for read access since
- * "write only" mappings are hard to do since normally we do
- * the read from the file before the page can be written.
+ * Verify that the specified protections are not greater than the
+ * maximum allowable protections. Also test to make sure that the
+ * file descriptor allows for read access since "write only" mappings
+ * are hard to do since normally we do the read from the file before
+ * the page can be written.
*/
if (((maxprot & uprot) != uprot) || (fp->f_flag & FREAD) == 0)
return (EACCES);