summaryrefslogtreecommitdiff
path: root/usr/src/lib/libproc
diff options
context:
space:
mode:
authorahl <none@none>2005-07-08 07:54:02 -0700
committerahl <none@none>2005-07-08 07:54:02 -0700
commit40c00cd7c8e55ec14d49b13d636ebecb232852fc (patch)
tree77cf1407f37b6c2db84f7dbf20b92ae484405fa1 /usr/src/lib/libproc
parentcf839854c6f4252cbdfd0c4c84cb177a825fc8ad (diff)
downloadillumos-joyent-40c00cd7c8e55ec14d49b13d636ebecb232852fc.tar.gz
6289672 gcore(1) will produce zero-sized LDT notes
6293270 mm driver needs to be more robust 6293493 incorrect procfs watchpoint action on amd64 kernel.
Diffstat (limited to 'usr/src/lib/libproc')
-rw-r--r--usr/src/lib/libproc/common/Pgcore.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/usr/src/lib/libproc/common/Pgcore.c b/usr/src/lib/libproc/common/Pgcore.c
index 9147bcb201..aa374a71af 100644
--- a/usr/src/lib/libproc/common/Pgcore.c
+++ b/usr/src/lib/libproc/common/Pgcore.c
@@ -20,7 +20,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -1308,18 +1308,22 @@ Pfgcore(struct ps_prochandle *P, int fd, core_content_t content)
size_t size;
int nldt;
- nldt = Pldt(P, NULL, 0);
- size = sizeof (struct ssd) * nldt;
- if ((ldtp = malloc(size)) == NULL)
- goto err;
+ /*
+ * Only dump out non-zero sized LDT notes.
+ */
+ if ((nldt = Pldt(P, NULL, 0)) != 0) {
+ size = sizeof (struct ssd) * nldt;
+ if ((ldtp = malloc(size)) == NULL)
+ goto err;
+
+ if (Pldt(P, ldtp, nldt) == -1 ||
+ write_note(fd, NT_LDT, ldtp, size, &doff) != 0) {
+ free(ldtp);
+ goto err;
+ }
- if (Pldt(P, ldtp, nldt) == -1 ||
- write_note(fd, NT_LDT, ldtp, size, &doff) != 0) {
free(ldtp);
- goto err;
}
-
- free(ldtp);
}
#endif /* __i386 || __amd64 */