diff options
Diffstat (limited to 'usr/src')
43 files changed, 1454 insertions, 329 deletions
diff --git a/usr/src/boot/Makefile.version b/usr/src/boot/Makefile.version index 35ba239a9b..5774ebbc44 100644 --- a/usr/src/boot/Makefile.version +++ b/usr/src/boot/Makefile.version @@ -33,4 +33,4 @@ LOADER_VERSION = 1.1 # Use date like formatting here, YYYY.MM.DD.XX, without leading zeroes. # The version is processed from left to right, the version number can only # be increased. -BOOT_VERSION = $(LOADER_VERSION)-2018.7.22.1 +BOOT_VERSION = $(LOADER_VERSION)-2018.8.04.1 diff --git a/usr/src/boot/sys/boot/i386/gptzfsboot/zfsboot.c b/usr/src/boot/sys/boot/i386/gptzfsboot/zfsboot.c index 20a4fcd44c..3888766ad8 100644 --- a/usr/src/boot/sys/boot/i386/gptzfsboot/zfsboot.c +++ b/usr/src/boot/sys/boot/i386/gptzfsboot/zfsboot.c @@ -724,6 +724,8 @@ i386_zfs_probe(void) for (unit = 0; unit < MAXBDDEV; unit++) { if (bd_unit2bios(unit) == -1) break; + if (bd_unit2bios(unit) < 0x80) + continue; sprintf(devname, "disk%d:", unit); /* If this is not boot disk, use generic probe. */ diff --git a/usr/src/boot/sys/boot/libstand/Makefile.com b/usr/src/boot/sys/boot/libstand/Makefile.com index 9a7e717614..4db8ff77bf 100644 --- a/usr/src/boot/sys/boot/libstand/Makefile.com +++ b/usr/src/boot/sys/boot/libstand/Makefile.com @@ -33,9 +33,7 @@ CPPFLAGS += -D_STANDALONE CFLAGS = -O2 -ffreestanding -Wformat CFLAGS += -mno-mmx -mno-3dnow -mno-sse -mno-sse2 -mno-sse3 -msoft-float -CFLAGS += -Wno-pointer-sign -Wno-empty-body -Wno-unused-value \ - -Wno-unused-function -Wno-switch \ - -Wno-switch-enum -Wno-parentheses +CFLAGS += -Wall -Werror include ${LIBSTAND_SRC}/Makefile.inc diff --git a/usr/src/cmd/getent/Makefile b/usr/src/cmd/getent/Makefile index 571f49b150..c68e2d91fe 100644 --- a/usr/src/cmd/getent/Makefile +++ b/usr/src/cmd/getent/Makefile @@ -31,22 +31,26 @@ PROG= getent include ../Makefile.cmd OBJECTS= \ + dogetauthattr.o \ dogetethers.o \ + dogetexecattr.o \ dogetgr.o \ dogethost.o \ dogetipnodes.o \ dogetnet.o \ dogetnetmask.o \ + dogetprofattr.o \ dogetproject.o \ dogetproto.o \ dogetpw.o \ dogetsp.o \ dogetserv.o \ + dogetuserattr.o \ getent.o SRCS= $(OBJECTS:.o=.c) -LDLIBS += -lsocket -lnsl -lproject +LDLIBS += -lsecdb -lsocket -lnsl -lproject # # for message catalog diff --git a/usr/src/cmd/getent/dogetauthattr.c b/usr/src/cmd/getent/dogetauthattr.c new file mode 100644 index 0000000000..d2327d3fe1 --- /dev/null +++ b/usr/src/cmd/getent/dogetauthattr.c @@ -0,0 +1,88 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright (c) 2018 Peter Tribble. + * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#include <stdio.h> +#include <stdlib.h> +#include <auth_attr.h> +#include "getent.h" + +static int +putauthattr(const authattr_t *auth, FILE *fp) +{ + int i; + kva_t *attrs; + kv_t *data; + + if (auth == NULL) + return (1); + + if (fprintf(fp, "%s:%s:%s:%s:%s:", + auth->name != NULL ? auth->name : "", + auth->res1 != NULL ? auth->res1 : "", + auth->res2 != NULL ? auth->res2 : "", + auth->short_desc != NULL ? auth->short_desc : "", + auth->long_desc != NULL ? auth->long_desc : "") == EOF) + return (1); + attrs = auth->attr; + if (attrs != NULL) { + data = attrs->data; + for (i = 0; i < attrs->length; i++) { + if (fprintf(fp, "%s=%s%s", + data[i].key != NULL ? data[i].key : "", + data[i].value != NULL ? data[i].value : "", + i < (attrs->length)-1 ? ";" : "") == EOF) + return (1); + } + } + if (putc('\n', fp) == EOF) + return (1); + return (0); +} + +int +dogetauthattr(const char **list) +{ + authattr_t *pauth; + int rc = EXC_SUCCESS; + + if (list == NULL || *list == NULL) { + setauthattr(); + while ((pauth = getauthattr()) != NULL) + (void) putauthattr(pauth, stdout); + endauthattr(); + } else { + for (; *list != NULL; list++) { + pauth = getauthnam(*list); + if (pauth == NULL) + rc = EXC_NAME_NOT_FOUND; + else + (void) putauthattr(pauth, stdout); + } + } + + return (rc); +} diff --git a/usr/src/cmd/getent/dogetexecattr.c b/usr/src/cmd/getent/dogetexecattr.c new file mode 100644 index 0000000000..15c83c45c8 --- /dev/null +++ b/usr/src/cmd/getent/dogetexecattr.c @@ -0,0 +1,93 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright (c) 2018 Peter Tribble. + * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#include <stdio.h> +#include <stdlib.h> +#include <exec_attr.h> +#include "getent.h" + +static int +putexecattr(const execattr_t *exec, FILE *fp) +{ + int i; + kva_t *attrs; + kv_t *data; + + if (exec == NULL) + return (1); + + if (fprintf(fp, "%s:%s:%s:%s:%s:%s:", + exec->name != NULL ? exec->name : "", + exec->policy != NULL ? exec->policy : "", + exec->type != NULL ? exec->type : "", + exec->res1 != NULL ? exec->res1 : "", + exec->res2 != NULL ? exec->res2 : "", + exec->id != NULL ? exec->id : "") == EOF) + return (1); + attrs = exec->attr; + if (attrs != NULL) { + data = attrs->data; + for (i = 0; i < attrs->length; i++) { + if (fprintf(fp, "%s=%s%s", + data[i].key != NULL ? data[i].key : "", + data[i].value != NULL ? data[i].value : "", + i < (attrs->length)-1 ? ";" : "") == EOF) + return (1); + } + } + if (putc('\n', fp) == EOF) + return (1); + return (0); +} + +int +dogetexecattr(const char **list) +{ + execattr_t *pexec; + int rc = EXC_SUCCESS; + + if (list == NULL || *list == NULL) { + setexecattr(); + while ((pexec = getexecattr()) != NULL) + (void) putexecattr(pexec, stdout); + endexecattr(); + } else { + for (; *list != NULL; list++) { + pexec = getexecprof(*list, NULL, NULL, GET_ALL); + if (pexec == NULL) { + rc = EXC_NAME_NOT_FOUND; + } else { + for (; pexec != NULL; pexec = pexec->next) { + (void) putexecattr(pexec, stdout); + } + + } + } + } + + return (rc); +} diff --git a/usr/src/cmd/getent/dogetprofattr.c b/usr/src/cmd/getent/dogetprofattr.c new file mode 100644 index 0000000000..20bfbf7fe0 --- /dev/null +++ b/usr/src/cmd/getent/dogetprofattr.c @@ -0,0 +1,87 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright (c) 2018 Peter Tribble. + * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#include <stdio.h> +#include <stdlib.h> +#include <prof_attr.h> +#include "getent.h" + +static int +putprofattr(const profattr_t *prof, FILE *fp) +{ + int i; + kva_t *attrs; + kv_t *data; + + if (prof == NULL) + return (1); + + if (fprintf(fp, "%s:%s:%s:%s:", + prof->name != NULL ? prof->name : "", + prof->res1 != NULL ? prof->res1 : "", + prof->res2 != NULL ? prof->res2 : "", + prof->desc != NULL ? prof->desc : "") == EOF) + return (1); + attrs = prof->attr; + if (attrs != NULL) { + data = attrs->data; + for (i = 0; i < attrs->length; i++) { + if (fprintf(fp, "%s=%s%s", + data[i].key != NULL ? data[i].key : "", + data[i].value != NULL ? data[i].value : "", + i < (attrs->length)-1 ? ";" : "") == EOF) + return (1); + } + } + if (putc('\n', fp) == EOF) + return (1); + return (0); +} + +int +dogetprofattr(const char **list) +{ + profattr_t *pprof; + int rc = EXC_SUCCESS; + + if (list == NULL || *list == NULL) { + setprofattr(); + while ((pprof = getprofattr()) != NULL) + (void) putprofattr(pprof, stdout); + endprofattr(); + } else { + for (; *list != NULL; list++) { + pprof = getprofnam(*list); + if (pprof == NULL) + rc = EXC_NAME_NOT_FOUND; + else + (void) putprofattr(pprof, stdout); + } + } + + return (rc); +} diff --git a/usr/src/cmd/getent/dogetuserattr.c b/usr/src/cmd/getent/dogetuserattr.c new file mode 100644 index 0000000000..8d508f942e --- /dev/null +++ b/usr/src/cmd/getent/dogetuserattr.c @@ -0,0 +1,101 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright (c) 2018 Peter Tribble. + * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#include <stdio.h> +#include <pwd.h> +#include <stdlib.h> +#include <errno.h> +#include <user_attr.h> +#include "getent.h" + +static int +putuserattr(const userattr_t *user, FILE *fp) +{ + int i; + kva_t *attrs; + kv_t *data; + + if (user == NULL) + return (1); + + if (fprintf(fp, "%s:%s:%s:%s:", + user->name != NULL ? user->name : "", + user->qualifier != NULL ? user->res1 : "", + user->res1 != NULL ? user->res1 : "", + user->res2 != NULL ? user->res2 : "") == EOF) + return (1); + attrs = user->attr; + if (attrs != NULL) { + data = attrs->data; + for (i = 0; i < attrs->length; i++) { + if (fprintf(fp, "%s=%s%s", + data[i].key != NULL ? data[i].key : "", + data[i].value != NULL ? data[i].value : "", + i < (attrs->length)-1 ? ";" : "") == EOF) + return (1); + } + } + if (putc('\n', fp) == EOF) + return (1); + return (0); +} + +int +dogetuserattr(const char **list) +{ + struct passwd *pwp; + userattr_t *puser; + int rc = EXC_SUCCESS; + char *ptr; + uid_t uid; + + if (list == NULL || *list == NULL) { + setuserattr(); + while ((puser = getuserattr()) != NULL) + (void) putuserattr(puser, stdout); + enduserattr(); + } else { + for (; *list != NULL; list++) { + uid = strtoul(*list, &ptr, 10); + if (*ptr == '\0' && errno == 0) { + if ((pwp = getpwuid(uid)) == NULL) { + puser = getusernam(*list); + } else { + puser = getusernam(pwp->pw_name); + } + } else { + puser = getusernam(*list); + } + if (puser == NULL) + rc = EXC_NAME_NOT_FOUND; + else + (void) putuserattr(puser, stdout); + } + } + + return (rc); +} diff --git a/usr/src/cmd/getent/getent.c b/usr/src/cmd/getent/getent.c index 799568764e..782034d956 100644 --- a/usr/src/cmd/getent/getent.c +++ b/usr/src/cmd/getent/getent.c @@ -20,6 +20,7 @@ * CDDL HEADER END */ /* + * Copyright (c) 2018 Peter Tribble. * Copyright (c) 2014 Gary Mills * Copyright 2005 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. @@ -51,6 +52,10 @@ static struct table t[] = { { "networks", dogetnet }, { "netmasks", dogetnetmask }, { "project", dogetproject }, + { "auth_attr", dogetauthattr }, + { "exec_attr", dogetexecattr }, + { "prof_attr", dogetprofattr }, + { "user_attr", dogetuserattr }, { NULL, NULL } }; diff --git a/usr/src/cmd/getent/getent.h b/usr/src/cmd/getent/getent.h index 049a2536c3..99b5cac075 100644 --- a/usr/src/cmd/getent/getent.h +++ b/usr/src/cmd/getent/getent.h @@ -20,6 +20,7 @@ * CDDL HEADER END */ /* + * Copyright (c) 2018 Peter Tribble. * Copyright (c) 2014 Gary Mills * Copyright 2004 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. @@ -51,6 +52,10 @@ extern int dogetproto(const char **); extern int dogetethers(const char **); extern int dogetnetmask(const char **); extern int dogetproject(const char **); +extern int dogetauthattr(const char **); +extern int dogetexecattr(const char **); +extern int dogetprofattr(const char **); +extern int dogetuserattr(const char **); #ifdef __cplusplus } diff --git a/usr/src/head/iso/stddef_iso.h b/usr/src/head/iso/stddef_iso.h index 32b34c7be3..f42c1041d8 100644 --- a/usr/src/head/iso/stddef_iso.h +++ b/usr/src/head/iso/stddef_iso.h @@ -89,6 +89,19 @@ typedef _MAX_ALIGNMENT_TYPE max_align_t; #endif /* !_STRICT_SYMBOLS || _STDC_C11 */ #endif /* _MAX_ALIGN_T */ +#if __EXT1_VISIBLE +/* ISO/IEC 9899:2011 K.3.3.2 */ +#ifndef _RSIZE_T_DEFINED +#define _RSIZE_T_DEFINED +typedef size_t rsize_t; +#endif +/* ISO/IEC 9899:2011 K.3.2.2 */ +#ifndef _ERRNO_T_DEFINED +#define _ERRNO_T_DEFINED +typedef int errno_t; +#endif +#endif /* __EXT1_VISIBLE */ + #ifdef __cplusplus } #endif diff --git a/usr/src/head/iso/stdlib_c11.h b/usr/src/head/iso/stdlib_c11.h index b02ef2d884..5648ca4083 100644 --- a/usr/src/head/iso/stdlib_c11.h +++ b/usr/src/head/iso/stdlib_c11.h @@ -65,6 +65,26 @@ extern int at_quick_exit(void (*)(void)); extern _NORETURN_KYWD void quick_exit(int); #endif /* !_STRICT_SYMBOLS || _STDC_C11 || __cplusplus >= 201103L */ +#if __EXT1_VISIBLE + +#ifndef _ERRNO_T_DEFINED +#define _ERRNO_T_DEFINED +typedef int errno_t; +#endif + +/* K.3.6 */ +typedef void (*constraint_handler_t)(const char *_RESTRICT_KYWD, + void *_RESTRICT_KYWD, errno_t); +/* K.3.6.1.1 */ +extern constraint_handler_t set_constraint_handler_s(constraint_handler_t); +/* K.3.6.1.2 */ +extern _NORETURN_KYWD void abort_handler_s(const char *_RESTRICT_KYWD, + void *_RESTRICT_KYWD, errno_t); +/* K3.6.1.3 */ +extern void ignore_handler_s(const char *_RESTRICT_KYWD, void *_RESTRICT_KYWD, + errno_t); +#endif /* __EXT1_VISIBLE */ + #if __cplusplus >= 199711L } #endif diff --git a/usr/src/head/iso/string_iso.h b/usr/src/head/iso/string_iso.h index 38878e30e2..d493e13008 100644 --- a/usr/src/head/iso/string_iso.h +++ b/usr/src/head/iso/string_iso.h @@ -143,6 +143,22 @@ extern char *strrchr(const char *, int); extern char *strstr(const char *, const char *); #endif /* __cplusplus >= 199711L */ +#if __EXT1_VISIBLE + +#ifndef _RSIZE_T_DEFINED +#define _RSIZE_T_DEFINED +typedef size_t rsize_t; +#endif + +#ifndef _ERRNO_T_DEFINED +#define _ERRNO_T_DEFINED +typedef int errno_t; +#endif + +/* ISO/IEC 9899:2011 K.3.7.4.1.1 */ +extern errno_t memset_s(void *, rsize_t, int, rsize_t); +#endif /* __EXT1_VISIBLE */ + #if __cplusplus >= 199711L } #endif /* end of namespace std */ diff --git a/usr/src/head/stdint.h b/usr/src/head/stdint.h index 135d0bc2fb..cb1bc88510 100644 --- a/usr/src/head/stdint.h +++ b/usr/src/head/stdint.h @@ -35,4 +35,11 @@ #include <sys/stdint.h> +#if __EXT1_VISIBLE +/* ISO/IEC 9899:2011 K.3.4.4 */ +#ifndef RSIZE_MAX +#define RSIZE_MAX (SIZE_MAX >> 1) +#endif +#endif /* __EXT1_VISIBLE */ + #endif /* _STDINT_H */ diff --git a/usr/src/lib/libc/amd64/Makefile b/usr/src/lib/libc/amd64/Makefile index 550ece08fd..9b57d2517e 100644 --- a/usr/src/lib/libc/amd64/Makefile +++ b/usr/src/lib/libc/amd64/Makefile @@ -467,6 +467,7 @@ PORTGEN= \ malloc.o \ memalign.o \ memmem.o \ + memset_s.o \ mkdev.o \ mkdtemp.o \ mkfifo.o \ @@ -524,6 +525,7 @@ PORTGEN= \ scandir.o \ seekdir.o \ select.o \ + set_constraint_handler_s.o \ setlabel.o \ setpriority.o \ settimeofday.o \ diff --git a/usr/src/lib/libc/i386/Makefile.com b/usr/src/lib/libc/i386/Makefile.com index 255622629c..dd647b2811 100644 --- a/usr/src/lib/libc/i386/Makefile.com +++ b/usr/src/lib/libc/i386/Makefile.com @@ -504,6 +504,7 @@ PORTGEN= \ malloc.o \ memalign.o \ memmem.o \ + memset_s.o \ mkdev.o \ mkdtemp.o \ mkfifo.o \ @@ -561,6 +562,7 @@ PORTGEN= \ scandir.o \ seekdir.o \ select.o \ + set_constraint_handler_s.o \ setlabel.o \ setpriority.o \ settimeofday.o \ diff --git a/usr/src/lib/libc/inc/libc.h b/usr/src/lib/libc/inc/libc.h index 86d894b3de..3d440ab2e2 100644 --- a/usr/src/lib/libc/inc/libc.h +++ b/usr/src/lib/libc/inc/libc.h @@ -316,6 +316,16 @@ extern wint_t __ungetwc_xpg5(wint_t, FILE *); */ extern char *current_locale(locale_t, int); +/* + * defined in set_constraint_handler_s.c. + */ +extern void __throw_constraint_handler_s(const char *_RESTRICT_KYWD, int); + +/* + * defined in assfail.c. + */ +extern void common_panic(const char *, const char *); + #ifdef __cplusplus } #endif diff --git a/usr/src/lib/libc/port/gen/memset_s.c b/usr/src/lib/libc/port/gen/memset_s.c new file mode 100644 index 0000000000..9f3fcf8ec0 --- /dev/null +++ b/usr/src/lib/libc/port/gen/memset_s.c @@ -0,0 +1,76 @@ +/* + * Copyright (c) 2017 Juniper Networks. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * Copyright 2018 Nexenta Systems, Inc. + */ + +#include "lint.h" + +#include <errno.h> +#include <stddef.h> +#include <stdint.h> +#include <string.h> + +#include "libc.h" + +/* __memset_vp is a volatile pointer to memset() function */ +static void *(*const volatile __memset_vp)(void *, int, size_t) = (memset); + +/* ISO/IEC 9899:2011 K.3.7.4.1 */ +errno_t +memset_s(void *s, rsize_t smax, int c, rsize_t n) +{ + errno_t ret; + rsize_t lim; + unsigned char v; + + ret = EINVAL; + lim = n < smax ? n : smax; + v = (unsigned char)c; + if (s == NULL) { + __throw_constraint_handler_s("memset_s: s is NULL", ret); + } else if (smax > RSIZE_MAX) { + __throw_constraint_handler_s("memset_s: smax > RSIZE_MAX", + ret); + } else { + /* + * Both s and smax are valid, fill the memory buffer using + * memset() called through a volatile pointer to guarantee + * it will not be optimized away. + */ + (*__memset_vp)(s, v, lim); + + if (n > RSIZE_MAX) { + __throw_constraint_handler_s("memset_s: n > RSIZE_MAX", + ret); + } else if (n > smax) { + __throw_constraint_handler_s("memset_s: n > smax", ret); + } else { + ret = 0; + } + } + return (ret); +} diff --git a/usr/src/lib/libc/port/gen/set_constraint_handler_s.c b/usr/src/lib/libc/port/gen/set_constraint_handler_s.c new file mode 100644 index 0000000000..3466b8a1d0 --- /dev/null +++ b/usr/src/lib/libc/port/gen/set_constraint_handler_s.c @@ -0,0 +1,107 @@ +/* + * Copyright (c) 2017 Juniper Networks. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * Copyright 2018 Nexenta Systems, Inc. + */ + +#include "lint.h" + +#include <sys/types.h> +#include <errno.h> +#include <stddef.h> +#include <stdlib.h> +#include <string.h> +#include <synch.h> +#include <thread.h> +#include <unistd.h> + +#include "libc.h" + +/* + * Rationale recommends allocating new memory each time. + */ +static constraint_handler_t *_ch = NULL; +static mutex_t ch_lock = ERRORCHECKMUTEX; + +constraint_handler_t +set_constraint_handler_s(constraint_handler_t handler) +{ + constraint_handler_t *new, *old, ret; + + new = malloc(sizeof (constraint_handler_t)); + if (new == NULL) + return (NULL); + *new = handler; + mutex_enter(&ch_lock); + old = _ch; + _ch = new; + mutex_exit(&ch_lock); + if (old == NULL) { + ret = NULL; + } else { + ret = *old; + free(old); + } + return (ret); +} + +/*ARGSUSED*/ +void +abort_handler_s(const char *_RESTRICT_KYWD msg, + void *_RESTRICT_KYWD ptr, errno_t error) +{ + common_panic("abort_handler_s: ", msg); +} + +/*ARGSUSED*/ +void +ignore_handler_s(const char *_RESTRICT_KYWD msg, + void *_RESTRICT_KYWD ptr, errno_t error) +{ +} + +void +__throw_constraint_handler_s(const char *_RESTRICT_KYWD msg, errno_t error) +{ + constraint_handler_t ch; + + mutex_enter(&ch_lock); + ch = (_ch != NULL) ? *_ch : NULL; + mutex_exit(&ch_lock); + if (ch != NULL) { + ch(msg, NULL, error); + } else { + /* + * If current handler is NULL (there were no calls to + * set_constraint_handler_s(), or it was called with NULL + * pointer handler argument), call default constraint handler + * per K.3.6.1.1 points 4 and 5. + * + * This implementation defines abort_handler_s() as default. + */ + abort_handler_s(msg, NULL, error); + } +} diff --git a/usr/src/lib/libc/port/mapfile-vers b/usr/src/lib/libc/port/mapfile-vers index d184c2e68c..812c0c94d5 100644 --- a/usr/src/lib/libc/port/mapfile-vers +++ b/usr/src/lib/libc/port/mapfile-vers @@ -77,6 +77,14 @@ $if _x86 && _ELF64 $add amd64 $endif +SYMBOL_VERSION ILLUMOS_0.27 { # memset_s(3C) and set_constraint_handler_s(3C) + protected: + abort_handler_s; + ignore_handler_s; + memset_s; + set_constraint_handler_s; +} ILLUMOS_0.26; + SYMBOL_VERSION ILLUMOS_0.26 { # fts(3) LFS $if lf64 protected: diff --git a/usr/src/lib/libc/port/threads/assfail.c b/usr/src/lib/libc/port/threads/assfail.c index b40e6dc029..1c032d8ea7 100644 --- a/usr/src/lib/libc/port/threads/assfail.c +++ b/usr/src/lib/libc/port/threads/assfail.c @@ -95,7 +95,7 @@ Abort(const char *msg) * Write a panic message w/o grabbing any locks other than assert_lock. * We have no idea what locks are held at this point. */ -static void +void common_panic(const char *head, const char *why) { char msg[400]; /* no panic() message in the library is this long */ diff --git a/usr/src/lib/libc/sparc/Makefile.com b/usr/src/lib/libc/sparc/Makefile.com index cf62c4d6d4..20a4e0fd4e 100644 --- a/usr/src/lib/libc/sparc/Makefile.com +++ b/usr/src/lib/libc/sparc/Makefile.com @@ -530,6 +530,7 @@ PORTGEN= \ malloc.o \ memalign.o \ memmem.o \ + memset_s.o \ mkdev.o \ mkdtemp.o \ mkfifo.o \ @@ -587,6 +588,7 @@ PORTGEN= \ scandir.o \ seekdir.o \ select.o \ + set_constraint_handler_s.o \ setlabel.o \ setpriority.o \ settimeofday.o \ diff --git a/usr/src/lib/libc/sparcv9/Makefile.com b/usr/src/lib/libc/sparcv9/Makefile.com index 14b5711beb..8e8fc96f16 100644 --- a/usr/src/lib/libc/sparcv9/Makefile.com +++ b/usr/src/lib/libc/sparcv9/Makefile.com @@ -487,6 +487,7 @@ PORTGEN= \ malloc.o \ memalign.o \ memmem.o \ + memset_s.o \ mkdev.o \ mkdtemp.o \ mkfifo.o \ @@ -544,6 +545,7 @@ PORTGEN= \ scandir.o \ seekdir.o \ select.o \ + set_constraint_handler_s.o \ setlabel.o \ setpriority.o \ settimeofday.o \ diff --git a/usr/src/man/man1m/getent.1m b/usr/src/man/man1m/getent.1m index 2916b821fa..af87eb677b 100644 --- a/usr/src/man/man1m/getent.1m +++ b/usr/src/man/man1m/getent.1m @@ -1,243 +1,275 @@ -'\" te -.\" Copyright (c) 2014 Gary Mills +.\" +.\" The contents of this file are subject to the terms of the +.\" Common Development and Distribution License (the "License"). +.\" You may not use this file except in compliance with the License. +.\" +.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +.\" or http://www.opensolaris.org/os/licensing. +.\" See the License for the specific language governing permissions +.\" and limitations under the License. +.\" +.\" When distributing Covered Code, include this CDDL HEADER in each +.\" file and include the License file at usr/src/OPENSOLARIS.LICENSE. +.\" If applicable, add the following below this CDDL HEADER, with the +.\" fields enclosed by brackets "[]" replaced with your own identifying +.\" information: Portions Copyright [yyyy] [name of copyright owner] +.\" +.\" .\" Copyright (C) 1999, Sun Microsystems, Inc. All Rights Reserved -.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. -.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License. -.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] -.TH GETENT 1M "Mar 14, 2014" -.SH NAME -getent \- get entries from administrative database -.SH SYNOPSIS -.LP -.nf -\fBgetent\fR \fIdatabase\fR [\fIkey\fR]... -.fi - -.SH DESCRIPTION -.sp -.LP -\fBgetent\fR gets a list of entries from the administrative database specified -by \fIdatabase\fR. The information generally comes from one or more of the -sources that are specified for the \fIdatabase\fR in \fB/etc/nsswitch.conf\fR. -.sp -.LP -\fIdatabase\fR is the name of the database to be examined. This can be -\fBpasswd\fR, \fBshadow\fR, \fBgroup\fR, \fBhosts\fR, \fBipnodes\fR, \fBservices\fR, -\fBprotocols\fR, \fBethers\fR, \fBproject\fR, \fBnetworks\fR, or -\fBnetmasks\fR. For each of these databases, \fBgetent\fR uses the appropriate -library routines described in \fBgetpwnam\fR(3C), \fBgetspnam\fR(3C), \fBgetgrnam\fR(3C), -\fBgethostbyaddr\fR(3NSL), \fBgethostbyname\fR(3NSL), -\fBgetipnodebyaddr\fR(3SOCKET), \fBgetipnodebyname\fR(3SOCKET), -\fBgetservbyname\fR(3SOCKET), \fBgetprotobyname\fR(3SOCKET), -\fBethers\fR(3SOCKET), \fBgetprojbyname\fR(3PROJECT) and -\fBgetnetbyname\fR(3SOCKET), respectively. -.sp -.LP -Each \fIkey\fR must be in a format appropriate for searching on the respective -database. For example, it can be a \fIusername\fR or \fInumeric-uid\fR for -\fBpasswd\fR; \fIhostname\fR or \fIIP\fR \fIaddress\fR for \fBhosts\fR; or -\fIservice\fR, \fIservice/protocol\fR, \fIport\fR, or \fIport/proto\fR for -\fBservices\fR. -.sp -.LP -\fBgetent\fR prints out the database entries that match each of the supplied -keys, one per line, in the format of the matching administrative file: -\fBpasswd\fR(4), \fBshadow\fR(4), \fBgroup\fR(4), \fBproject\fR(4), \fBhosts\fR(4), -\fBservices\fR(4), \fBprotocols\fR(4), \fBethers\fR(3SOCKET), -\fBnetworks\fR(4), or \fBnetmasks\fR(4). If no key is given, all entries -returned by the corresponding enumeration library routine, for example, -\fBgetpwent()\fR or \fBgethostent()\fR, are printed. Enumeration is not -supported on \fBipnodes\fR. -.SS "Key Interpretation for \fBpasswd\fR and \fBgroup\fR Databases" -.sp -.LP -When \fBgetent\fR is invoked with database set to \fBpasswd\fR, each key value -is processed as follows: -.RS +4 -.TP -.ie t \(bu -.el o -If the key value consists only of numeric characters, \fBgetent\fR assumes that -the key value is a numeric user ID and searches the user database for a -matching user ID. -.RE -.RS +4 -.TP -.ie t \(bu -.el o -If the user ID is not found in the user database or if the key value contains -any non-numeric characters, \fBgetent\fR assumes the key value is a user name -and searches the user database for a matching user name. -.RE -.sp -.LP -Similarly, when \fBgetent\fR is invoked with database set to \fBgroup\fR, each -key value is processed as follows: -.RS +4 -.TP -.ie t \(bu -.el o -If the key value consists only of numeric characters, \fBgetent\fR assumes that -the key value is a numeric group ID and searches the group database for a -matching group ID. -.RE -.RS +4 -.TP -.ie t \(bu -.el o -If the group ID is not found in the \fBgroup\fR database or if the key value -contains any non-numeric characters, \fBgetent\fR assumes the key value is a -group name and searches the \fBgroup\fR database for a matching group name. -.RE -.SH EXIT STATUS -.sp -.LP -The following exit values are returned: -.sp -.ne 2 -.na -\fB\fB0\fR\fR -.ad -.RS 5n -Successful completion. -.RE - -.sp -.ne 2 -.na -\fB\fB1\fR\fR -.ad -.RS 5n -Command syntax was incorrect, an invalid option was used, or an internal error -occurred. -.RE - -.sp -.ne 2 -.na -\fB\fB2\fR\fR -.ad -.RS 5n -At least one of the specified entry names was not found in the database. -.RE - -.sp -.ne 2 -.na -\fB\fB3\fR\fR -.ad -.RS 5n -There is no support for enumeration on this database. -.RE - -.SH FILES -.sp -.ne 2 -.na -\fB\fB/etc/nsswitch.conf\fR\fR -.ad -.RS 22n +.\" Copyright (c) 2014 Gary Mills +.\" Copyright (c) 2018 Peter Tribble +.\" +.Dd August 13, 2018 +.Dt GETENT 1M +.Os +.Sh NAME +.Nm getent +.Nd get entries from administrative database +.Sh SYNOPSIS +.Nm +.Ar database +.Oo Ar key Oc Ns ... +.Sh DESCRIPTION +.Nm +gets a list of entries from the administrative database specified by +.Ar database . +The information generally comes from one or more of the sources that are +specified for the +.Ar database +in +.Pa /etc/nsswitch.conf . +.Pp +.Ar database +is the name of the database to be examined. +This can be +.Cm passwd , +.Cm shadow , +.Cm group , +.Cm hosts , +.Cm ipnodes , +.Cm services , +.Cm protocols , +.Cm ethers , +.Cm project , +.Cm networks , +.Cm netmasks , +.Cm auth_attr , +.Cm exec_attr , +.Cm prof_attr , +or +.Cm user_attr . +For each of these databases, +.Nm +uses the appropriate library routines described in +.Xr getpwnam 3C , +.Xr getspnam 3C , +.Xr getgrnam 3C , +.Xr gethostbyaddr 3NSL , +.Xr gethostbyname 3NSL , +.Xr getipnodebyaddr 3SOCKET , +.Xr getipnodebyname 3SOCKET , +.Xr getservbyname 3SOCKET , +.Xr getprotobyname 3SOCKET , +.Xr ethers 3SOCKET , +.Xr getprojbyname 3PROJECT , +.Xr getnetbyname 3SOCKET , +.Xr getauthattr 3SECDB , +.Xr getexecattr 3SECDB , +.Xr getprofattr 3SECDB , +and +.Xr getuserattr 3SECDB +respectively. +.Pp +Each +.Ar key +must be in a format appropriate for searching on the respective database. +For example, it can be a username or numeric-uid for +.Cm passwd ; +hostname or IP address for +.Cm hosts ; +or service, service/protocol, port, or port/proto for +.Cm services . +.Pp +.Nm +prints out the database entries that match each of the supplied keys, one per +line, in the format of the matching administrative file: +.Xr passwd 4 , +.Xr shadow 4 , +.Xr group 4 , +.Xr project 4 , +.Xr hosts 4 , +.Xr services 4 , +.Xr protocols 4 , +.Xr ethers 4 , +.Xr networks 4 , +.Xr netmasks 4 , +.Xr auth_attr 4 , +.Xr exec_attr 4 , +.Xr prof_attr 4 , +or +.Xr user_attr 4 . +If no key is given, all entries returned by the corresponding enumeration +library routine, for example, +.Xr getpwent 3C +or +.Xr gethostent 3NSL , +are printed. +Enumeration is not supported on +.Cm ipnodes , +.Cm ethers , +or +.Cm netmasks . +.Ss Key Interpretation for passwd, group, and user_attr Databases +When +.Nm +is invoked with +.Ar database +set to +.Cm passwd , +each key value is processed as follows: +.Bl -bullet +.It +If the key value consists only of numeric characters, +.Nm +assumes that the key value is a numeric user ID and searches the +.Cm passwd +database for a matching user ID. +.It +If the user ID is not found in the +.Cm passwd +database or if the key value contains any non-numeric characters, +.Nm +assumes the key value is a user name and searches the +.Cm passwd +database for a matching user name. +.El +.Pp +When +.Nm +is invoked with +.Ar database +set to +.Cm group , +each key value is processed as follows: +.Bl -bullet +.It +If the key value consists only of numeric characters, +.Nm +assumes that the key value is a numeric group ID and searches the +.Cm group +database for a matching group ID. +.It +If the group ID is not found in the +.Cm group +database or if the key value contains any non-numeric characters, +.Nm +assumes the key value is a group name and searches the +.Cm group +database for a matching group name. +.El +.Pp +When +.Nm +is invoked with +.Ar database +set to +.Cm user_attr , +each key value is processed as follows: +.Bl -bullet +.It +If the key value consists only of numeric characters, +.Nm +assumes that the key value is a numeric user ID and searches the +.Cm passwd +database for a matching user name, which is then used as the key for +.Cm user_attr . +.It +If the user ID is not found in the +.Cm passwd +database or if the key value contains any non-numeric characters, +.Nm +assumes the key value is a user name and searches the +.Cm user_attr +database for a matching entry. +.El +.Sh FILES +.Bl -tag -width Pa +.It Pa /etc/nsswitch.conf name service switch configuration file -.RE - -.sp -.ne 2 -.na -\fB\fB/etc/passwd\fR\fR -.ad -.RS 22n +.It Pa /etc/passwd password file -.RE - -.sp -.ne 2 -.na -\fB\fB/etc/shadow\fR\fR -.ad -.RS 22n +.It Pa /etc/shadow shadowed password file -.RE - -.sp -.ne 2 -.na -\fB\fB/etc/group\fR\fR -.ad -.RS 22n +.It Pa /etc/group group file -.RE - -.sp -.ne 2 -.na -\fB\fB/etc/inet/hosts\fR\fR -.ad -.RS 22n +.It Pa /etc/inet/hosts IPv4 and IPv6 host name database -.RE - -.sp -.ne 2 -.na -\fB\fB/etc/services\fR\fR -.ad -.RS 22n +.It Pa /etc/services Internet services and aliases -.RE - -.sp -.ne 2 -.na -\fB\fB/etc/project\fR\fR -.ad -.RS 22n +.It Pa /etc/project project file -.RE - -.sp -.ne 2 -.na -\fB\fB/etc/protocols\fR\fR -.ad -.RS 22n +.It Pa /etc/protocols protocol name database -.RE - -.sp -.ne 2 -.na -\fB\fB/etc/ethers\fR\fR -.ad -.RS 22n +.It Pa /etc/ethers Ethernet address to hostname database or domain -.RE - -.sp -.ne 2 -.na -\fB\fB/etc/networks\fR\fR -.ad -.RS 22n +.It Pa /etc/networks network name database -.RE - -.sp -.ne 2 -.na -\fB\fB/etc/netmasks\fR\fR -.ad -.RS 22n +.It Pa /etc/netmasks network mask database -.RE - -.SH SEE ALSO -.sp -.LP -\fBethers\fR(3SOCKET), \fBgetgrnam\fR(3C), \fBgethostbyaddr\fR(3NSL), -\fBgethostbyname\fR(3NSL), \fBgethostent\fR(3NSL), -\fBgetipnodebyaddr\fR(3SOCKET), \fBgetipnodebyname\fR(3SOCKET), -\fBgetnetbyname\fR(3SOCKET), \fBgetprojbyname\fR(3PROJECT), -\fBgetprotobyname\fR(3SOCKET), \fBgetpwnam\fR(3C), -\fBgetservbyname\fR(3SOCKET), \fBgroup\fR(4), \fBhosts\fR(4), -\fBnetmasks\fR(4), \fBnetworks\fR(4), \fBnsswitch.conf\fR(4), \fBpasswd\fR(4), -\fBproject\fR(4), \fBprotocols\fR(4), \fBservices\fR(4), \fBattributes\fR(5) +.It Pa /etc/user_attr +extended user attributes database +.It Pa /etc/security/auth_attr +authorization description database +.It Pa /etc/security/exec_attr +execution profiles database +.It Pa /etc/security/prof_attr +profile description database +.El +.Sh EXIT STATUS +The following exit values are returned: +.Pp +.Bl -tag -width Ds -compact +.It Sy 0 +Successful completion. +.It Sy 1 +Command syntax was incorrect, an invalid option was used, or an internal error +occurred. +.It Sy 2 +At least one of the specified entry names was not found in the database. +.It Sy 3 +There is no support for enumeration on this database. +.El +.Sh SEE ALSO +.Xr getgrnam 3C , +.Xr getpwnam 3C , +.Xr getspnam 3C , +.Xr gethostbyaddr 3NSL , +.Xr gethostbyname 3NSL , +.Xr gethostent 3NSL , +.Xr getprojbyname 3PROJECT , +.Xr getauthattr 3SECDB , +.Xr getexecattr 3SECDB , +.Xr getprofattr 3SECDB , +.Xr getuserattr 3SECDB , +.Xr ethers 3SOCKET , +.Xr getipnodebyaddr 3SOCKET , +.Xr getipnodebyname 3SOCKET , +.Xr getnetbyname 3SOCKET , +.Xr getprotobyname 3SOCKET , +.Xr getservbyname 3SOCKET , +.Xr auth_attr 4 , +.Xr ethers 4 , +.Xr exec_attr 4 , +.Xr group 4 , +.Xr hosts 4 , +.Xr netmasks 4 , +.Xr networks 4 , +.Xr nsswitch.conf 4 , +.Xr passwd 4 , +.Xr prof_attr 4 , +.Xr project 4 , +.Xr protocols 4 , +.Xr services 4 , +.Xr shadow 4 , +.Xr user_attr 4 , +.Xr attributes 5 diff --git a/usr/src/man/man3c/Makefile b/usr/src/man/man3c/Makefile index 295eb6ffa5..a64bda079a 100644 --- a/usr/src/man/man3c/Makefile +++ b/usr/src/man/man3c/Makefile @@ -244,6 +244,7 @@ MANFILES= __fbufsize.3c \ mbtowc.3c \ membar_ops.3c \ memory.3c \ + memset_s.3c \ mkfifo.3c \ mkstemp.3c \ mktemp.3c \ @@ -413,6 +414,7 @@ MANFILES= __fbufsize.3c \ sem_unlink.3c \ sem_wait.3c \ semaphore.3c \ + set_constraint_handler_s.3c \ setbuf.3c \ setbuffer.3c \ setcat.3c \ @@ -562,7 +564,7 @@ MANFILES= __fbufsize.3c \ wordexp.3c \ wsprintf.3c \ wsscanf.3c \ - wstring.3c \ + wstring.3c MANLINKS= FD_CLR.3c \ FD_ISSET.3c \ @@ -582,6 +584,7 @@ MANLINKS= FD_CLR.3c \ _exithandle.3c \ _flushlbf.3c \ _setjmp.3c \ + abort_handler_s.3c \ addrtosymstr.3c \ aiowrite.3c \ alloca.3c \ @@ -892,6 +895,7 @@ MANLINKS= FD_CLR.3c \ htonl.3c \ htonll.3c \ htons.3c \ + ignore_handler_s.3c \ inet6.3c \ inet_addr.3c \ inet_aton.3c \ @@ -2284,6 +2288,9 @@ sema_post.3c := LINKSRC = semaphore.3c sema_trywait.3c := LINKSRC = semaphore.3c sema_wait.3c := LINKSRC = semaphore.3c +abort_handler_s.3c := LINKSRC = set_constraint_handler_s.3c +ignore_handler_s.3c := LINKSRC = set_constraint_handler_s.3c + setvbuf.3c := LINKSRC = setbuf.3c setlinebuf.3c := LINKSRC = setbuffer.3c diff --git a/usr/src/man/man3c/memset_s.3c b/usr/src/man/man3c/memset_s.3c new file mode 100644 index 0000000000..9da92ff927 --- /dev/null +++ b/usr/src/man/man3c/memset_s.3c @@ -0,0 +1,104 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2018 Nexenta Systems, Inc. +.\" +.Dd August 12, 2017 +.Dt MEMSET_S 3C +.Os +.Sh NAME +.Nm memset_s +.Nd copy a value to all bytes of a memory buffer +.Sh LIBRARY +.Lb libc +.Sh SYNOPSIS +.Fd #define __STDC_WANT_LIB_EXT1__ 1 +.In string.h +.Ft errno_t +.Fo memset_s +.Fa "void *s" +.Fa "rsize_t smax" +.Fa "int c" +.Fa "rsize_t n" +.Fc +.Sh DESCRIPTION +The +.Fn memset_s +function copies the value of +.Fa c +.Po converted to an +.Vt unsigned char +.Pc +into each of the first +.Fa n +bytes of the memory buffer pointed to by +.Fa s . +.Pp +Unlike the +.Xr memset 3C , +.Fn memset_s +is guaranteed to never be optimized away by the compiler. +.Pp +The +.Fn memset_s +function detects the following runtime-constraint violations: +.Bl -enum +.It +.Fa s +is a +.Dv NULL +pointer. +.It +.Fa smax +or +.Fa n +is greater than +.Dv RSIZE_MAX . +.It +.Fa n +is greater than +.Fa smax +.Pq buffer overflow . +.El +.Pp +If runtime-constraint violation is detected, and if +.Fa s +and +.Fa smax +are valid, the +.Fn memset_s +function copies the value of +.Fa c +.Po converted to an +.Vt unsigned char +.Pc +into each of the first +.Fa smax +bytes of the memory buffer pointed to by +.Fa s +before calling the runtime-constraint handler. +.Sh RETURN VALUES +The +.Fn memset_s +function returns 0 if there was no runtime-constraint violation. +Otherwise, a non-zero value is returned. +.Sh INTERFACE STABILITY +.Sy Standard +.Sh MT-LEVEL +.Sy Safe +.Sh SEE ALSO +.Xr memset 3C , +.Xr set_constraint_handler 3C +.Sh STANDARDS +The +.Fn memset_s +function conforms to +.St -isoC-2011 . diff --git a/usr/src/man/man3c/set_constraint_handler_s.3c b/usr/src/man/man3c/set_constraint_handler_s.3c new file mode 100644 index 0000000000..0b2bd5a165 --- /dev/null +++ b/usr/src/man/man3c/set_constraint_handler_s.3c @@ -0,0 +1,133 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2018 Nexenta Systems, Inc. +.\" +.Dd August 12, 2017 +.Dt SET_CONSTRAINT_HANDLER_S 3C +.Os +.Sh NAME +.Nm set_constraint_handler_s , +.Nm abort_handler_s , +.Nm ignore_handler_s +.Nd runtime-constraint handling +.Sh LIBRARY +.Lb libc +.Sh SYNOPSIS +.Fd #define __STDC_WANT_LIB_EXT1__ 1 +.In stdlib.h +.Ft constraint_handler_t +.Fo set_constraint_handler_s +.Fa "constraint_handler_t handler" +.Fc +.Ft void +.Fo abort_handler_s +.Fa "const char *restrict msg" +.Fa "void *restrict ptr" +.Fa "errno_t error" +.Fc +.Ft void +.Fo ignore_handler_s +.Fa "const char *restrict msg" +.Fa "void *restrict ptr" +.Fa "errno_t error" +.Fc +.Sh DESCRIPTION +The +.Fn set_constraint_handler_s +function sets the runtime-constraint handler to be +.Fa handler . +.Pp +The runtime-constraint handler is the callback function invoked when a library +function detects a runtime-constraint violation, having the following prototype: +.Bd -literal -offset indent +void (*constraint_handler_t)(const char *restrict msg, + void *restrict ptr, errno_t error); +.Ed +.Pp +The arguments are as follows: +.Bl -tag -width "error" +.It Fa msg +A pointer to a character string describing the runtime-constraint violation. +.It Fa ptr +A +.Dv NULL +pointer. +.It Fa error +If the function calling the handler has a return type declared as +.Vt errno_t , +the return value of the function is passed. +Otherwise, a positive value of type +.Vt errno_t +is passed. +.El +.Pp +Only the most recent handler registered with +.Fn set_constraint_handler_s +is called when a runtime-constraint violation occurs. +.Pp +The implementation has a default constraint handler that is used if no calls to +the +.Fn set_constraint_handler_s +function have been made. +If the +.Fa handler +argument to +.Fn set_constraint_handler_s +is a +.Dv NULL +pointer, the default handler becomes the current constraint handler. +.Pp +The +.Fn abort_handler_s +and +.Fn ignore_handler_s +are the standard-defined runtime-constraint handlers provided by the C library. +.Pp +The +.Fn abort_handler_s +function writes the error message including the +.Fa msg +to +.Dv stderr +and calls the +.Xr abort 3C +function. +The +.Fn abort_handler_s +is currently the default runtime-constraint handler. +.Pp +The +.Fn ignore_handler_s +simply returns to its caller. +.Sh RETURN VALUES +The +.Fn set_constraint_handler_s +function returns a pointer to the previously registered handler, or +.Dv NULL +if none was previously registered. +.Pp +The +.Fn abort_handler_s +function does not return to its caller. +.Pp +The +.Fn ignore_handler_s +function returns no value. +.Sh INTERFACE STABILITY +.Sy Standard +.Sh MT-LEVEL +.Sy Safe +.Sh STANDARDS +The +.Fn set_constraint_handler_s +function conforms to +.St -isoC-2011 . diff --git a/usr/src/man/man3secdb/getauthattr.3secdb b/usr/src/man/man3secdb/getauthattr.3secdb index a671aa84e4..d4efafb78a 100644 --- a/usr/src/man/man3secdb/getauthattr.3secdb +++ b/usr/src/man/man3secdb/getauthattr.3secdb @@ -3,7 +3,7 @@ .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License. .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] -.TH GETAUTHATTR 3SECDB "Feb 20, 2009" +.TH GETAUTHATTR 3SECDB "Aug 13, 2018" .SH NAME getauthattr, getauthnam, free_authattr, setauthattr, endauthattr, chkauthattr \- get authorization entry @@ -43,7 +43,6 @@ cc [ \fIflag\fR... ] \fIfile\fR... -lsecdb -lsocket -lnsl [ \fIlibrary\fR... .fi .SH DESCRIPTION -.sp .LP The \fBgetauthattr()\fR and \fBgetauthnam()\fR functions each return an \fBauth_attr\fR(4) entry. Entries can come from any of the sources specified in @@ -95,7 +94,7 @@ any of the profiles specified in the \fBCONSOLE_USER\fR keyword, then reads the given authorization is in any profiles specified with the \fBPROFS_GRANTED\fR keyword. If a match is not found from the default authorizations and default profiles, \fBchkauthattr()\fR reads the \fBuser_attr\fR(4) database. If it does -not find a match in \fBuser_attr\fR, it reads the \fBprof_attr\fR(4) database, +not find a match in \fBuser_attr\fR, it reads the \fBprof_attr\fR(4) database, using the list of profiles assigned to the user, and checks if any of the profiles assigned to the user has the given authorization. The \fBchkauthattr()\fR function returns 0 if it does not find a match in any of @@ -109,14 +108,14 @@ following are true: .ie t \(bu .el o The authorization name matches exactly any authorization assigned in the -\fBuser_attr\fR or \fBprof_attr\fR databases (authorization names are +\fBuser_attr\fR or \fBprof_attr\fR databases (authorization names are case-sensitive). .RE .RS +4 .TP .ie t \(bu .el o -The authorization name suffix is not the key word \fBgrant\fR and the +The authorization name suffix is not the key word \fBgrant\fR and the authorization name matches any authorization up to the asterisk (*) character assigned in the \fBuser_attr\fR or \fBprof_attr\fR databases. .RE @@ -131,9 +130,8 @@ user is assigned an authorization. box; c | c | c c | c | c . - \f(CW/etc/security/policy.conf\fR or Is user -_ -\fBAuthorization name\fR \fBuser_attr\fR or \fB\fR \fBprof_attr\fR entry authorized? + \fB/etc/security/policy.conf\fR or Is user +\fBAuthorization name\fR \fBuser_attr\fR or \fBprof_attr\fR entry authorized? _ solaris.printer.postscript solaris.printer.postscript Yes solaris.printer.postscript solaris.printer.* Yes @@ -143,23 +141,21 @@ solaris.printer.grant solaris.printer.* No .sp .LP The \fBfree_authattr()\fR function releases memory allocated by the -\fBgetauthnam()\fR and \fBgetauthattr()\fR functions. +\fBgetauthnam()\fR and \fBgetauthattr()\fR functions. .SH RETURN VALUES -.sp .LP -The \fBgetauthattr()\fR function returns a pointer to an \fBauthattr_t\fR if +The \fBgetauthattr()\fR function returns a pointer to an \fBauthattr_t\fR if it successfully enumerates an entry; otherwise it returns \fINULL\fR, indicating the end of the enumeration. .sp .LP -The \fBgetauthnam()\fR function returns a pointer to an \fBauthattr_t\fR if it +The \fBgetauthnam()\fR function returns a pointer to an \fBauthattr_t\fR if it successfully locates the requested entry; otherwise it returns \fINULL\fR. .sp .LP The \fBchkauthattr()\fR function returns 1 if the user is authorized and 0 if the user does not exist or is not authorized. .SH USAGE -.sp .LP The \fBgetauthattr()\fR and \fBgetauthnam()\fR functions both allocate memory for the pointers they return. This memory should be deallocated with the @@ -169,18 +165,16 @@ for the pointers they return. This memory should be deallocated with the Individual attributes in the \fBattr\fR structure can be referred to by calling the \fBkva_match\fR(3SECDB) function. .SH WARNINGS -.sp .LP -Because the list of legal keys is likely to expand, code must be written to +Because the list of legal keys is likely to expand, code must be written to ignore unknown key-value pairs without error. .SH FILES -.sp .ne 2 .na \fB\fB/etc/nsswitch.conf\fR\fR .ad .RS 29n -configuration file lookup information for the name server switch +configuration file lookup information for the name service switch .RE .sp @@ -220,7 +214,6 @@ profile information .RE .SH ATTRIBUTES -.sp .LP See \fBattributes\fR(5) for descriptions of the following attributes: .sp @@ -236,8 +229,8 @@ MT-Level MT-Safe .TE .SH SEE ALSO -.sp .LP -\fBgetexecattr\fR(3SECDB), \fBgetprofattr\fR(3SECDB), -\fBgetuserattr\fR(3SECDB), \fBauth_attr\fR(4), \fBnsswitch.conf\fR(4), -\fBprof_attr\fR(4), \fBuser_attr\fR(4), \fBattributes\fR(5), \fBrbac\fR(5) +\fBgetexecattr\fR(3SECDB), \fBgetprofattr\fR(3SECDB), \fBgetuserattr\fR(3SECDB), +\fBkva_match\fR(3SECDB), \fBauth_attr\fR(4), \fBnsswitch.conf\fR(4), +\fBpolicy.conf\fR(4), \fBprof_attr\fR(4), \fBuser_attr\fR(4), +\fBattributes\fR(5), \fBrbac\fR(5) diff --git a/usr/src/man/man3secdb/getexecattr.3secdb b/usr/src/man/man3secdb/getexecattr.3secdb index 57cbf8cc14..6f68f50403 100644 --- a/usr/src/man/man3secdb/getexecattr.3secdb +++ b/usr/src/man/man3secdb/getexecattr.3secdb @@ -1,9 +1,10 @@ '\" te +.\" Copyright 2018 Peter Tribble .\" Copyright (c) 2005, Sun Microsystems, Inc. All Rights Reserved. .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License. .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] -.TH GETEXECATTR 3SECDB "May 27, 2014" +.TH GETEXECATTR 3SECDB "Aug 13, 2018" .SH NAME getexecattr, free_execattr, setexecattr, endexecattr, getexecuser, getexecprof, match_execattr \- get execution profile entry @@ -51,7 +52,6 @@ cc [ \fIflag\fR... ] \fIfile\fR... -lsecdb -lsocket -lnsl [ \fIlibrary\fR... .fi .SH DESCRIPTION -.sp .LP The \fBgetexecattr()\fR function returns a single \fBexec_attr\fR(4) entry. Entries can come from any of the sources specified in the @@ -60,19 +60,19 @@ Entries can come from any of the sources specified in the .LP Successive calls to \fBgetexecattr()\fR return either successive \fBexec_attr\fR entries or \fINULL\fR. Because \fBgetexecattr()\fR always -returns a single entry, the \fBnext\fR pointer in the \fBexecattr_t\fR data +returns a single entry, the \fBnext\fR pointer in the \fBexecattr_t\fR data structure points to \fINULL\fR. .sp .LP The internal representation of an \fBexec_attr\fR entry is an \fBexecattr_t\fR -structure defined in <\fBexec_attr.h\fR> with the following members: +structure defined in <\fBexec_attr.h\fR> with the following members: .sp .in +2 .nf char *name; /* name of the profile */ -char *type; /* type of profile */ char *policy; /* policy under which the attributes are */ /* relevant*/ +char *type; /* type of profile */ char *res1; /* reserved for future use */ char *res2; /* reserved for future use */ char *id; /* unique identifier */ @@ -116,7 +116,7 @@ corresponding profile entry is found in the \fBprof_attr\fR database are returned. .sp .LP -Using \fBgetexecuser()\fR and \fBgetexecprof()\fR, programmers can search for +Using \fBgetexecuser()\fR and \fBgetexecprof()\fR, programmers can search for any \fItype\fR argument, such as the manifest constant \fBKV_COMMAND\fR. The arguments are logically AND-ed together so that only entries exactly matching all of the arguments are returned. Wildcard matching applies if there is no @@ -125,7 +125,7 @@ to indicate that it is not used as part of the matching criteria. The \fB\fR search_flag controls whether the function returns the first match (\fBGET_ONE\fR), setting the \fBnext\fR pointer to \fINULL\fR or all matching entries (\fBGET_ALL\fR), using the \fBnext\fR pointer to create a linked list -of all entries that meet the search criteria. See \fBEXAMPLES\fR. +of all entries that meet the search criteria. See \fBEXAMPLES\fR. .sp .LP Once a list of entries is returned by \fBgetexecuser()\fR or @@ -138,14 +138,12 @@ criteria, only a pointer to the first entry is returned. The \fBkva_match\fR(3SECDB) function can be used to look up a key in a key-value array. .SH RETURN VALUES -.sp .LP Those functions returning data only return data related to the active policy. -The \fBgetexecattr()\fR function returns a pointer to a \fBexecattr_t\fR if it +The \fBgetexecattr()\fR function returns a pointer to a \fBexecattr_t\fR if it successfully enumerates an entry; otherwise it returns \fINULL\fR, indicating the end of the enumeration. .SH USAGE -.sp .LP The \fBgetexecattr()\fR, \fBgetexecuser()\fR, and \fBgetexecprof()\fR functions all allocate memory for the pointers they return. This memory should be @@ -158,7 +156,7 @@ Individual attributes may be referenced in the \fBattr\fR structure by calling the \fBkva_match\fR(3SECDB) function. .SH EXAMPLES .LP -\fBExample 1 \fRFind all profiles that have the \fBping\fR command. +\fBExample 1 \fRFind all profiles that have the \fBping\fR command. .sp .in +2 .nf @@ -188,7 +186,7 @@ profile. .sp .in +2 .nf -if ((execprof=getexecprof("Filesystem Security", KV_NULL, NULL, +if ((execprof=getexecprof("Filesystem Security", NULL, NULL, GET_ALL))==NULL)) { /* do error */ } @@ -200,12 +198,6 @@ if ((execprof=getexecprof("Filesystem Security", KV_NULL, NULL, wetmore. If there is no exact profile entry, the wildcard (*), if defined, is returned. .sp -.LP -The following tells if the \fBtar\fR utility is in a profile assigned to user -wetmore. If there is no exact profile entry, the wildcard (*), if defined, is -returned. - -.sp .in +2 .nf if ((execprof=getexecuser("wetmore", KV_COMMAND, "/usr/bin/tar", @@ -216,13 +208,12 @@ if ((execprof=getexecuser("wetmore", KV_COMMAND, "/usr/bin/tar", .in -2 .SH FILES -.sp .ne 2 .na \fB\fB/etc/nsswitch.conf\fR\fR .ad .RS 29n -configuration file lookup information for the name server switch +configuration file lookup information for the name service switch .RE .sp @@ -252,8 +243,16 @@ execution profiles policy definitions .RE -.SH ATTRIBUTES .sp +.ne 2 +.na +\fB\fB/etc/security/prof_attr\fR\fR +.ad +.RS 29n +profile information +.RE + +.SH ATTRIBUTES .LP See \fBattributes\fR(5) for descriptions of the following attributes: .sp @@ -269,8 +268,8 @@ MT-Level MT-Safe .TE .SH SEE ALSO -.sp .LP -\fBgetauthattr\fR(3SECDB), \fBgetuserattr\fR(3SECDB), \fBkva_match\fR(3SECDB), -\fBexec_attr\fR(4), \fBpasswd\fR(4), \fBpolicy.conf\fR(4), \fBprof_attr\fR(4), -\fBuser_attr\fR(4), \fBattributes\fR(5) +\fBgetauthattr\fR(3SECDB), \fBgetprofattr\fR(3SECDB), \fBgetuserattr\fR(3SECDB), +\fBkva_match\fR(3SECDB), \fBexec_attr\fR(4), \fBpasswd\fR(4), +\fBpolicy.conf\fR(4), \fBprof_attr\fR(4), \fBuser_attr\fR(4), +\fBattributes\fR(5) diff --git a/usr/src/man/man3secdb/getprofattr.3secdb b/usr/src/man/man3secdb/getprofattr.3secdb index c0484f8de2..fb268c602b 100644 --- a/usr/src/man/man3secdb/getprofattr.3secdb +++ b/usr/src/man/man3secdb/getprofattr.3secdb @@ -3,7 +3,7 @@ .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License. .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] -.TH GETPROFATTR 3SECDB "Mar 31, 2005" +.TH GETPROFATTR 3SECDB "Aug 13, 2018" .SH NAME getprofattr, getprofnam, free_profattr, setprofattr, endprofattr, getproflist, free_proflist \- get profile description and attributes @@ -47,7 +47,6 @@ cc [ \fIflag\fR... ] \fIfile\fR... -lsecdb -lsocket -lnsl [ \fIlibrary\fR... ] .fi .SH DESCRIPTION -.sp .LP The \fBgetprofattr()\fR and \fBgetprofnam()\fR functions each return a \fBprof_attr\fR entry. Entries can come from any of the sources specified in @@ -61,7 +60,7 @@ The \fBgetprofattr()\fR function enumerates \fBprof_attr\fR entries. The .sp .LP The internal representation of a \fBprof_attr\fR entry is a \fBprofattr_t\fR -structure defined in <\fBprof_attr.h\fR> with the following members: +structure defined in <\fBprof_attr.h\fR> with the following members: .sp .in +2 .nf @@ -81,7 +80,7 @@ The \fBfree_profattr()\fR function releases memory allocated by the .LP The \fBsetprofattr()\fR function "rewinds" to the beginning of the enumeration of \fBprof_attr\fR entries. Calls to \fBgetprofnam()\fR can leave the -enumeration in an indeterminate state. Therefore, \fBsetprofattr()\fR should +enumeration in an indeterminate state. Therefore, \fBsetprofattr()\fR should be called before the first call to \fBgetprofattr()\fR. .sp .LP @@ -102,7 +101,6 @@ The \fBfree_proflist()\fR function frees memory allocated by the \fBgetproflist()\fR function. The \fIprofcnt\fR argument specifies the number of items to free from the \fIproflist\fR argument. .SH RETURN VALUES -.sp .LP The \fBgetprofattr()\fR function returns a pointer to a \fBprofattr_t\fR if it successfully enumerates an entry; otherwise it returns \fINULL\fR, indicating @@ -112,13 +110,12 @@ the end of the enumeration. The \fBgetprofnam()\fR function returns a pointer to a \fBprofattr_t\fR if it successfully locates the requested entry; otherwise it returns \fINULL\fR. .SH USAGE -.sp .LP -Individual attributes in the \fBprof_attr_t\fR structure can be referred to by +Individual attributes in the \fBprofattr_t\fR structure can be referred to by calling the \fBkva_match\fR(3SECDB) function. .sp .LP -Because the list of legal keys is likely to expand, any code must be written +Because the list of legal keys is likely to expand, any code must be written to ignore unknown key-value pairs without error. .sp .LP @@ -126,7 +123,6 @@ The \fBgetprofattr()\fR and \fBgetprofnam()\fR functions both allocate memory for the pointers they return. This memory should be deallocated with the \fBfree_profattr()\fR function. .SH FILES -.sp .ne 2 .na \fB\fB/etc/security/prof_attr\fR\fR @@ -136,7 +132,6 @@ profiles and their descriptions .RE .SH ATTRIBUTES -.sp .LP See \fBattributes\fR(5) for descriptions of the following attributes: .sp @@ -152,7 +147,7 @@ MT-Level MT-Safe .TE .SH SEE ALSO -.sp .LP \fBauths\fR(1), \fBprofiles\fR(1), \fBgetexecattr\fR(3SECDB), -\fBgetauthattr\fR(3SECDB), \fBprof_attr\fR(4) +\fBgetauthattr\fR(3SECDB), \fBkva_match\fR(3SECDB), \fBprof_attr\fR(4), +\fBattributes\fR(5) diff --git a/usr/src/man/man3secdb/getuserattr.3secdb b/usr/src/man/man3secdb/getuserattr.3secdb index 7da2404167..72d0a899d0 100644 --- a/usr/src/man/man3secdb/getuserattr.3secdb +++ b/usr/src/man/man3secdb/getuserattr.3secdb @@ -3,7 +3,7 @@ .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License. .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] -.TH GETUSERATTR 3SECDB "Mar 31, 2005" +.TH GETUSERATTR 3SECDB "Aug 13, 2018" .SH NAME getuserattr, getusernam, getuseruid, free_userattr, setuserattr, enduserattr, fgetuserattr \- get user_attr entry @@ -47,7 +47,6 @@ cc [ \fIflag\fR... ] \fIfile\fR... -lsecdb -lsocket -lnsl [ \fIlibrary\fR... ] .fi .SH DESCRIPTION -.sp .LP The \fBgetuserattr()\fR, \fBgetusernam()\fR, and \fBgetuseruid()\fR functions each return a \fBuser_attr\fR(4) entry. Entries can come from any of the @@ -93,7 +92,6 @@ The \fBenduserattr()\fR function may be called to indicate that \fBuser_attr\fR processing is complete; the library may then close any open \fBuser_attr\fR file, deallocate any internal storage, and so forth. .SH RETURN VALUES -.sp .LP The \fBgetuserattr()\fR function returns a pointer to a \fBuserattr_t\fR if it successfully enumerates an entry; otherwise it returns \fINULL\fR, indicating @@ -103,7 +101,6 @@ the end of the enumeration. The \fBgetusernam()\fR function returns a pointer to a \fBuserattr_t\fR if it successfully locates the requested entry; otherwise it returns \fINULL\fR. .SH USAGE -.sp .LP The \fBgetuserattr()\fR and \fBgetusernam()\fR functions both allocate memory for the pointers they return. This memory should be deallocated with the @@ -112,13 +109,11 @@ for the pointers they return. This memory should be deallocated with the .LP Individual attributes can be referenced in the \fBattr\fR structure by calling the \fBkva_match\fR(3SECDB) function. -.SH WARININGS -.sp +.SH WARNINGS .LP -Because the list of legal keys is likely to expand, code must be written to +Because the list of legal keys is likely to expand, code must be written to ignore unknown key-value pairs without error. .SH FILES -.sp .ne 2 .na \fB\fB/etc/user_attr\fR\fR @@ -133,11 +128,10 @@ extended user attributes \fB\fB/etc/nsswitch.conf\fR\fR .ad .RS 22n -configuration file lookup information for the name server switch +configuration file lookup information for the name service switch .RE .SH ATTRIBUTES -.sp .LP See \fBattributes\fR(5) for descriptions of the following attributes: .sp @@ -153,7 +147,7 @@ MT-Level MT-Safe .TE .SH SEE ALSO -.sp .LP \fBgetauthattr\fR(3SECDB), \fBgetexecattr\fR(3SECDB), -\fBgetprofattr\fR(3SECDB), \fBuser_attr\fR(4), \fBattributes\fR(5) +\fBgetprofattr\fR(3SECDB), \fBkva_match\fR(3SECDB), \fBuser_attr\fR(4), +\fBattributes\fR(5) diff --git a/usr/src/man/man3secdb/kva_match.3secdb b/usr/src/man/man3secdb/kva_match.3secdb index fa03beb755..3abdb656ad 100644 --- a/usr/src/man/man3secdb/kva_match.3secdb +++ b/usr/src/man/man3secdb/kva_match.3secdb @@ -3,20 +3,19 @@ .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License. .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] -.TH KVA_MATCH 3SECDB "Aug 12, 1999" +.TH KVA_MATCH 3SECDB "Aug 13, 2018" .SH NAME kva_match \- look up a key in a key-value array .SH SYNOPSIS .LP .nf -cc [ \fIflag\fR... ] \fIfile\fR...- lsecdb [ \fIlibrary\fR... ] +cc [ \fIflag\fR... ] \fIfile\fR... -lsecdb [ \fIlibrary\fR... ] #include <secdb.h> \fBchar *\fR\fBkva_match\fR(\fBkva_t *\fR\fIkva\fR, \fBchar *\fR\fIkey\fR); .fi .SH DESCRIPTION -.sp .LP The \fBkva_match()\fR function searches a \fBkva_t\fR structure, which is part of the \fBauthattr_t\fR, \fBexecattr_t\fR, \fBprofattr_t\fR, or @@ -25,12 +24,10 @@ key value array, and a key. If the key is in the array, the function returns a pointer to the first corresponding value that matches that key. Otherwise, the function returns \fINULL\fR. .SH RETURN VALUES -.sp .LP Upon successful completion, the function returns a pointer to the value sought. Otherwise, it returns \fINULL\fR. .SH ATTRIBUTES -.sp .LP See \fBattributes\fR(5) for descriptions of the following attributes: .sp @@ -46,12 +43,10 @@ MT-Level MT-Safe .TE .SH SEE ALSO -.sp .LP \fBgetauthattr\fR(3SECDB), \fBgetexecattr\fR(3SECDB), \fBgetprofattr\fR(3SECDB), \fBgetuserattr\fR(3SECDB) .SH NOTES -.sp .LP The \fBkva_match()\fR function returns a pointer to data that already exists in the key-value array. It does not allocate its own memory for this pointer but diff --git a/usr/src/pkg/manifests/system-library.man3c.inc b/usr/src/pkg/manifests/system-library.man3c.inc index 26ae074cb8..c5641365ae 100644 --- a/usr/src/pkg/manifests/system-library.man3c.inc +++ b/usr/src/pkg/manifests/system-library.man3c.inc @@ -236,6 +236,7 @@ file path=usr/share/man/man3c/mbstowcs.3c file path=usr/share/man/man3c/mbtowc.3c file path=usr/share/man/man3c/membar_ops.3c file path=usr/share/man/man3c/memory.3c +file path=usr/share/man/man3c/memset_s.3c file path=usr/share/man/man3c/mkfifo.3c file path=usr/share/man/man3c/mkstemp.3c file path=usr/share/man/man3c/mktemp.3c @@ -405,6 +406,7 @@ file path=usr/share/man/man3c/sem_timedwait.3c file path=usr/share/man/man3c/sem_unlink.3c file path=usr/share/man/man3c/sem_wait.3c file path=usr/share/man/man3c/semaphore.3c +file path=usr/share/man/man3c/set_constraint_handler_s.3c file path=usr/share/man/man3c/setbuf.3c file path=usr/share/man/man3c/setbuffer.3c file path=usr/share/man/man3c/setcat.3c @@ -573,6 +575,8 @@ link path=usr/share/man/man3c/_etext.3c target=end.3c link path=usr/share/man/man3c/_exithandle.3c target=exit.3c link path=usr/share/man/man3c/_flushlbf.3c target=__fbufsize.3c link path=usr/share/man/man3c/_setjmp.3c target=_longjmp.3c +link path=usr/share/man/man3c/abort_handler_s.3c \ + target=set_constraint_handler_s.3c link path=usr/share/man/man3c/addrtosymstr.3c target=walkcontext.3c link path=usr/share/man/man3c/aiowrite.3c target=aioread.3c link path=usr/share/man/man3c/alloca.3c target=malloc.3c @@ -889,6 +893,8 @@ link path=usr/share/man/man3c/htole64.3c target=endian.3c link path=usr/share/man/man3c/htonl.3c target=byteorder.3c link path=usr/share/man/man3c/htonll.3c target=byteorder.3c link path=usr/share/man/man3c/htons.3c target=byteorder.3c +link path=usr/share/man/man3c/ignore_handler_s.3c \ + target=set_constraint_handler_s.3c link path=usr/share/man/man3c/inet6.3c target=inet.3c link path=usr/share/man/man3c/inet_addr.3c target=inet.3c link path=usr/share/man/man3c/inet_aton.3c target=inet.3c diff --git a/usr/src/pkg/manifests/system-test-libctest.mf b/usr/src/pkg/manifests/system-test-libctest.mf index f2eb069681..135822a5fd 100644 --- a/usr/src/pkg/manifests/system-test-libctest.mf +++ b/usr/src/pkg/manifests/system-test-libctest.mf @@ -91,6 +91,8 @@ file path=opt/libc-tests/tests/fnmatch.64 mode=0555 file path=opt/libc-tests/tests/fpround_test mode=0555 file path=opt/libc-tests/tests/fpround_test.$(ARCH) mode=0555 file path=opt/libc-tests/tests/fpround_test.$(ARCH64) mode=0555 +file path=opt/libc-tests/tests/memset_s.32 mode=0555 +file path=opt/libc-tests/tests/memset_s.64 mode=0555 file path=opt/libc-tests/tests/newlocale_test mode=0555 file path=opt/libc-tests/tests/newlocale_test.$(ARCH) mode=0555 file path=opt/libc-tests/tests/newlocale_test.$(ARCH64) mode=0555 @@ -148,6 +150,8 @@ file path=opt/libc-tests/tests/regex/regex_test mode=0555 file path=opt/libc-tests/tests/regex/testregex mode=0555 file path=opt/libc-tests/tests/select/select.sh mode=0555 file path=opt/libc-tests/tests/select/select_test mode=0555 +file path=opt/libc-tests/tests/set_constraint_handler_s.32 mode=0555 +file path=opt/libc-tests/tests/set_constraint_handler_s.64 mode=0555 file path=opt/libc-tests/tests/strcoll-strxfrm-6907.32 mode=0555 file path=opt/libc-tests/tests/strcoll-strxfrm-6907.64 mode=0555 file path=opt/libc-tests/tests/strerror mode=0555 diff --git a/usr/src/test/libc-tests/runfiles/default.run b/usr/src/test/libc-tests/runfiles/default.run index 35b04fd9fc..6781cba483 100644 --- a/usr/src/test/libc-tests/runfiles/default.run +++ b/usr/src/test/libc-tests/runfiles/default.run @@ -77,14 +77,20 @@ timeout = 600 [/opt/libc-tests/tests/env-7076.64] [/opt/libc-tests/tests/endian.32] [/opt/libc-tests/tests/endian.64] +[/opt/libc-tests/tests/env-7076.32] +[/opt/libc-tests/tests/env-7076.64] [/opt/libc-tests/tests/fnmatch.32] [/opt/libc-tests/tests/fnmatch.64] -[/opt/libc-tests/tests/quick_exit] -[/opt/libc-tests/tests/psignal] +[/opt/libc-tests/tests/memset_s.32] +[/opt/libc-tests/tests/memset_s.64] [/opt/libc-tests/tests/printf-6961.64] [/opt/libc-tests/tests/printf-9511.32] [/opt/libc-tests/tests/printf-9511.64] [/opt/libc-tests/tests/priv_gettext] +[/opt/libc-tests/tests/psignal] +[/opt/libc-tests/tests/quick_exit] +[/opt/libc-tests/tests/set_constraint_handler_s.32] +[/opt/libc-tests/tests/set_constraint_handler_s.64] [/opt/libc-tests/tests/strerror] [/opt/libc-tests/tests/timespec_get.32] [/opt/libc-tests/tests/timespec_get.64] diff --git a/usr/src/test/libc-tests/tests/Makefile b/usr/src/test/libc-tests/tests/Makefile index c587231ac1..4d53e707e5 100644 --- a/usr/src/test/libc-tests/tests/Makefile +++ b/usr/src/test/libc-tests/tests/Makefile @@ -39,10 +39,12 @@ PROGS = \ endian \ env-7076 \ fnmatch \ + memset_s \ printf-9511 \ psignal-5097 \ quick_exit_order \ quick_exit_status \ + set_constraint_handler_s \ strcoll-strxfrm-6907 \ timespec_get \ wcsncasecmp \ @@ -63,6 +65,11 @@ PROGS64 = \ aligned_alloc.32 := LDLIBS += -lproc aligned_alloc.64 := LDLIBS64 += -lproc +memset_s.32 := CPPFLAGS += -D__STDC_WANT_LIB_EXT1__=1 +memset_s.64 := CPPFLAGS += -D__STDC_WANT_LIB_EXT1__=1 +set_constraint_handler_s.32 := CPPFLAGS += -D__STDC_WANT_LIB_EXT1__=1 +set_constraint_handler_s.64 := CPPFLAGS += -D__STDC_WANT_LIB_EXT1__=1 + ROOTOPTDIR = $(ROOT)/opt/libc-tests/tests ROOTOPTPROGS = $(PROGS32:%=$(ROOTOPTDIR)/%) \ $(PROGS64:%=$(ROOTOPTDIR)/%) \ diff --git a/usr/src/test/libc-tests/tests/memset_s.c b/usr/src/test/libc-tests/tests/memset_s.c new file mode 100644 index 0000000000..4a73459bc5 --- /dev/null +++ b/usr/src/test/libc-tests/tests/memset_s.c @@ -0,0 +1,126 @@ +/* + * Copyright (c) 2017 Juniper Networks. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include <assert.h> +#include <stdint.h> +#include <stdlib.h> +#include <string.h> + +static errno_t e; +static const char *_RESTRICT_KYWD m; + +void +h(const char *_RESTRICT_KYWD msg, void *_RESTRICT_KYWD ptr, errno_t error) +{ + e = error; + m = msg; +} + +int +main(void) +{ + char a; + char b[3]; + + /* null ptr */ + set_constraint_handler_s(ignore_handler_s); + assert(memset_s(0, 1, 1, 1) != 0); + + /* smax > rmax */ + set_constraint_handler_s(ignore_handler_s); + assert(memset_s(&b, RSIZE_MAX + 1, 1, 1) != 0); + + /* smax < 0 */ + set_constraint_handler_s(ignore_handler_s); + assert(memset_s(&a, -1, 1, 1) != 0); + + /* normal */ + set_constraint_handler_s(ignore_handler_s); + a = 3; + assert(memset_s(&a, 1, 5, 1) == 0); + assert(a == 5); + + /* n > rmax */ + set_constraint_handler_s(ignore_handler_s); + assert(memset_s(&a, 1, 1, RSIZE_MAX + 1) != 0); + + /* n < 0 */ + set_constraint_handler_s(ignore_handler_s); + assert(memset_s(&a, 1, 1, -1) != 0); + + /* n < smax */ + set_constraint_handler_s(ignore_handler_s); + b[0] = 1; b[1] = 2; b[2] = 3; + assert(memset_s(&b[0], 3, 9, 1) == 0); + assert(b[0] == 9); + assert(b[1] == 2); + assert(b[2] == 3); + + /* n > smax, handler */ + set_constraint_handler_s(h); + e = 0; + m = NULL; + b[0] = 1; b[1] = 2; b[2] = 3; + assert(memset_s(&b[0], 1, 9, 3) != 0); + assert(e > 0); + assert(strcmp(m, "memset_s: n > smax") == 0); + assert(b[0] == 9); + assert(b[1] == 2); + assert(b[2] == 3); + + /* smax > rmax, handler */ + set_constraint_handler_s(h); + e = 0; + m = NULL; + assert(memset_s(&a, RSIZE_MAX + 1, 1, 1) != 0); + assert(e > 0); + assert(strcmp(m, "memset_s: smax > RSIZE_MAX") == 0); + + /* smax < 0, handler */ + set_constraint_handler_s(h); + e = 0; + m = NULL; + assert(memset_s(&a, -1, 1, 1) != 0); + assert(e > 0); + assert(strcmp(m, "memset_s: smax > RSIZE_MAX") == 0); + + /* n > rmax, handler */ + set_constraint_handler_s(h); + e = 0; + m = NULL; + assert(memset_s(&a, 1, 1, RSIZE_MAX + 1) != 0); + assert(e > 0); + assert(strcmp(m, "memset_s: n > RSIZE_MAX") == 0); + + /* n < 0, handler */ + set_constraint_handler_s(h); + e = 0; + m = NULL; + assert(memset_s(&a, 1, 1, -1) != 0); + assert(e > 0); + assert(strcmp(m, "memset_s: n > RSIZE_MAX") == 0); + + return (0); +} diff --git a/usr/src/test/libc-tests/tests/set_constraint_handler_s.c b/usr/src/test/libc-tests/tests/set_constraint_handler_s.c new file mode 100644 index 0000000000..770d5d46a4 --- /dev/null +++ b/usr/src/test/libc-tests/tests/set_constraint_handler_s.c @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2017 Juniper Networks. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include <assert.h> +#include <stdlib.h> + +int +main(void) +{ + /* null */ + assert(set_constraint_handler_s(abort_handler_s) == NULL); + + /* abort handler */ + set_constraint_handler_s(abort_handler_s); + assert(set_constraint_handler_s(ignore_handler_s) == abort_handler_s); + + /* ignore handler */ + set_constraint_handler_s(ignore_handler_s); + assert(set_constraint_handler_s(abort_handler_s) == ignore_handler_s); + + return (0); +} diff --git a/usr/src/uts/common/io/iwn/if_iwn.c b/usr/src/uts/common/io/iwn/if_iwn.c index 716794b20d..9e07f2b8e2 100644 --- a/usr/src/uts/common/io/iwn/if_iwn.c +++ b/usr/src/uts/common/io/iwn/if_iwn.c @@ -597,7 +597,7 @@ iwn_kstat_init_4965(struct iwn_softc *sc) kstat_named_init(&sc->sc_txpower->txchain[i].tcomp, tmp, KSTAT_DATA_LONG); - for (r = 0; r != IWN_RIDX_MAX; r++) { + for (r = 0; r <= IWN_RIDX_MAX; r++) { (void) snprintf(tmp, KSTAT_STRLEN - 1, "Ant %d Rate %d RF gain", i, r); kstat_named_init( diff --git a/usr/src/uts/common/io/iwn/if_iwnvar.h b/usr/src/uts/common/io/iwn/if_iwnvar.h index fcf32f49a3..fd90fa1436 100644 --- a/usr/src/uts/common/io/iwn/if_iwnvar.h +++ b/usr/src/uts/common/io/iwn/if_iwnvar.h @@ -207,7 +207,7 @@ struct iwn_softc { #define IWN_FLAG_LAZY_RESUME (1 << 23) #define IWN_FLAG_STOP_CALIB_TO (1 << 24) - uint8_t hw_type; + uint8_t hw_type; struct iwn_ops ops; const char *fwname; @@ -244,7 +244,7 @@ struct iwn_softc { struct iwn_rx_ring rxq; ddi_acc_handle_t sc_regh; - void *sc_ih; + void *sc_ih; ddi_acc_handle_t sc_pcih; uint_t sc_intr_pri; int sc_intr_cap; @@ -400,7 +400,7 @@ struct iwn_ks_txpower { struct { kstat_named_t rf_gain; kstat_named_t dsp_gain; - } rate[IWN_RIDX_MAX]; + } rate[IWN_RIDX_MAX + 1]; } txchain[2]; }; diff --git a/usr/src/uts/common/io/scsi/targets/st.c b/usr/src/uts/common/io/scsi/targets/st.c index ed376eee55..ea3283c93c 100644 --- a/usr/src/uts/common/io/scsi/targets/st.c +++ b/usr/src/uts/common/io/scsi/targets/st.c @@ -8181,8 +8181,9 @@ st_modesense(struct scsi_tape *un) } else { un->un_comp_page = 0; } + /* FALLTHROUGH */ - default: /* FALLTHROUGH */ + default: rval = st_cmd(un, SCMD_MODE_SENSE, MSIZE, SYNC_CMD); } return (rval); @@ -11209,7 +11210,8 @@ check_keys: severity = SCSI_ERR_INFO; break; } - default: /* FALLTHRU */ + /* FALLTHROUGH */ + default: /* give up */ rval = COMMAND_DONE_ERROR; severity = SCSI_ERR_FATAL; @@ -12040,6 +12042,7 @@ st_set_state(struct scsi_tape *un, struct buf *bp) if (new_lastop != ST_OP_NIL) { break; } + /* FALLTHROUGH */ default: /* * Unknown command, If was USCSI and USCSI_SILENT @@ -18496,6 +18499,7 @@ st_reset(struct scsi_tape *un, int reset_type) ST_DEBUG3(ST_DEVINFO, st_label, CE_WARN, "bus reset failed trying all reset"); reset_type = RESET_ALL; + break; default: mutex_enter(ST_MUTEX); return (rval); diff --git a/usr/src/uts/common/sys/feature_tests.h b/usr/src/uts/common/sys/feature_tests.h index 18b7de3f70..7e4b4fc67f 100644 --- a/usr/src/uts/common/sys/feature_tests.h +++ b/usr/src/uts/common/sys/feature_tests.h @@ -84,7 +84,7 @@ extern "C" { * * _STDC_C11 Like _STDC_C99 except that the value of __STDC_VERSION__ * is 201112L indicating a compiler that compiles with - * ISO/IEXC 9899:2011, otherwise known as the C11 standard. + * ISO/IEC 9899:2011, otherwise known as the C11 standard. * * _STRICT_SYMBOLS Used in cases where symbol visibility is restricted * by the standards, and the user has not explicitly @@ -130,7 +130,7 @@ extern "C" { * cc -Xs (K&R C) undefined undefined * * gcc (default) 1 undefined - * gcc -ansi, -std={c89, c99,...) 1 defined + * gcc -ansi, -std={c89, c99,...) 1 defined * gcc -traditional (K&R) undefined undefined * * The default compilation modes for Sun C compilers versus GNU C compilers @@ -191,7 +191,7 @@ extern "C" { * of _POSIX_SOURCE nor _XOPEN_SOURCE is defined and the value of * __STDC__ does not imply standards conformance). * - Extended system interfaces are explicitly requested (__EXTENSIONS__ - * is defined). + * is defined). * - Access to in-kernel interfaces is requested (_KERNEL or _KMEMUSER is * defined). (Note that this dependency is an artifact of the current * kernel implementation and may change in future releases.) @@ -436,6 +436,21 @@ extern "C" { #define _NORETURN_KYWD #endif +/* ISO/IEC 9899:2011 Annex K */ +#if !defined(_STRICT_SYMBOLS) +#define __EXT1_VISIBLE 1 +#else +#define __EXT1_VISIBLE 0 +#endif + +#if defined(__STDC_WANT_LIB_EXT1__) +#undef __EXT1_VISIBLE +#if __STDC_WANT_LIB_EXT1__ +#define __EXT1_VISIBLE 1 +#else +#define __EXT1_VISIBLE 0 +#endif +#endif /* __STDC_WANT_LIB_EXT1__ */ /* * The following macro indicates header support for the ANSI C++ @@ -450,12 +465,18 @@ extern "C" { #define _ISO_C_9899_1999 /* - * The following macro indicates header support for the C99 standard, + * The following macro indicates header support for the C11 standard, * ISO/IEC 9899:2011, Programming Languages - C. */ #define _ISO_C_9899_2011 /* + * The following macro indicates header support for the C11 standard, + * ISO/IEC 9899:2011 Annex K, Programming Languages - C. + */ +#undef __STDC_LIB_EXT1__ + +/* * The following macro indicates header support for DTrace. The value is an * integer that corresponds to the major version number for DTrace. */ diff --git a/usr/src/uts/i86pc/os/fakebop.c b/usr/src/uts/i86pc/os/fakebop.c index a62e45d89d..ff5e4ea7a4 100644 --- a/usr/src/uts/i86pc/os/fakebop.c +++ b/usr/src/uts/i86pc/os/fakebop.c @@ -620,6 +620,7 @@ boot_prop_finish(void) char *consoledev; uint64_t lvalue; int use_xencons = 0; + extern int bootrd_debug; #ifdef __xpv if (!DOMAIN_IS_INITDOMAIN(xen_info)) @@ -737,6 +738,12 @@ done: early_allocation = 0; /* + * Check for bootrd_debug. + */ + if (find_boot_prop("bootrd_debug")) + bootrd_debug = 1; + + /* * check to see if we have to override the default value of the console */ if (!use_xencons) { @@ -2594,7 +2601,7 @@ process_msct(ACPI_TABLE_MSCT *tp) item = (void *)(item->Length + (uintptr_t)item)) { /* * Sanity check according to section 5.2.19.1 of ACPI 4.0. - * Revision 1 + * Revision 1 * Length 22 */ if (item->Revision != 1 || item->Length != 22) { |