diff options
| author | Jerry Jelinek <jerry.jelinek@joyent.com> | 2019-01-10 13:03:39 +0000 |
|---|---|---|
| committer | Jerry Jelinek <jerry.jelinek@joyent.com> | 2019-01-10 13:03:39 +0000 |
| commit | 06f472df368b16d931bbd0cc036393e19f036faa (patch) | |
| tree | 6ac8f350b388962e4e5280f620e2c2b0874506e3 | |
| parent | 91561fc95663609a869e3d0a979f9465609cc40a (diff) | |
| parent | 9b40c3052b9b0d91120c568df0c5211c131c8da1 (diff) | |
| download | illumos-joyent-06f472df368b16d931bbd0cc036393e19f036faa.tar.gz | |
[illumos-gate merge]
commit 9b40c3052b9b0d91120c568df0c5211c131c8da1
10201 prototypes: happy new 2019 year
commit a103f15bc0089ffbdb0e211871d97b6b79f59fa1
10185 loader: add sha1 hash calculation
commit 8d2ce326a8ec4271f68dfa69691885d8219c9bb7
10184 loader: framebuffer command should report usage on bad command
commit 1fe853a05a457dfa95ddc2f2742c2421558a7c30
10171 biosdisk: use int13h ah=08 and ah=15 to count the floppy devices
commit b6b206fc7fb36f7b13b01acf70ed6e676e405998
10077 usr/src/uts/ Makefile changes for smatch
commit dc5e7685b131559c0b7c622baee25a9a0ae50ada
10076 make usr/src/test smatch clean
commit 93b8872871607b3d21317283c1230b2a4a00920b
10075 make usr/src/tools smatch clean
commit 64f9afd1fd6b5f36ed2c633d603a3b551da6f3d4
10066 loader: Add isoboot(5) for booting BIOS systems from HDDs containing ISO images.
commit 3273f292544925d8d86f8e40935d5360aa609ef4
10054 loader: move 16KB BSS buffer from pxe to bio and use it with biosdisk
commit f5037cd0e0544bd22e4547ec8656b0ec49615f5d
10175 Organize tcp(7P) into subsections
6109 tcp(7P) should mention that socket options are in <netinet/tcp.h>
287 files changed, 3664 insertions, 1152 deletions
@@ -18959,6 +18959,7 @@ f usr/share/man/man5/inotify.5 0444 root bin s usr/share/man/man5/intro.5=Intro.5 f usr/share/man/man5/ipfilter.5 0444 root bin f usr/share/man/man5/isalist.5 0444 root bin +f usr/share/man/man5/isoboot.5 0444 root bin f usr/share/man/man5/kerberos.5 0444 root bin f usr/share/man/man5/krb5_auth_rules.5 0444 root bin f usr/share/man/man5/krb5envvar.5 0444 root bin diff --git a/usr/src/boot/Makefile.version b/usr/src/boot/Makefile.version index 4683eed3f4..0f8ec264e4 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.12.18.1 +BOOT_VERSION = $(LOADER_VERSION)-2019.01.08.1 diff --git a/usr/src/boot/lib/libstand/cd9660.c b/usr/src/boot/lib/libstand/cd9660.c index e9a66095ea..eb6cdcae5b 100644 --- a/usr/src/boot/lib/libstand/cd9660.c +++ b/usr/src/boot/lib/libstand/cd9660.c @@ -308,6 +308,7 @@ cd9660_open(const char *path, struct open_file *f) first = 1; use_rrip = 0; + lenskip = 0; while (*path) { bno = isonum_733(rec.extent) + isonum_711(rec.ext_attr_length); dsize = isonum_733(rec.size); diff --git a/usr/src/boot/sys/boot/Makefile b/usr/src/boot/sys/boot/Makefile index fbda11357b..8a93119cd2 100644 --- a/usr/src/boot/sys/boot/Makefile +++ b/usr/src/boot/sys/boot/Makefile @@ -18,7 +18,7 @@ include $(SRC)/Makefile.master INSTDIRS = i386 efi -SUBDIRS = libstand libficl zfs $(INSTDIRS) +SUBDIRS = libstand libficl libcrypto zfs $(INSTDIRS) all := TARGET = all clean := TARGET = clean diff --git a/usr/src/boot/sys/boot/common/bootstrap.h b/usr/src/boot/sys/boot/common/bootstrap.h index 97d86bed57..0ffe65f725 100644 --- a/usr/src/boot/sys/boot/common/bootstrap.h +++ b/usr/src/boot/sys/boot/common/bootstrap.h @@ -28,6 +28,7 @@ #define _BOOTSTRAP_H_ #include <sys/types.h> +#include <stdbool.h> #include <sys/queue.h> #include <sys/linker_set.h> @@ -240,6 +241,7 @@ int file_addmodule(struct preloaded_file *fp, char *modname, int version, void build_environment_module(void); void build_font_module(void); vm_offset_t bi_copyenv(vm_offset_t); +bool sha1(void *, size_t, uint8_t *); /* MI module loaders */ #ifdef __elfN diff --git a/usr/src/boot/sys/boot/common/module.c b/usr/src/boot/sys/boot/common/module.c index 243e8e466a..445d039144 100644 --- a/usr/src/boot/sys/boot/common/module.c +++ b/usr/src/boot/sys/boot/common/module.c @@ -39,9 +39,16 @@ #include <sys/stdint.h> #include <sys/tem_impl.h> #include <sys/font.h> +#include <sys/sha1.h> #include "bootstrap.h" +#if defined(EFI) +#define PTOV(pa) ((void *)pa) +#else +#include "../i386/btx/lib/btxv86.h" +#endif + #define MDIR_REMOVED 0x0001 #define MDIR_NOHINTS 0x0002 @@ -257,16 +264,20 @@ command_lsmod(int argc, char *argv[]) struct kernel_module *mp; struct file_metadata *md; char lbuf[80]; - int ch, verbose, ret = 0; + int ch, verbose, hash, ret = 0; verbose = 0; + hash = 0; optind = 1; optreset = 1; - while ((ch = getopt(argc, argv, "v")) != -1) { + while ((ch = getopt(argc, argv, "vs")) != -1) { switch(ch) { case 'v': verbose = 1; break; + case 's': + hash = 1; + break; case '?': default: /* getopt has already reported an error */ @@ -287,7 +298,25 @@ command_lsmod(int argc, char *argv[]) pager_output(fp->f_args); if (pager_output("\n")) break; + if (strcmp(fp->f_type, "hash") == 0) { + pager_output(" contents: "); + strncpy(lbuf, PTOV(fp->f_addr), fp->f_size); + if (pager_output(lbuf)) + break; + } + } + + if (hash == 1) { + void *ptr = PTOV(fp->f_addr); + + pager_output(" hash: "); + sha1(ptr, fp->f_size, (uint8_t *)lbuf); + for (int i = 0; i < SHA1_DIGEST_LENGTH; i++) + printf("%02x", (int)(lbuf[i] & 0xff)); + if (pager_output("\n")) + break; } + if (fp->f_modules) { pager_output(" modules: "); for (mp = fp->f_modules; mp; mp = mp->m_next) { @@ -425,6 +454,22 @@ env_get_size(void) return (size); } +static void +module_hash(struct preloaded_file *fp, void *addr, size_t size) +{ + uint8_t hash[SHA1_DIGEST_LENGTH]; + char ascii[2 * SHA1_DIGEST_LENGTH + 1]; + int i; + + sha1(addr, size, hash); + for (i = 0; i < SHA1_DIGEST_LENGTH; i++) { + snprintf(ascii + 2 * i, sizeof (ascii) - 2 * i, "%02x", + hash[i] & 0xff); + } + /* Out of memory here is not fatal issue. */ + asprintf(&fp->f_args, "hash=%s", ascii); +} + /* * Create virtual module for environment variables. * This module should be created as late as possible before executing @@ -474,8 +519,8 @@ build_environment_module(void) } laddr = bi_copyenv(loadaddr); - /* Looks OK so far; populate control structure */ + module_hash(fp, PTOV(loadaddr), laddr - loadaddr); fp->f_loader = -1; fp->f_addr = loadaddr; fp->f_size = laddr - loadaddr; @@ -581,6 +626,7 @@ build_font_module(void) laddr += archsw.arch_copyin(fd->vf_bytes, laddr, fi.fi_bitmap_size); /* Looks OK so far; populate control structure */ + module_hash(fp, PTOV(loadaddr), laddr - loadaddr); fp->f_loader = -1; fp->f_addr = loadaddr; fp->f_size = laddr - loadaddr; diff --git a/usr/src/boot/sys/boot/efi/loader/Makefile.com b/usr/src/boot/sys/boot/efi/loader/Makefile.com index 74099f45d9..be81482ae1 100644 --- a/usr/src/boot/sys/boot/efi/loader/Makefile.com +++ b/usr/src/boot/sys/boot/efi/loader/Makefile.com @@ -147,9 +147,11 @@ loader.bin: loader.sym --output-target=$(EFI_TARGET) --subsystem efi-app loader.sym $@ LIBEFI= ../../libefi/$(MACHINE)/libefi.a +LIBCRYPTO= ../../../libcrypto/$(MACHINE)/libcrypto.a -DPADD= $(LIBFICL) $(LIBZFSBOOT) $(LIBEFI) $(LIBSTAND) $(LDSCRIPT) -LDADD= $(LIBFICL) $(LIBZFSBOOT) $(LIBEFI) $(LIBSTAND) +DPADD= $(LIBFICL) $(LIBZFSBOOT) $(LIBEFI) $(LIBCRYPTO) $(LIBSTAND) \ + $(LDSCRIPT) +LDADD= $(LIBFICL) $(LIBZFSBOOT) $(LIBEFI) $(LIBCRYPTO) $(LIBSTAND) loader.sym: $(OBJS) $(DPADD) diff --git a/usr/src/boot/sys/boot/i386/Makefile b/usr/src/boot/sys/boot/i386/Makefile index d2cd7d3e48..cb6753d140 100644 --- a/usr/src/boot/sys/boot/i386/Makefile +++ b/usr/src/boot/sys/boot/i386/Makefile @@ -19,8 +19,8 @@ include $(SRC)/Makefile.master # likely targets for removal, keeping around just in case... # SUBDIRS= boot0 boot0sio kgzldr libfirewire # current targets -SUBDIRS= pmbr btx cdboot gptzfsboot libi386 loader pxeldr -INSTDIRS= pmbr cdboot gptzfsboot loader pxeldr +SUBDIRS= pmbr btx cdboot gptzfsboot libi386 loader pxeldr isoboot +INSTDIRS= pmbr cdboot gptzfsboot loader pxeldr isoboot all:= TARGET= all install:= TARGET= install @@ -35,7 +35,7 @@ install: all .WAIT $(INSTDIRS) loader: libi386 pxeldr: loader -cdboot gptzfsboot loader pxeldr: btx +cdboot gptzfsboot loader pxeldr isoboot: btx FRC: diff --git a/usr/src/boot/sys/boot/i386/btx/Makefile b/usr/src/boot/sys/boot/i386/btx/Makefile index a95d1b1db9..7ba55cc583 100644 --- a/usr/src/boot/sys/boot/i386/btx/Makefile +++ b/usr/src/boot/sys/boot/i386/btx/Makefile @@ -28,7 +28,7 @@ clobber:= TARGET= clobber all clean clobber: $(SUBDIRS) -install: $(SUBDIRS) +install: all FRC: diff --git a/usr/src/boot/sys/boot/i386/common/drv.c b/usr/src/boot/sys/boot/i386/common/drv.c index 52933d5d52..d21f069dd8 100644 --- a/usr/src/boot/sys/boot/i386/common/drv.c +++ b/usr/src/boot/sys/boot/i386/common/drv.c @@ -1,4 +1,4 @@ -/*- +/* * Copyright (c) 1998 Robert Nordier * Copyright (c) 2010 Pawel Jakub Dawidek <pjd@FreeBSD.org> * All rights reserved. @@ -15,28 +15,23 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); #include <sys/param.h> #include <btxv86.h> +#include "stand.h" #include "rbx.h" -#include "util.h" #include "drv.h" #include "edd.h" -#ifdef USE_XREAD -#include "xreadorg.h" -#endif -#ifdef GPT static struct edd_params params; uint64_t drvsize(struct dsk *dskp) { - params.len = sizeof(struct edd_params); + params.len = sizeof (struct edd_params); v86.ctl = V86_FLAGS; v86.addr = 0x13; v86.eax = 0x4800; @@ -50,11 +45,8 @@ drvsize(struct dsk *dskp) } return (params.sectors); } -#endif /* GPT */ -#ifndef USE_XREAD static struct edd_packet packet; -#endif int drvread(struct dsk *dskp, void *buf, daddr_t lba, unsigned nblk) @@ -63,8 +55,7 @@ drvread(struct dsk *dskp, void *buf, daddr_t lba, unsigned nblk) if (!OPT_CHECK(RBX_QUIET)) printf("%c\b", c = c << 8 | c >> 24); -#ifndef USE_XREAD - packet.len = sizeof(struct edd_packet); + packet.len = sizeof (struct edd_packet); packet.count = nblk; packet.off = VTOPOFF(buf); packet.seg = VTOPSEG(buf); @@ -75,30 +66,20 @@ drvread(struct dsk *dskp, void *buf, daddr_t lba, unsigned nblk) v86.edx = dskp->drive; v86.ds = VTOPSEG(&packet); v86.esi = VTOPOFF(&packet); -#else /* USE_XREAD */ - v86.ctl = V86_ADDR | V86_CALLF | V86_FLAGS; - v86.addr = XREADORG; /* call to xread in boot1 */ - v86.es = VTOPSEG(buf); - v86.eax = lba; - v86.ebx = VTOPOFF(buf); - v86.ecx = lba >> 32; - v86.edx = nblk << 8 | dskp->drive; -#endif /* USE_XREAD */ v86int(); if (V86_CY(v86.efl)) { - printf("%s: error %u lba %u\n", + printf("%s: error %u lba %llu\n", BOOTPROG, v86.eax >> 8 & 0xff, lba); return (-1); } return (0); } -#ifdef GPT int drvwrite(struct dsk *dskp, void *buf, daddr_t lba, unsigned nblk) { - packet.len = sizeof(struct edd_packet); + packet.len = sizeof (struct edd_packet); packet.count = nblk; packet.off = VTOPOFF(buf); packet.seg = VTOPSEG(buf); @@ -111,9 +92,8 @@ drvwrite(struct dsk *dskp, void *buf, daddr_t lba, unsigned nblk) v86.esi = VTOPOFF(&packet); v86int(); if (V86_CY(v86.efl)) { - printf("error %u lba %u\n", v86.eax >> 8 & 0xff, lba); + printf("error %u lba %llu\n", v86.eax >> 8 & 0xff, lba); return (-1); } return (0); } -#endif /* GPT */ diff --git a/usr/src/boot/sys/boot/i386/common/drv.h b/usr/src/boot/sys/boot/i386/common/drv.h index 1ecfbc3af9..8f2f1a8136 100644 --- a/usr/src/boot/sys/boot/i386/common/drv.h +++ b/usr/src/boot/sys/boot/i386/common/drv.h @@ -40,9 +40,7 @@ struct dsk { }; int drvread(struct dsk *dskp, void *buf, daddr_t lba, unsigned nblk); -#ifdef GPT int drvwrite(struct dsk *dskp, void *buf, daddr_t lba, unsigned nblk); uint64_t drvsize(struct dsk *dskp); -#endif /* GPT */ #endif /* !_DRV_H_ */ diff --git a/usr/src/boot/sys/boot/i386/gptzfsboot/Makefile b/usr/src/boot/sys/boot/i386/gptzfsboot/Makefile index 173dac304f..303e8bede6 100644 --- a/usr/src/boot/sys/boot/i386/gptzfsboot/Makefile +++ b/usr/src/boot/sys/boot/i386/gptzfsboot/Makefile @@ -75,7 +75,7 @@ all: $(PROG) install: all $(ROOTBOOTPROG) -OBJS = multiboot.o zfsboot.o sio.o cons.o panic.o devopen.o \ +OBJS = multiboot.o zfsboot.o sio.o cons.o panic.o devopen.o bio.o \ part.o biosmem.o smbios.o biosdisk.o devicename.o disk.o bcache.o \ time.o zfs_cmd.o @@ -121,24 +121,12 @@ $(OBJS): machine x86 %.o: ../../common/%.c $(COMPILE.c) -o $@ $< -biosdisk.o: ../libi386/biosdisk.c - $(CC) $(CFLAGS) $(CPPFLAGS) -Dalloca=__builtin_alloca -c -o $@ ../libi386/$*.c - -biosmem.o: ../libi386/biosmem.c - $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ ../libi386/$*.c - -smbios.o: ../libi386/smbios.c - $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ ../libi386/$*.c - -devicename.o: ../libi386/devicename.c - $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ ../libi386/$*.c - -time.o: ../libi386/time.c - $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ ../libi386/$*.c - multiboot.o: ../../common/multiboot.S $(CC) $(CFLAGS) $(CCASFLAGS) -c -o $@ ../../common/$*.S +%.o: ../libi386/%.c + $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $< + .S.o: $(CC) $(CFLAGS) $(CCASFLAGS) -c -o $@ $< diff --git a/usr/src/boot/sys/boot/i386/isoboot/Makefile b/usr/src/boot/sys/boot/i386/isoboot/Makefile new file mode 100644 index 0000000000..5486aae03b --- /dev/null +++ b/usr/src/boot/sys/boot/i386/isoboot/Makefile @@ -0,0 +1,119 @@ +# +# 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 2015 Toomas Soome <tsoome@me.com> +# + +include $(SRC)/Makefile.master +include $(SRC)/boot/Makefile.version + +AS= $(GNU_ROOT)/bin/gas +LD= $(GNU_ROOT)/bin/gld +CC= $(GNUC_ROOT)/bin/gcc +OBJCOPY= $(GNU_ROOT)/bin/gobjcopy + +PROG= isoboot +FILEMODE=0444 + +BOOT_COMCONSOLE_PORT= 0x3f8 +BOOT_COMCONSOLE_SPEED= 9600 +B2SIOFMT= 0x3 + +ORG1= 0x7c00 +ORG2= 0x0 + +ISOBOOTSIZE= 30720 + +CPPFLAGS= -nostdinc -D_STANDALONE +CFLAGS= -DBOOTPROG=\"isoboot\" \ + -O1 \ + -DSIOPRT=${BOOT_COMCONSOLE_PORT} \ + -DSIOFMT=${B2SIOFMT} \ + -DSIOSPD=${BOOT_COMCONSOLE_SPEED} \ + -I../../../../include \ + -I../../../../lib/libstand \ + -I. \ + -I../../.. \ + -I../common \ + -I../btx/lib \ + -I../../common \ + -I../gptzfsboot \ + -Wall -Waggregate-return -Wbad-function-cast -Wno-cast-align \ + -Wmissing-declarations -Wmissing-prototypes -Wnested-externs \ + -Wpointer-arith -Wshadow -Wstrict-prototypes -Wwrite-strings \ + -Winline -Wno-pointer-sign + +CFLAGS += --param max-inline-insns-single=100 +CFLAGS += -fno-reorder-functions + +LD_FLAGS= -static -N --gc-sections +CCASFLAGS= -Wa,--divide +LIBSTAND= ../../libstand/$(MACH)/libstand.a + +include ../Makefile.inc + +all: $(PROG) + +install: all $(ROOTBOOTPROG) + +OBJS= multiboot.o isoboot.o sio.o drv.o cons.o gptldr.o panic.o + +CLEANFILES += isoboot + +isoboot: gptldr.bin isoboot.bin ${BTXKERN} + btxld -v -E ${ORG2} -f bin -b ${BTXKERN} -V ${BOOT_VERSION} -l \ + gptldr.bin -o $@ isoboot.bin + @set -- `ls -l $@`; x=$$((${ISOBOOTSIZE}-$$5)); \ + echo "$$x bytes available"; test $$x -ge 0 + +CLEANFILES += gptldr.bin gptldr.out gptldr.o + +gptldr.bin: gptldr.out + ${OBJCOPY} -S -O binary gptldr.out $@ + +gptldr.out: gptldr.o + ${LD} ${LD_FLAGS} -e start -Ttext ${ORG1} -o $@ gptldr.o + +CLEANFILES += isoboot.bin isoboot.out ${OBJS} + +isoboot.bin: isoboot.out + ${OBJCOPY} -S -O binary isoboot.out $@ + +isoboot.out: ${BTXCRT} ${OBJS} + ${LD} ${LD_FLAGS} -Ttext ${ORG2} -o $@ ${BTXCRT} ${OBJS} ${LIBSTAND} + +machine: + $(RM) machine + $(SYMLINK) ../../../i386/include machine + +x86: + $(RM) x86 + $(SYMLINK) ../../../x86/include x86 + +$(OBJS): machine x86 + +%.o: ../gptzfsboot/%.S + $(CC) $(CFLAGS) $(CCASFLAGS) -c -o $@ $< + +%.o: ../../common/%.S + $(CC) $(CFLAGS) $(CCASFLAGS) -c -o $@ $< + +%.o: ../common/%.c + $(COMPILE.c) -o $@ $< + +%.o: ../../common/%.c + $(COMPILE.c) -o $@ $< + +clobber: clean + +clean: + $(RM) $(CLEANFILES) machine x86 diff --git a/usr/src/boot/sys/boot/i386/isoboot/cd9660read.c b/usr/src/boot/sys/boot/i386/isoboot/cd9660read.c new file mode 100644 index 0000000000..6cfa8d304f --- /dev/null +++ b/usr/src/boot/sys/boot/i386/isoboot/cd9660read.c @@ -0,0 +1,368 @@ +/* + * Copyright (C) 1996 Wolfgang Solfrank. + * Copyright (C) 1996 TooLs GmbH. + * 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by TooLs GmbH. + * 4. The name of TooLs GmbH may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``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 TOOLS GMBH 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. + */ + +/* Originally derived from libsa/cd9660.c: */ +/* $NetBSD: cd9660.c,v 1.5 1997/06/26 19:11:33 drochner Exp $ */ + +#include <sys/cdefs.h> + +#include <fs/cd9660/iso.h> +#include <fs/cd9660/cd9660_rrip.h> + +static uint64_t cd9660_lookup(const char *); +static ssize_t cd9660_fsread(uint64_t, void *, size_t); + +#define SUSP_CONTINUATION "CE" +#define SUSP_PRESENT "SP" +#define SUSP_STOP "ST" +#define SUSP_EXTREF "ER" +#define RRIP_NAME "NM" + +typedef struct { + ISO_SUSP_HEADER h; + uint8_t signature [ISODCL(5, 6)]; + uint8_t len_skp [ISODCL(7, 7)]; /* 711 */ +} ISO_SUSP_PRESENT; + +#define cdb2devb(bno) ((bno) * ISO_DEFAULT_BLOCK_SIZE / DEV_BSIZE) + +static int +read_iso_block(void *buffer, daddr_t blkno) +{ + + return (drvread(&dsk, buffer, cdb2devb(blkno), + ISO_DEFAULT_BLOCK_SIZE / DEV_BSIZE)); +} + +static ISO_SUSP_HEADER * +susp_lookup_record(const char *identifier, struct iso_directory_record *dp, + int lenskip) +{ + static char susp_buffer[ISO_DEFAULT_BLOCK_SIZE]; + ISO_SUSP_HEADER *sh; + ISO_RRIP_CONT *shc; + char *p, *end; + int error; + + p = dp->name + isonum_711(dp->name_len) + lenskip; + /* Names of even length have a padding byte after the name. */ + if ((isonum_711(dp->name_len) & 1) == 0) + p++; + end = (char *)dp + isonum_711(dp->length); + while (p + 3 < end) { + sh = (ISO_SUSP_HEADER *)p; + if (bcmp(sh->type, identifier, 2) == 0) + return (sh); + if (bcmp(sh->type, SUSP_STOP, 2) == 0) + return (NULL); + if (bcmp(sh->type, SUSP_CONTINUATION, 2) == 0) { + shc = (ISO_RRIP_CONT *)sh; + error = read_iso_block(susp_buffer, + isonum_733(shc->location)); + + /* Bail if it fails. */ + if (error != 0) + return (NULL); + p = susp_buffer + isonum_733(shc->offset); + end = p + isonum_733(shc->length); + } else { + /* Ignore this record and skip to the next. */ + p += isonum_711(sh->length); + + /* Avoid infinite loops with corrupted file systems */ + if (isonum_711(sh->length) == 0) + return (NULL); + } + } + return (NULL); +} + +static const char * +rrip_lookup_name(struct iso_directory_record *dp, int lenskip, size_t *len) +{ + ISO_RRIP_ALTNAME *p; + + if (len == NULL) + return (NULL); + + p = (ISO_RRIP_ALTNAME *)susp_lookup_record(RRIP_NAME, dp, lenskip); + if (p == NULL) + return (NULL); + switch (*p->flags) { + case ISO_SUSP_CFLAG_CURRENT: + *len = 1; + return ("."); + case ISO_SUSP_CFLAG_PARENT: + *len = 2; + return (".."); + case 0: + *len = isonum_711(p->h.length) - 5; + return ((char *)p + 5); + default: + /* + * We don't handle hostnames or continued names as they are + * too hard, so just bail and use the default name. + */ + return (NULL); + } +} + +static int +rrip_check(struct iso_directory_record *dp, int *lenskip) +{ + ISO_SUSP_PRESENT *sp; + ISO_RRIP_EXTREF *er; + char *p; + + /* First, see if we can find a SP field. */ + p = dp->name + isonum_711(dp->name_len); + if (p > (char *)dp + isonum_711(dp->length)) { + return (0); + } + sp = (ISO_SUSP_PRESENT *)p; + if (bcmp(sp->h.type, SUSP_PRESENT, 2) != 0) { + return (0); + } + if (isonum_711(sp->h.length) != sizeof (ISO_SUSP_PRESENT)) { + return (0); + } + if (sp->signature[0] != 0xbe || sp->signature[1] != 0xef) { + return (0); + } + *lenskip = isonum_711(sp->len_skp); + + /* + * Now look for an ER field. If RRIP is present, then there must + * be at least one of these. It would be more pedantic to walk + * through the list of fields looking for a Rock Ridge ER field. + */ + er = (ISO_RRIP_EXTREF *)susp_lookup_record(SUSP_EXTREF, dp, 0); + if (er == NULL) { + return (0); + } + return (1); +} + +static int +dirmatch(const char *path, struct iso_directory_record *dp, int use_rrip, + int lenskip) +{ + size_t len; + const char *cp = NULL; + int i, icase; + + if (use_rrip) + cp = rrip_lookup_name(dp, lenskip, &len); + else + cp = NULL; + if (cp == NULL) { + len = isonum_711(dp->name_len); + cp = dp->name; + icase = 1; + } else + icase = 0; + for (i = len; --i >= 0; path++, cp++) { + if (!*path || *path == '/') + break; + if (*path == *cp) + continue; + if (!icase && toupper(*path) == *cp) + continue; + return (0); + } + if (*path && *path != '/') { + return (0); + } + /* + * Allow stripping of trailing dots and the version number. + * Note that this will find the first instead of the last version + * of a file. + */ + if (i >= 0 && (*cp == ';' || *cp == '.')) { + /* This is to prevent matching of numeric extensions */ + if (*cp == '.' && cp[1] != ';') { + return (0); + } + while (--i >= 0) + if (*++cp != ';' && (*cp < '0' || *cp > '9')) { + return (0); + } + } + return (1); +} + +static uint64_t +cd9660_lookup(const char *path) +{ + static char blkbuf[ISO_DEFAULT_BLOCK_SIZE]; + struct iso_primary_descriptor *vd; + struct iso_directory_record rec; + struct iso_directory_record *dp = NULL; + size_t dsize, off; + daddr_t bno, boff; + int rc, first, use_rrip, lenskip; + uint64_t cookie; + + for (bno = 16; ; bno++) { + rc = read_iso_block(blkbuf, bno); + if (rc != 0) + return (0); + vd = (struct iso_primary_descriptor *)blkbuf; + + if (bcmp(vd->id, ISO_STANDARD_ID, sizeof (vd->id)) != 0) + return (0); + if (isonum_711(vd->type) == ISO_VD_END) + return (0); + if (isonum_711(vd->type) == ISO_VD_PRIMARY) + break; + } + + rec = *(struct iso_directory_record *)vd->root_directory_record; + if (*path == '/') path++; /* eat leading '/' */ + + first = 1; + use_rrip = 0; + lenskip = 0; + while (*path) { + bno = isonum_733(rec.extent) + isonum_711(rec.ext_attr_length); + dsize = isonum_733(rec.size); + off = 0; + boff = 0; + + while (off < dsize) { + if ((off % ISO_DEFAULT_BLOCK_SIZE) == 0) { + rc = read_iso_block(blkbuf, bno + boff); + if (rc) { + return (0); + } + boff++; + dp = (struct iso_directory_record *)blkbuf; + } + if (isonum_711(dp->length) == 0) { + /* skip to next block, if any */ + off = boff * ISO_DEFAULT_BLOCK_SIZE; + continue; + } + + /* See if RRIP is in use. */ + if (first) + use_rrip = rrip_check(dp, &lenskip); + + if (dirmatch(path, dp, use_rrip, + first ? 0 : lenskip)) { + first = 0; + break; + } else + first = 0; + + dp = (struct iso_directory_record *) + ((char *)dp + isonum_711(dp->length)); + /* If the new block has zero length, it is padding. */ + if (isonum_711(dp->length) == 0) { + /* Skip to next block, if any. */ + off = boff * ISO_DEFAULT_BLOCK_SIZE; + continue; + } + off += isonum_711(dp->length); + } + if (off >= dsize) { + return (0); + } + + rec = *dp; + while (*path && *path != '/') /* look for next component */ + path++; + if (*path) path++; /* skip '/' */ + } + + if ((isonum_711(rec.flags) & 2) != 0) { + return (0); + } + + cookie = isonum_733(rec.extent) + isonum_711(rec.ext_attr_length); + cookie = (cookie << 32) | isonum_733(rec.size); + + return (cookie); +} + +static ssize_t +cd9660_fsread(uint64_t cookie, void *buf, size_t nbytes) +{ + static char blkbuf[ISO_DEFAULT_BLOCK_SIZE]; + static daddr_t curstart = 0, curblk = 0; + daddr_t blk, blk_off; + off_t byte_off; + size_t size, remaining, n; + char *s; + + size = cookie & 0xffffffff; + blk = (cookie >> 32) & 0xffffffff; + + /* Make sure we're looking at the right file. */ + if ((uint64_t)((blk << 32) | size) != cookie) { + return (-1); + } + + if (blk != curstart) { + curstart = blk; + fs_off = 0; + } + + size -= fs_off; + if (size < nbytes) { + nbytes = size; + } + remaining = nbytes; + s = buf; + + while (remaining > 0) { + blk_off = fs_off >> ISO_DEFAULT_BLOCK_SHIFT; + byte_off = fs_off & (ISO_DEFAULT_BLOCK_SIZE - 1); + + if (curblk != curstart + blk_off) { + curblk = curstart + blk_off; + read_iso_block(blkbuf, curblk); + } + + if (remaining < ISO_DEFAULT_BLOCK_SIZE - byte_off) { + n = remaining; + } else { + n = ISO_DEFAULT_BLOCK_SIZE - byte_off; + } + memcpy(s, blkbuf + byte_off, n); + remaining -= n; + s += n; + + fs_off += n; + } + + return (nbytes); +} diff --git a/usr/src/boot/sys/boot/i386/isoboot/isoboot.c b/usr/src/boot/sys/boot/i386/isoboot/isoboot.c new file mode 100644 index 0000000000..e5550f3b2f --- /dev/null +++ b/usr/src/boot/sys/boot/i386/isoboot/isoboot.c @@ -0,0 +1,545 @@ +/* + * Copyright (c) 1998 Robert Nordier + * All rights reserved. + * + * Redistribution and use in source and binary forms are freely + * permitted provided that the above copyright notice and this + * paragraph and the following disclaimer are duplicated in all + * such forms. + * + * This software is provided "AS IS" and without any express or + * implied warranties, including, without limitation, the implied + * warranties of merchantability and fitness for a particular + * purpose. + */ + +#include <sys/cdefs.h> + +#include <sys/param.h> +#include <sys/gpt.h> +#include <sys/dirent.h> +#include <sys/reboot.h> + +#include <machine/bootinfo.h> +#include <machine/elf.h> +#include <machine/pc/bios.h> +#include <machine/psl.h> + +#include <stdarg.h> + +#include <a.out.h> + +#include <btxv86.h> + +#include "stand.h" + +#include "bootargs.h" +#include "lib.h" +#include "rbx.h" +#include "drv.h" +#include "cons.h" +#include "gpt.h" +#include "paths.h" + +#define ARGS 0x900 +#define NOPT 14 +#define NDEV 3 +#define MEM_BASE 0x12 +#define MEM_EXT 0x15 + +#define DRV_HARD 0x80 +#define DRV_MASK 0x7f + +#define TYPE_AD 0 +#define TYPE_DA 1 +#define TYPE_MAXHARD TYPE_DA +#define TYPE_FD 2 + +/* + * Fake multiboot header to provide versioning and to pass + * partition start LBA. Partition is either GPT partition or + * VTOC slice. + */ +extern const struct multiboot_header mb_header; +extern uint64_t start_sector; + +extern uint32_t _end; + +static const char optstr[NOPT] = "DhaCcdgmnpqrsv"; /* Also 'P', 'S' */ +static const unsigned char flags[NOPT] = { + RBX_DUAL, + RBX_SERIAL, + RBX_ASKNAME, + RBX_CDROM, + RBX_CONFIG, + RBX_KDB, + RBX_GDB, + RBX_MUTE, + RBX_NOINTR, + RBX_PAUSE, + RBX_QUIET, + RBX_DFLTROOT, + RBX_SINGLE, + RBX_VERBOSE +}; +uint32_t opts; + +static const char *const dev_nm[NDEV] = {"ad", "da", "fd"}; +static const unsigned char dev_maj[NDEV] = {30, 4, 2}; + +static struct dsk dsk; +static char kname[1024]; +static int comspeed = SIOSPD; +static struct bootinfo bootinfo; + +static vm_offset_t high_heap_base; +static uint32_t bios_basemem, bios_extmem, high_heap_size; + +static struct bios_smap smap; + +/* + * The minimum amount of memory to reserve in bios_extmem for the heap. + */ +#define HEAP_MIN (3 * 1024 * 1024) + +static char *heap_next; +static char *heap_end; + +int main(void); + +void exit(int); +static void load(void); +static int parse_cmds(char *, int *); + +static uint8_t ls; +static uint32_t fs_off; + +#include "cd9660read.c" + +static int +xfsread(uint64_t inode, void *buf, size_t nbyte) +{ + + if ((size_t)cd9660_fsread(inode, buf, nbyte) != nbyte) { + printf("Invalid %s\n", "format"); + return (-1); + } + return (0); +} + +static void +bios_getmem(void) +{ + uint64_t size; + + /* Parse system memory map */ + v86.ebx = 0; + do { + v86.ctl = V86_FLAGS; + v86.addr = MEM_EXT; /* int 0x15 function 0xe820 */ + v86.eax = 0xe820; + v86.ecx = sizeof (struct bios_smap); + v86.edx = SMAP_SIG; + v86.es = VTOPSEG(&smap); + v86.edi = VTOPOFF(&smap); + v86int(); + if ((v86.efl & 1) || (v86.eax != SMAP_SIG)) + break; + /* look for a low-memory segment that's large enough */ + if ((smap.type == SMAP_TYPE_MEMORY) && (smap.base == 0) && + (smap.length >= (512 * 1024))) + bios_basemem = smap.length; + /* look for the first segment in 'extended' memory */ + if ((smap.type == SMAP_TYPE_MEMORY) && + (smap.base == 0x100000)) { + bios_extmem = smap.length; + } + + /* + * Look for the largest segment in 'extended' memory beyond + * 1MB but below 4GB. + */ + if ((smap.type == SMAP_TYPE_MEMORY) && + (smap.base > 0x100000) && (smap.base < 0x100000000ull)) { + size = smap.length; + + /* + * If this segment crosses the 4GB boundary, + * truncate it. + */ + if (smap.base + size > 0x100000000ull) + size = 0x100000000ull - smap.base; + + if (size > high_heap_size) { + high_heap_size = size; + high_heap_base = smap.base; + } + } + } while (v86.ebx != 0); + + /* Fall back to the old compatibility function for base memory */ + if (bios_basemem == 0) { + v86.ctl = 0; + v86.addr = 0x12; /* int 0x12 */ + v86int(); + + bios_basemem = (v86.eax & 0xffff) * 1024; + } + + /* + * Fall back through several compatibility functions for extended + * memory + */ + if (bios_extmem == 0) { + v86.ctl = V86_FLAGS; + v86.addr = 0x15; /* int 0x15 function 0xe801 */ + v86.eax = 0xe801; + v86int(); + if (!(v86.efl & 1)) { + bios_extmem = ((v86.ecx & 0xffff) + + ((v86.edx & 0xffff) * 64)) * 1024; + } + } + if (bios_extmem == 0) { + v86.ctl = 0; + v86.addr = 0x15; /* int 0x15 function 0x88 */ + v86.eax = 0x8800; + v86int(); + bios_extmem = (v86.eax & 0xffff) * 1024; + } + + /* + * If we have extended memory and did not find a suitable heap + * region in the SMAP, use the last 3MB of 'extended' memory as a + * high heap candidate. + */ + if (bios_extmem >= HEAP_MIN && high_heap_size < HEAP_MIN) { + high_heap_size = HEAP_MIN; + high_heap_base = bios_extmem + 0x100000 - HEAP_MIN; + } +} + +int +main(void) +{ + char cmd[512], cmdtmp[512]; + ssize_t sz; + int autoboot, dskupdated; + uint64_t ino; + + bios_getmem(); + + if (high_heap_size > 0) { + heap_end = PTOV(high_heap_base + high_heap_size); + heap_next = PTOV(high_heap_base); + } else { + heap_next = (char *) + (roundup2(__base + (int32_t)&_end, 0x10000) - __base); + heap_end = (char *)PTOV(bios_basemem); + } + setheap(heap_next, heap_end); + + /* Reference start_sector or linker will elliminate it. */ + if (start_sector != 0) + printf("isoboot: starting...\n"); + + v86.ctl = V86_FLAGS; + v86.efl = PSL_RESERVED_DEFAULT | PSL_I; + dsk.drive = *(uint8_t *)PTOV(ARGS); + dsk.type = dsk.drive & DRV_HARD ? TYPE_AD : TYPE_FD; + dsk.unit = dsk.drive & DRV_MASK; + dsk.part = -1; + dsk.start = 0; + bootinfo.bi_version = BOOTINFO_VERSION; + bootinfo.bi_size = sizeof (bootinfo); + bootinfo.bi_basemem = bios_basemem / 1024; + bootinfo.bi_extmem = bios_extmem / 1024; + bootinfo.bi_memsizes_valid++; + bootinfo.bi_bios_dev = dsk.drive; + + autoboot = 1; + *cmd = '\0'; + + for (;;) { + *kname = '\0'; + if ((ino = cd9660_lookup(PATH_CONFIG)) || + (ino = cd9660_lookup(PATH_DOTCONFIG))) { + sz = cd9660_fsread(ino, cmd, sizeof (cmd) - 1); + cmd[(sz < 0) ? 0 : sz] = '\0'; + } + if (*cmd != '\0') { + memcpy(cmdtmp, cmd, sizeof (cmdtmp)); + if (parse_cmds(cmdtmp, &dskupdated)) + break; + if (!OPT_CHECK(RBX_QUIET)) + printf("%s: %s", PATH_CONFIG, cmd); + *cmd = '\0'; + } + + if (autoboot && keyhit(3)) { + if (*kname == '\0') { + memcpy(kname, PATH_LOADER, + sizeof (PATH_LOADER)); + } + break; + } + autoboot = 0; + + /* + * Try to exec stage 3 boot loader. If interrupted by a + * keypress, or in case of failure, try to load a kernel + * directly instead. + */ + if (*kname != '\0') + load(); + memcpy(kname, PATH_LOADER, sizeof (PATH_LOADER)); + load(); + break; + } + + /* Present the user with the boot2 prompt. */ + + for (;;) { + if (!OPT_CHECK(RBX_QUIET)) { + printf("\nillumos/x86 boot\n"); + if (dsk.part == -1) { + printf("Default: %u:%s(%u)%s\n", + dsk.drive & DRV_MASK, dev_nm[dsk.type], + dsk.unit, kname); + } else { + printf("Default: %u:%s(%up%u)%s\n", + dsk.drive & DRV_MASK, dev_nm[dsk.type], + dsk.unit, dsk.part, kname); + } + printf("boot: "); + } + if (ioctrl & IO_SERIAL) + sio_flush(); + *cmd = '\0'; + if (keyhit(0)) + getstr(cmd, sizeof (cmd)); + else if (!OPT_CHECK(RBX_QUIET)) + putchar('\n'); + if (parse_cmds(cmd, &dskupdated)) { + putchar('\a'); + continue; + } + load(); + } + /* NOTREACHED */ +} + +/* Needed so btxld can link us properly; do not remove. */ +void +exit(int x __unused) +{ + + while (1) + ; + __unreachable(); +} + +static void +load(void) +{ + union { + struct exec ex; + Elf32_Ehdr eh; + } hdr; + static Elf32_Phdr ep[2]; + static Elf32_Shdr es[2]; + caddr_t p; + uint64_t ino; + uint32_t addr, x; + int fmt, i, j; + + if (!(ino = cd9660_lookup(kname))) { + if (!ls) { + printf("%s: No %s on %u:%s(%u", BOOTPROG, + kname, dsk.drive & DRV_MASK, dev_nm[dsk.type], + dsk.unit); + if (dsk.part != -1) + printf("p%u", dsk.part); + printf(")\n"); + } + return; + } + if (xfsread(ino, &hdr, sizeof (hdr))) + return; + if (N_GETMAGIC(hdr.ex) == ZMAGIC) + fmt = 0; + else if (IS_ELF(hdr.eh)) + fmt = 1; + else { + printf("Invalid %s\n", "format"); + return; + } + if (fmt == 0) { + addr = hdr.ex.a_entry & 0xffffff; + p = PTOV(addr); + fs_off = PAGE_SIZE; + if (xfsread(ino, p, hdr.ex.a_text)) + return; + p += roundup2(hdr.ex.a_text, PAGE_SIZE); + if (xfsread(ino, p, hdr.ex.a_data)) + return; + p += hdr.ex.a_data + roundup2(hdr.ex.a_bss, PAGE_SIZE); + bootinfo.bi_symtab = VTOP(p); + memcpy(p, &hdr.ex.a_syms, sizeof (hdr.ex.a_syms)); + p += sizeof (hdr.ex.a_syms); + if (hdr.ex.a_syms) { + if (xfsread(ino, p, hdr.ex.a_syms)) + return; + p += hdr.ex.a_syms; + if (xfsread(ino, p, sizeof (int))) + return; + x = *(uint32_t *)p; + p += sizeof (int); + x -= sizeof (int); + if (xfsread(ino, p, x)) + return; + p += x; + } + } else { + fs_off = hdr.eh.e_phoff; + for (j = i = 0; i < hdr.eh.e_phnum && j < 2; i++) { + if (xfsread(ino, ep + j, sizeof (ep[0]))) + return; + if (ep[j].p_type == PT_LOAD) + j++; + } + for (i = 0; i < 2; i++) { + p = PTOV(ep[i].p_paddr & 0xffffff); + fs_off = ep[i].p_offset; + if (xfsread(ino, p, ep[i].p_filesz)) + return; + } + p += roundup2(ep[1].p_memsz, PAGE_SIZE); + bootinfo.bi_symtab = VTOP(p); + if (hdr.eh.e_shnum == hdr.eh.e_shstrndx + 3) { + fs_off = hdr.eh.e_shoff + sizeof (es[0]) * + (hdr.eh.e_shstrndx + 1); + if (xfsread(ino, &es, sizeof (es))) + return; + for (i = 0; i < 2; i++) { + memcpy(p, &es[i].sh_size, + sizeof (es[i].sh_size)); + p += sizeof (es[i].sh_size); + fs_off = es[i].sh_offset; + if (xfsread(ino, p, es[i].sh_size)) + return; + p += es[i].sh_size; + } + } + addr = hdr.eh.e_entry & 0xffffff; + } + bootinfo.bi_esymtab = VTOP(p); + bootinfo.bi_kernelname = VTOP(kname); + bootinfo.bi_bios_dev = dsk.drive; + __exec((caddr_t)addr, RB_BOOTINFO | (opts & RBX_MASK), + MAKEBOOTDEV(dev_maj[dsk.type], 0, dsk.unit, 0), + KARGS_FLAGS_EXTARG, 0, 0, VTOP(&bootinfo)); +} + +static int +parse_cmds(char *cmdstr, int *dskupdated) +{ + char *arg; + char *ep, *p, *q; + const char *cp; + unsigned int drv; + int c, i, j; + + arg = cmdstr; + *dskupdated = 0; + while ((c = *arg++)) { + if (c == ' ' || c == '\t' || c == '\n') + continue; + for (p = arg; *p && *p != '\n' && *p != ' ' && *p != '\t'; p++) + ; + ep = p; + if (*p) + *p++ = 0; + if (c == '-') { + while ((c = *arg++)) { + if (c == 'P') { + if (*(uint8_t *)PTOV(0x496) & 0x10) { + cp = "yes"; + } else { + opts |= OPT_SET(RBX_DUAL) | + OPT_SET(RBX_SERIAL); + cp = "no"; + } + printf("Keyboard: %s\n", cp); + continue; + } else if (c == 'S') { + j = 0; + while ((unsigned int)(i = *arg++ - '0') + <= 9) + j = j * 10 + i; + if (j > 0 && i == -'0') { + comspeed = j; + break; + } + /* + * Fall through to error below + * ('S' not in optstr[]). + */ + } + for (i = 0; c != optstr[i]; i++) + if (i == NOPT - 1) + return (-1); + opts ^= OPT_SET(flags[i]); + } + ioctrl = OPT_CHECK(RBX_DUAL) ? (IO_SERIAL|IO_KEYBOARD) : + OPT_CHECK(RBX_SERIAL) ? IO_SERIAL : IO_KEYBOARD; + if (ioctrl & IO_SERIAL) { + if (sio_init(115200 / comspeed) != 0) + ioctrl &= ~IO_SERIAL; + } + } else { + for (q = arg--; *q && *q != '('; q++) + ; + if (*q) { + drv = -1; + if (arg[1] == ':') { + drv = *arg - '0'; + if (drv > 9) + return (-1); + arg += 2; + } + if (q - arg != 2) + return (-1); + for (i = 0; arg[0] != dev_nm[i][0] || + arg[1] != dev_nm[i][1]; i++) + if (i == NDEV - 1) + return (-1); + dsk.type = i; + arg += 3; + dsk.unit = *arg - '0'; + if (arg[1] != 'p' || dsk.unit > 9) + return (-1); + arg += 2; + dsk.part = *arg - '0'; + if (dsk.part < 1 || dsk.part > 9) + return (-1); + arg++; + if (arg[0] != ')') + return (-1); + arg++; + if (drv == (unsigned)-1) + drv = dsk.unit; + dsk.drive = (dsk.type <= TYPE_MAXHARD + ? DRV_HARD : 0) + drv; + *dskupdated = 1; + } + if ((i = ep - arg)) { + if ((size_t)i >= sizeof (kname)) + return (-1); + memcpy(kname, arg, i + 1); + } + } + arg = p; + } + return (0); +} diff --git a/usr/src/boot/sys/boot/i386/libi386/Makefile b/usr/src/boot/sys/boot/i386/libi386/Makefile index a5c52f2703..a17a4c72bd 100644 --- a/usr/src/boot/sys/boot/i386/libi386/Makefile +++ b/usr/src/boot/sys/boot/i386/libi386/Makefile @@ -36,20 +36,71 @@ ASFLAGS=-m32 AS_CPPFLAGS= COMPILE.s = $(AS) $(AS_FLAGS) -SRCS= biosacpi.c biosdisk.c biosmem.c biospnp.c \ - biospci.c biossmap.c bootinfo.c bootinfo32.c bootinfo64.c \ - comconsole.c cpuid.c devicename.c elf32_freebsd.c \ - elf64_freebsd.c multiboot.c multiboot_tramp.S \ - i386_copy.c i386_module.c nullconsole.c pxe.c pxetramp.s \ - smbios.c time.c vidconsole.c amd64_tramp.S spinconsole.c linux.c \ - relocater_tramp.S vgasubr.c vbe.c -OBJS= biosacpi.o biosdisk.o biosmem.o biospnp.o \ - biospci.o biossmap.o bootinfo.o bootinfo32.o bootinfo64.o \ - comconsole.o cpuid.o devicename.o elf32_freebsd.o \ - elf64_freebsd.o multiboot.o multiboot_tramp.o \ - i386_copy.o i386_module.o nullconsole.o pxe.o pxetramp.o \ - smbios.o time.o vidconsole.o amd64_tramp.o spinconsole.o linux.o \ - relocater_tramp.o vgasubr.o vbe.o +SRCS= \ + amd64_tramp.S \ + bio.c \ + biosacpi.c \ + biosdisk.c \ + biosmem.c \ + biospci.c \ + biospnp.c \ + biossmap.c \ + bootinfo.c \ + bootinfo32.c \ + bootinfo64.c \ + comconsole.c \ + cpuid.c \ + devicename.c \ + elf32_freebsd.c \ + elf64_freebsd.c \ + i386_copy.c \ + i386_module.c \ + linux.c \ + multiboot.c \ + multiboot_tramp.S \ + nullconsole.c \ + pxe.c \ + pxetramp.s \ + relocater_tramp.S \ + smbios.c \ + spinconsole.c \ + time.c \ + vbe.c \ + vgasubr.c \ + vidconsole.c + +OBJS= \ + amd64_tramp.o \ + bio.o \ + biosacpi.o \ + biosdisk.o \ + biosmem.o \ + biospci.o \ + biospnp.o \ + biossmap.o \ + bootinfo.o \ + bootinfo32.o \ + bootinfo64.o \ + comconsole.o \ + cpuid.o \ + devicename.o \ + elf32_freebsd.o \ + elf64_freebsd.o \ + i386_copy.o \ + i386_module.o \ + linux.o \ + multiboot.o \ + multiboot_tramp.o \ + nullconsole.o \ + pxe.o \ + pxetramp.o \ + relocater_tramp.o \ + smbios.o \ + spinconsole.o \ + time.o \ + vbe.o \ + vgasubr.o \ + vidconsole.o COMMON= ../../common PNGLITE=$(SRC)/common/pnglite @@ -57,7 +108,6 @@ VGASUBR=$(SRC)/common/vga CPPFLAGS += -I$(PNGLITE) SRCS += $(COMMON)/gfx_fb.c $(PNGLITE)/pnglite.c OBJS += gfx_fb.o pnglite.o - LIBZFS= ../../zfs SRCS += $(LIBZFS)/devicename_stubs.c OBJS += devicename_stubs.o diff --git a/usr/src/boot/sys/boot/i386/libi386/bio.c b/usr/src/boot/sys/boot/i386/libi386/bio.c new file mode 100644 index 0000000000..9b72e606eb --- /dev/null +++ b/usr/src/boot/sys/boot/i386/libi386/bio.c @@ -0,0 +1,66 @@ +/* + * Copyright 2018 Toomas Soome <tsoome@me.com> + * + * 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 AUTHOR 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 AUTHOR 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 <sys/cdefs.h> +#include <stand.h> +#include <libi386.h> + +/* + * The idea is borrowed from pxe.c and zfsimpl.c. The original buffer + * space in pxe.c was 2x 0x2000. Allocating it from BSS will give us needed + * memory below 1MB and usable for real mode calls. + * + * Note the allocations and frees are to be done in reverse order (LIFO). + */ + +#define BIO_BUFFER_SIZE 0x4000 +static char bio_buffer[BIO_BUFFER_SIZE]; +static char *bio_buffer_end = bio_buffer + BIO_BUFFER_SIZE; +static char *bio_buffer_ptr = bio_buffer; + +void * +bio_alloc(size_t size) +{ + char *ptr; + + ptr = bio_buffer_ptr; + if (ptr + size > bio_buffer_end) + return (NULL); + bio_buffer_ptr += size; + + return (ptr); +} + +void +bio_free(void *ptr, size_t size) +{ + + if (ptr == NULL) + return; + + bio_buffer_ptr -= size; + if (bio_buffer_ptr != ptr) + panic("bio_alloc()/bio_free() mismatch\n"); +} diff --git a/usr/src/boot/sys/boot/i386/libi386/biosdisk.c b/usr/src/boot/sys/boot/i386/libi386/biosdisk.c index 68378ef2b2..608310f97d 100644 --- a/usr/src/boot/sys/boot/i386/libi386/biosdisk.c +++ b/usr/src/boot/sys/boot/i386/libi386/biosdisk.c @@ -135,6 +135,8 @@ static int bd_ioctl(struct open_file *f, u_long cmd, void *data); static int bd_print(int verbose); static int cd_print(int verbose); static int fd_print(int verbose); +static void bd_reset_disk(int); +static int bd_get_diskinfo_std(struct bdinfo *); struct devsw biosfd = { .dv_name = "fd", @@ -251,20 +253,52 @@ bd_unit2bios(struct i386_devdesc *dev) } /* + * Use INT13 AH=15 - Read Drive Type. + */ +static int +fd_count(void) +{ + int drive; + + bd_reset_disk(0); + + for (drive = 0; drive < MAXBDDEV; drive++) { + v86.ctl = V86_FLAGS; + v86.addr = 0x13; + v86.eax = 0x1500; + v86.edx = drive; + v86int(); + + if (V86_CY(v86.efl)) + break; + + if ((v86.eax & 0x300) == 0) + break; + } + + return (drive); +} + +/* * Quiz the BIOS for disk devices, save a little info about them. */ static int fd_init(void) { - int unit; + int unit, numfd; bdinfo_t *bd; - for (unit = 0; unit < MAXBDDEV; unit++) { + numfd = fd_count(); + for (unit = 0; unit < numfd; unit++) { if ((bd = calloc(1, sizeof (*bd))) == NULL) break; + + bd->bd_sectorsize = BIOSDISK_SECSIZE; bd->bd_flags = BD_FLOPPY; bd->bd_unit = unit; - if (!bd_int13probe(bd)) { + + /* Use std diskinfo for floppy drive */ + if (bd_get_diskinfo_std(bd) != 0) { free(bd); break; } @@ -381,6 +415,10 @@ bc_add(int biosdev) static int bd_check_extensions(int unit) { + /* do not use ext calls for floppy devices */ + if (unit < 0x80) + return (0); + /* Determine if we can use EDD with this device. */ v86.ctl = V86_FLAGS; v86.addr = 0x13; @@ -468,10 +506,10 @@ bd_get_diskinfo_ext(struct bdinfo *bd) * Sector size must be a multiple of 512 bytes. * An alternate test would be to check power of 2, * powerof2(params.sector_size). - * 4K is largest read buffer we can use at this time. + * 16K is largest read buffer we can use at this time. */ if (params.sector_size >= 512 && - params.sector_size <= 4096 && + params.sector_size <= 16384 && (params.sector_size % BIOSDISK_SECSIZE) == 0) bd->bd_sectorsize = params.sector_size; @@ -860,8 +898,8 @@ bd_realstrategy(void *devdata, int rw, daddr_t dblk, size_t size, struct disk_devdesc *dev = (struct disk_devdesc *)devdata; bdinfo_t *bd; uint64_t disk_blocks, offset, d_offset; - size_t blks, blkoff, bsize, rest; - caddr_t bbuf; + size_t blks, blkoff, bsize, bio_size, rest; + caddr_t bbuf = NULL; int rc; bd = bd_get_bdinfo(&dev->dd); @@ -936,14 +974,25 @@ bd_realstrategy(void *devdata, int rw, daddr_t dblk, size_t size, DEBUG("short I/O %d", blks); } - if (V86_IO_BUFFER_SIZE / bd->bd_sectorsize == 0) - panic("BUG: Real mode buffer is too small\n"); + bio_size = min(BIO_BUFFER_SIZE, size); + while (bio_size > bd->bd_sectorsize) { + bbuf = bio_alloc(bio_size); + if (bbuf != NULL) + break; + bio_size -= bd->bd_sectorsize; + } + if (bbuf == NULL) { + bio_size = V86_IO_BUFFER_SIZE; + if (bio_size / bd->bd_sectorsize == 0) + panic("BUG: Real mode buffer is too small\n"); - bbuf = PTOV(V86_IO_BUFFER); + /* Use alternate 4k buffer */ + bbuf = PTOV(V86_IO_BUFFER); + } rest = size; - + rc = 0; while (blks > 0) { - int x = min(blks, V86_IO_BUFFER_SIZE / bd->bd_sectorsize); + int x = min(blks, bio_size / bd->bd_sectorsize); switch (rw & F_MASK) { case F_READ: @@ -952,8 +1001,10 @@ bd_realstrategy(void *devdata, int rw, daddr_t dblk, size_t size, if (rest < bsize) bsize = rest; - if ((rc = bd_io(dev, bd, dblk, x, bbuf, BD_RD)) != 0) - return (EIO); + if ((rc = bd_io(dev, bd, dblk, x, bbuf, BD_RD)) != 0) { + rc = EIO; + goto error; + } bcopy(bbuf + blkoff, buf, bsize); break; @@ -985,13 +1036,15 @@ bd_realstrategy(void *devdata, int rw, daddr_t dblk, size_t size, * Put your Data In, and shake it all about */ bcopy(buf, bbuf + blkoff, bsize); - if ((rc = bd_io(dev, bd, dblk, x, bbuf, BD_WR)) != 0) - return (EIO); - + if ((rc = bd_io(dev, bd, dblk, x, bbuf, BD_WR)) != 0) { + rc = EIO; + goto error; + } break; default: /* DO NOTHING */ - return (EROFS); + rc = EROFS; + goto error; } blkoff = 0; @@ -1003,7 +1056,10 @@ bd_realstrategy(void *devdata, int rw, daddr_t dblk, size_t size, if (rsize != NULL) *rsize = size; - return (0); +error: + if (bbuf != PTOV(V86_IO_BUFFER)) + bio_free(bbuf, bio_size); + return (rc); } static int diff --git a/usr/src/boot/sys/boot/i386/libi386/libi386.h b/usr/src/boot/sys/boot/i386/libi386/libi386.h index 9b4defb084..3f769ee688 100644 --- a/usr/src/boot/sys/boot/i386/libi386/libi386.h +++ b/usr/src/boot/sys/boot/i386/libi386/libi386.h @@ -1,4 +1,4 @@ -/*- +/* * Copyright (c) 1998 Michael Smith <msmith@freebsd.org> * All rights reserved. * @@ -22,7 +22,6 @@ * 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. - * */ #ifndef _LIBI386_H @@ -119,6 +118,11 @@ extern vm_offset_t memtop_copyin; /* memtop less heap size for the cases */ extern uint32_t high_heap_size; /* extended memory region available */ extern vm_offset_t high_heap_base; /* for use as the heap */ +/* 16KB buffer space for real mode data transfers. */ +#define BIO_BUFFER_SIZE 0x4000 +void *bio_alloc(size_t size); +void bio_free(void *ptr, size_t size); + void biospci_detect(void); int biospci_find_devclass(uint32_t class, int index, uint32_t *locator); int biospci_read_config(uint32_t locator, int offset, int width, uint32_t *val); diff --git a/usr/src/boot/sys/boot/i386/libi386/pxe.c b/usr/src/boot/sys/boot/i386/libi386/pxe.c index 074898b80b..693596559d 100644 --- a/usr/src/boot/sys/boot/i386/libi386/pxe.c +++ b/usr/src/boot/sys/boot/i386/libi386/pxe.c @@ -47,29 +47,21 @@ #include <bootp.h> #include <bootstrap.h> +#include "libi386.h" #include "btxv86.h" #include "pxe.h" -/* - * Allocate the PXE buffers statically instead of sticking grimy fingers into - * BTX's private data area. The scratch buffer is used to send information to - * the PXE BIOS, and the data buffer is used to receive data from the PXE BIOS. - */ -#define PXE_BUFFER_SIZE 0x2000 -static char scratch_buffer[PXE_BUFFER_SIZE]; -static char data_buffer[PXE_BUFFER_SIZE]; - static pxenv_t *pxenv_p = NULL; /* PXENV+ */ static pxe_t *pxe_p = NULL; /* !PXE */ #ifdef PXE_DEBUG -static int pxe_debug = 0; +static int pxe_debug = 0; #endif void pxe_enable(void *pxeinfo); -static void (*pxe_call)(int func); -static void pxenv_call(int func); -static void bangpxe_call(int func); +static void (*pxe_call)(int func, void *ptr); +static void pxenv_call(int func, void *ptr); +static void bangpxe_call(int func, void *ptr); static int pxe_init(void); static int pxe_print(int verbose); @@ -119,9 +111,9 @@ struct devsw pxedisk = { .dv_name = "net", .dv_type = DEVT_NET, .dv_init = pxe_init, - .dv_strategy = NULL, /* Will be set in pxe_init */ - .dv_open = NULL, /* Will be set in pxe_init */ - .dv_close = NULL, /* Will be set in pxe_init */ + .dv_strategy = NULL, /* Will be set in pxe_init */ + .dv_open = NULL, /* Will be set in pxe_init */ + .dv_close = NULL, /* Will be set in pxe_init */ .dv_ioctl = noioctl, .dv_print = pxe_print, .dv_cleanup = pxe_cleanup @@ -226,12 +218,17 @@ pxe_init(void) pxenv_p->RMEntry.segment, pxenv_p->RMEntry.offset); } - gci_p = (t_PXENV_GET_CACHED_INFO *) scratch_buffer; + gci_p = bio_alloc(sizeof(*gci_p)); + if (gci_p == NULL) { + pxe_p = NULL; + return (0); + } bzero(gci_p, sizeof (*gci_p)); gci_p->PacketType = PXENV_PACKET_TYPE_BINL_REPLY; - pxe_call(PXENV_GET_CACHED_INFO); + pxe_call(PXENV_GET_CACHED_INFO, gci_p); if (gci_p->Status != 0) { pxe_perror(gci_p->Status); + bio_free(gci_p, sizeof (*gci_p)); pxe_p = NULL; return (0); } @@ -243,6 +240,7 @@ pxe_init(void) bootp_response, bootp_response_size); } + bio_free(gci_p, sizeof (*gci_p)); return (1); } @@ -265,31 +263,37 @@ pxe_print(int verbose) static void pxe_cleanup(void) { -#ifdef PXE_DEBUG - t_PXENV_UNLOAD_STACK *unload_stack_p = - (t_PXENV_UNLOAD_STACK *)scratch_buffer; - t_PXENV_UNDI_SHUTDOWN *undi_shutdown_p = - (t_PXENV_UNDI_SHUTDOWN *)scratch_buffer; -#endif + t_PXENV_UNLOAD_STACK *unload_stack_p; + t_PXENV_UNDI_SHUTDOWN *undi_shutdown_p; if (pxe_call == NULL) return; - pxe_call(PXENV_UNDI_SHUTDOWN); + undi_shutdown_p = bio_alloc(sizeof(*undi_shutdown_p)); + if (undi_shutdown_p != NULL) { + bzero(undi_shutdown_p, sizeof (*undi_shutdown_p)); + pxe_call(PXENV_UNDI_SHUTDOWN, undi_shutdown_p); #ifdef PXE_DEBUG - if (pxe_debug && undi_shutdown_p->Status != 0) - printf("pxe_cleanup: UNDI_SHUTDOWN failed %x\n", - undi_shutdown_p->Status); + if (pxe_debug && undi_shutdown_p->Status != 0) + printf("pxe_cleanup: UNDI_SHUTDOWN failed %x\n", + undi_shutdown_p->Status); #endif + bio_free(undi_shutdown_p, sizeof (*undi_shutdown_p)); + } - pxe_call(PXENV_UNLOAD_STACK); + unload_stack_p = bio_alloc(sizeof(*unload_stack_p)); + if (unload_stack_p != NULL) { + bzero(unload_stack_p, sizeof (*unload_stack_p)); + pxe_call(PXENV_UNLOAD_STACK, unload_stack_p); #ifdef PXE_DEBUG - if (pxe_debug && unload_stack_p->Status != 0) - printf("pxe_cleanup: UNLOAD_STACK failed %x\n", - unload_stack_p->Status); + if (pxe_debug && unload_stack_p->Status != 0) + printf("pxe_cleanup: UNLOAD_STACK failed %x\n", + unload_stack_p->Status); #endif + bio_free(unload_stack_p, sizeof (*unload_stack_p)); + } } void @@ -298,7 +302,7 @@ pxe_perror(int err) } void -pxenv_call(int func) +pxenv_call(int func, void *ptr) { #ifdef PXE_DEBUG if (pxe_debug) @@ -306,14 +310,13 @@ pxenv_call(int func) #endif bzero(&v86, sizeof (v86)); - bzero(data_buffer, sizeof (data_buffer)); __pxenvseg = pxenv_p->RMEntry.segment; __pxenvoff = pxenv_p->RMEntry.offset; v86.ctl = V86_ADDR | V86_CALLF | V86_FLAGS; - v86.es = VTOPSEG(scratch_buffer); - v86.edi = VTOPOFF(scratch_buffer); + v86.es = VTOPSEG(ptr); + v86.edi = VTOPOFF(ptr); v86.addr = (VTOPSEG(__pxenventry) << 16) | VTOPOFF(__pxenventry); v86.ebx = func; v86int(); @@ -321,7 +324,7 @@ pxenv_call(int func) } void -bangpxe_call(int func) +bangpxe_call(int func, void *ptr) { #ifdef PXE_DEBUG if (pxe_debug) @@ -329,14 +332,13 @@ bangpxe_call(int func) #endif bzero(&v86, sizeof (v86)); - bzero(data_buffer, sizeof (data_buffer)); __bangpxeseg = pxe_p->EntryPointSP.segment; __bangpxeoff = pxe_p->EntryPointSP.offset; v86.ctl = V86_ADDR | V86_CALLF | V86_FLAGS; - v86.edx = VTOPSEG(scratch_buffer); - v86.eax = VTOPOFF(scratch_buffer); + v86.edx = VTOPSEG(ptr); + v86.eax = VTOPOFF(ptr); v86.addr = (VTOPSEG(__bangpxeentry) << 16) | VTOPOFF(__bangpxeentry); v86.ebx = func; v86int(); @@ -365,11 +367,14 @@ pxe_netif_end(struct netif *nif) { t_PXENV_UNDI_CLOSE *undi_close_p; - undi_close_p = (t_PXENV_UNDI_CLOSE *)scratch_buffer; - bzero(undi_close_p, sizeof (*undi_close_p)); - pxe_call(PXENV_UNDI_CLOSE); - if (undi_close_p->Status != 0) - printf("undi close failed: %x\n", undi_close_p->Status); + undi_close_p = bio_alloc(sizeof (*undi_close_p)); + if (undi_close_p != NULL) { + bzero(undi_close_p, sizeof (*undi_close_p)); + pxe_call(PXENV_UNDI_CLOSE, undi_close_p); + if (undi_close_p->Status != 0) + printf("undi close failed: %x\n", undi_close_p->Status); + bio_free(undi_close_p, sizeof (*undi_close_p)); + } } static void @@ -380,11 +385,15 @@ pxe_netif_init(struct iodesc *desc, void *machdep_hint) uint8_t *mac; int i, len; - undi_info_p = (t_PXENV_UNDI_GET_INFORMATION *)scratch_buffer; + undi_info_p = bio_alloc(sizeof (*undi_info_p)); + if (undi_info_p == NULL) + return; + bzero(undi_info_p, sizeof (*undi_info_p)); - pxe_call(PXENV_UNDI_GET_INFORMATION); + pxe_call(PXENV_UNDI_GET_INFORMATION, undi_info_p); if (undi_info_p->Status != 0) { printf("undi get info failed: %x\n", undi_info_p->Status); + bio_free(undi_info_p, sizeof (*undi_info_p)); return; } @@ -414,12 +423,16 @@ pxe_netif_init(struct iodesc *desc, void *machdep_hint) else desc->xid = 0; - undi_open_p = (t_PXENV_UNDI_OPEN *)scratch_buffer; + bio_free(undi_info_p, sizeof(*undi_info_p)); + undi_open_p = bio_alloc(sizeof (*undi_open_p)); + if (undi_open_p == NULL) + return; bzero(undi_open_p, sizeof (*undi_open_p)); undi_open_p->PktFilter = FLTR_DIRECTED | FLTR_BRDCST; - pxe_call(PXENV_UNDI_OPEN); + pxe_call(PXENV_UNDI_OPEN, undi_open_p); if (undi_open_p->Status != 0) printf("undi open failed: %x\n", undi_open_p->Status); + bio_free(undi_open_p, sizeof (*undi_open_p)); } static int @@ -429,34 +442,43 @@ pxe_netif_receive(void **pkt) char *buf, *ptr, *frame; size_t size, rsize; - isr = (t_PXENV_UNDI_ISR *)scratch_buffer; - bzero(isr, sizeof (*isr)); + isr = bio_alloc(sizeof (*isr)); + if (isr == NULL) + return (-1); + bzero(isr, sizeof (*isr)); isr->FuncFlag = PXENV_UNDI_ISR_IN_START; - pxe_call(PXENV_UNDI_ISR); - if (isr->Status != 0) + pxe_call(PXENV_UNDI_ISR, isr); + if (isr->Status != 0) { + bio_free(isr, sizeof (*isr)); return (-1); + } bzero(isr, sizeof (*isr)); isr->FuncFlag = PXENV_UNDI_ISR_IN_PROCESS; - pxe_call(PXENV_UNDI_ISR); - if (isr->Status != 0) + pxe_call(PXENV_UNDI_ISR, isr); + if (isr->Status != 0) { + bio_free(isr, sizeof (*isr)); return (-1); + } while (isr->FuncFlag != PXENV_UNDI_ISR_OUT_RECEIVE) { if (isr->Status != 0 || isr->FuncFlag == PXENV_UNDI_ISR_OUT_DONE) { + bio_free(isr, sizeof (*isr)); return (-1); } bzero(isr, sizeof (*isr)); isr->FuncFlag = PXENV_UNDI_ISR_IN_GET_NEXT; - pxe_call(PXENV_UNDI_ISR); + pxe_call(PXENV_UNDI_ISR, isr); } size = isr->FrameLength; buf = malloc(size + ETHER_ALIGN); - if (buf == NULL) + if (buf == NULL) { + bio_free(isr, sizeof (*isr)); return (-1); + } ptr = buf + ETHER_ALIGN; rsize = 0; @@ -469,8 +491,9 @@ pxe_netif_receive(void **pkt) bzero(isr, sizeof (*isr)); isr->FuncFlag = PXENV_UNDI_ISR_IN_GET_NEXT; - pxe_call(PXENV_UNDI_ISR); + pxe_call(PXENV_UNDI_ISR, isr); if (isr->Status != 0) { + bio_free(isr, sizeof (*isr)); free(buf); return (-1); } @@ -482,6 +505,7 @@ pxe_netif_receive(void **pkt) } *pkt = buf; + bio_free(isr, sizeof (*isr)); return (rsize); } @@ -509,32 +533,31 @@ pxe_netif_put(struct iodesc *desc, void *pkt, size_t len) t_PXENV_UNDI_TRANSMIT *trans_p; t_PXENV_UNDI_TBD *tbd_p; char *data; - size_t datasz; + ssize_t rv = -1; - trans_p = (t_PXENV_UNDI_TRANSMIT *)scratch_buffer; - datasz = sizeof (*trans_p); - tbd_p = (t_PXENV_UNDI_TBD *)(scratch_buffer + datasz); - datasz += sizeof (*tbd_p); - bzero(scratch_buffer, datasz); + trans_p = bio_alloc(sizeof (*trans_p)); + tbd_p = bio_alloc(sizeof (*tbd_p)); + data = bio_alloc(len); - data = scratch_buffer + datasz; - datasz = sizeof (scratch_buffer) - datasz; + if (trans_p != NULL && tbd_p != NULL && data != NULL) { + bzero(trans_p, sizeof (*trans_p)); + bzero(tbd_p, sizeof (*tbd_p)); - if (len > datasz) - return (-1); + trans_p->TBD.segment = VTOPSEG(tbd_p); + trans_p->TBD.offset = VTOPOFF(tbd_p); - trans_p->TBD.segment = VTOPSEG(tbd_p); - trans_p->TBD.offset = VTOPOFF(tbd_p); + tbd_p->ImmedLength = len; + tbd_p->Xmit.segment = VTOPSEG(data); + tbd_p->Xmit.offset = VTOPOFF(data); + bcopy(pkt, data, len); - tbd_p->ImmedLength = len; - tbd_p->Xmit.segment = VTOPSEG(data); - tbd_p->Xmit.offset = VTOPOFF(data); - bcopy(pkt, data, len); - - pxe_call(PXENV_UNDI_TRANSMIT); - if (trans_p->Status != 0) { - return (-1); + pxe_call(PXENV_UNDI_TRANSMIT, trans_p); + if (trans_p->Status == 0) + rv = len; } - return (len); + bio_free(data, len); + bio_free(tbd_p, sizeof (*tbd_p)); + bio_free(trans_p, sizeof (*trans_p)); + return (rv); } diff --git a/usr/src/boot/sys/boot/i386/libi386/vbe.c b/usr/src/boot/sys/boot/i386/libi386/vbe.c index 7b7bad9e57..9908bfc209 100644 --- a/usr/src/boot/sys/boot/i386/libi386/vbe.c +++ b/usr/src/boot/sys/boot/i386/libi386/vbe.c @@ -43,9 +43,9 @@ multiboot_tag_vbe_t vbestate; static struct vbeinfoblock *vbe = - (struct vbeinfoblock *) &vbestate.vbe_control_info; + (struct vbeinfoblock *)&vbestate.vbe_control_info; static struct modeinfoblock *vbe_mode = - (struct modeinfoblock *) &vbestate.vbe_mode_info; + (struct modeinfoblock *)&vbestate.vbe_mode_info; multiboot_color_t cmap[16]; /* Actually assuming mode 3. */ @@ -199,17 +199,17 @@ static int vbe_mode_is_supported(struct modeinfoblock *mi) { if ((mi->ModeAttributes & 0x01) == 0) - return 0; /* mode not supported by hardware */ + return (0); /* mode not supported by hardware */ if ((mi->ModeAttributes & 0x08) == 0) - return 0; /* linear fb not available */ + return (0); /* linear fb not available */ if ((mi->ModeAttributes & 0x10) == 0) - return 0; /* text mode */ + return (0); /* text mode */ if (mi->NumberOfPlanes != 1) - return 0; /* planar mode not supported */ + return (0); /* planar mode not supported */ if (mi->MemoryModel != 0x04 /* Packed pixel */ && mi->MemoryModel != 0x06 /* Direct Color */) - return 0; /* unsupported pixel format */ - return 1; + return (0); /* unsupported pixel format */ + return (1); } static int @@ -238,7 +238,7 @@ vbe_init(void) gfx_fb.framebuffer_common.framebuffer_pitch = TEXT_COLS * 2; /* Now check if we have vesa. */ - memset(vbe, 0, sizeof(*vbe)); + memset(vbe, 0, sizeof (*vbe)); memcpy(vbe->VbeSignature, "VBE2", 4); if (biosvbe_info(vbe) != VBE_SUCCESS) return; @@ -254,7 +254,7 @@ vbe_init(void) int vbe_available(void) { - return vbestate.mb_type; + return (vbestate.mb_type); } int @@ -289,7 +289,7 @@ vbe_set_palette(const struct paletteentry *entry, size_t slot) int vbe_get_mode(void) { - return vbestate.vbe_mode; + return (vbestate.vbe_mode); } int @@ -393,7 +393,7 @@ vbe_set_mode(int modenum) static void * vbe_farptr(uint32_t farptr) { - return PTOV((((farptr & 0xffff0000) >> 12) + (farptr & 0xffff))); + return (PTOV((((farptr & 0xffff0000) >> 12) + (farptr & 0xffff)))); } /* @@ -408,7 +408,7 @@ vbe_find_mode_xydm(int x, int y, int depth, int m) uint16_t mode; int safety = 0, i; - memset(vbe, 0, sizeof(vbe)); + memset(vbe, 0, sizeof (vbe)); memcpy(vbe->VbeSignature, "VBE2", 4); if (biosvbe_info(vbe) != VBE_SUCCESS) return (0); @@ -430,7 +430,7 @@ vbe_find_mode_xydm(int x, int y, int depth, int m) safety++; farptr += 2; if (safety == 100) - return 0; + return (0); if (biosvbe_get_mode_info(mode, &mi) != VBE_SUCCESS) { continue; } @@ -449,7 +449,7 @@ vbe_find_mode_xydm(int x, int y, int depth, int m) if (mi.XResolution == x && mi.YResolution == y && mi.BitsPerPixel == i) - return mode; + return (mode); } if (depth != -1) break; @@ -535,7 +535,7 @@ vbe_print_vbe_info(struct vbeinfoblock *vbep) if (vbep->OemSoftwareRev != 0) { printf("OEM Version %d.%d, %s (%s, %s)\n", vbep->OemSoftwareRev >> 8, vbep->OemSoftwareRev & 0xF, - oemvendor, oemproductname, oemproductrev); + oemvendor, oemproductname, oemproductrev); } } @@ -567,7 +567,7 @@ vbe_modelist(int depth) printf(": no EDID information\n"); } - memset(vbe, 0, sizeof(vbe)); + memset(vbe, 0, sizeof (vbe)); memcpy(vbe->VbeSignature, "VBE2", 4); if (biosvbe_info(vbe) != VBE_SUCCESS) goto done; @@ -622,7 +622,7 @@ vbe_print_mode(void) int mode, i, rc; struct paletteentry pe; - memset(vbe, 0, sizeof(vbe)); + memset(vbe, 0, sizeof (vbe)); memcpy(vbe->VbeSignature, "VBE2", 4); if (biosvbe_info(vbe) != VBE_SUCCESS) return; @@ -651,11 +651,11 @@ vbe_print_mode(void) gfx_fb.framebuffer_common.framebuffer_width, gfx_fb.framebuffer_common.framebuffer_height, gfx_fb.framebuffer_common.framebuffer_bpp, - (gfx_fb.framebuffer_common.framebuffer_pitch << 3) / + (gfx_fb.framebuffer_common.framebuffer_pitch << 3) / gfx_fb.framebuffer_common.framebuffer_bpp); printf("\n frame buffer: address=%jx, size=%jx", - (uintmax_t) gfx_fb.framebuffer_common.framebuffer_addr, - (uintmax_t) gfx_fb.framebuffer_common.framebuffer_height * + (uintmax_t)gfx_fb.framebuffer_common.framebuffer_addr, + (uintmax_t)gfx_fb.framebuffer_common.framebuffer_height * gfx_fb.framebuffer_common.framebuffer_pitch); if (vbe_mode->MemoryModel == 0x6) { @@ -784,6 +784,8 @@ command_vesa(int argc, char *argv[]) } else if (strchr(argv[2], 'x') != NULL) { modenum = vbe_find_mode(argv[2]); } + } else { + goto usage; } if (modenum == 0) { diff --git a/usr/src/boot/sys/boot/i386/loader/Makefile b/usr/src/boot/sys/boot/i386/loader/Makefile index 84eb91bfde..b9d3705a00 100644 --- a/usr/src/boot/sys/boot/i386/loader/Makefile +++ b/usr/src/boot/sys/boot/i386/loader/Makefile @@ -98,6 +98,7 @@ LDFLAGS= -static -Ttext 0x0 # i386 standalone support library CPPFLAGS += -I.. -I../../../../lib/libstand LIBSTAND= ../../libstand/$(MACH)/libstand.a +LIBCRYPTO= ../../libcrypto/$(MACH)/libcrypto.a # BTX components CPPFLAGS += -I../btx/lib @@ -135,8 +136,8 @@ FORTH += menu.rc # XXX crt0.o needs to be first for pxeboot(8) to work -DPADD= ${LIBFICL} ${LIBZFSBOOT} ${LIBI386} ${LIBSTAND} -LDADD= ${LIBFICL} ${LIBZFSBOOT} ${LIBI386} ${LIBSTAND} +DPADD= ${LIBFICL} ${LIBZFSBOOT} ${LIBI386} ${LIBCRYPTO} ${LIBSTAND} +LDADD= ${LIBFICL} ${LIBZFSBOOT} ${LIBI386} ${LIBCRYPTO} ${LIBSTAND} CLEANFILES += machine x86 diff --git a/usr/src/boot/sys/boot/libcrypto/Makefile b/usr/src/boot/sys/boot/libcrypto/Makefile new file mode 100644 index 0000000000..482bfd2b4d --- /dev/null +++ b/usr/src/boot/sys/boot/libcrypto/Makefile @@ -0,0 +1,34 @@ +# +# 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 2016 Toomas Soome <tsoome@me.com> +# + +.KEEP_STATE: + +include $(SRC)/Makefile.master + +SUBDIRS = $(MACH) $(MACH64) + +all := TARGET = all +clean := TARGET = clean +clobber := TARGET = clobber +install := TARGET = install + +all clean clobber: $(SUBDIRS) + +install: all + +$(SUBDIRS): FRC + @cd $@; pwd; $(MAKE) $(MFLAGS) $(TARGET) + +FRC: diff --git a/usr/src/boot/sys/boot/libcrypto/Makefile.com b/usr/src/boot/sys/boot/libcrypto/Makefile.com new file mode 100644 index 0000000000..8776128ed5 --- /dev/null +++ b/usr/src/boot/sys/boot/libcrypto/Makefile.com @@ -0,0 +1,71 @@ +# +# 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 2016 Toomas Soome <tsoome@me.com> +# + +include $(SRC)/Makefile.master + +CC= $(GCC_ROOT)/bin/gcc + +COMDIR = ../../../../../common/crypto + +install: + +SRCS += sha1.c digest.c +OBJS += sha1.o digest.o + +CFLAGS = -Os +CFLAGS += -fPIC -ffreestanding -msoft-float +CFLAGS += -mno-mmx -mno-3dnow -mno-sse2 -mno-sse3 -mno-sse +CFLAGS += -mno-avx -mno-aes -std=gnu99 + +#.if ${MACHINE_CPUARCH} == "aarch64" +#CFLAGS+= -msoft-float -mgeneral-regs-only +#.endif + +CPPFLAGS = -nostdinc -I. -I../../../../include -I../../.. +CPPFLAGS += -I../../../../lib/libstand + +# Pick up the bootstrap header for some interface items +CPPFLAGS += -I../../common +CPPFLAGS += -D_STANDALONE + +# For multiboot2.h, must be last, to avoid conflicts +CPPFLAGS += -I$(SRC)/uts/common + +libcrypto.a: $(OBJS) + $(AR) $(ARFLAGS) $@ $(OBJS) + +clean: clobber +clobber: + $(RM) $(CLEANFILES) $(OBJS) libcrypto.a + +machine: + $(RM) machine + $(SYMLINK) ../../../${MACHINE}/include machine + +x86: + $(RM) x86 + $(SYMLINK) ../../../x86/include x86 + +%.o: ../%.c + $(COMPILE.c) $< + +%.o: ../../../../../common/crypto/sha1/%.c + $(COMPILE.c) $< + +sha1-x86_64.s: $(COMDIR)/sha1/amd64/sha1-x86_64.pl + $(PERL) $? $@ + +sha1-x86_64.o: sha1-x86_64.s + $(COMPILE.s) -o $@ ${@F:.o=.s} diff --git a/usr/src/boot/sys/boot/libcrypto/amd64/Makefile b/usr/src/boot/sys/boot/libcrypto/amd64/Makefile new file mode 100644 index 0000000000..f3c2b2e5df --- /dev/null +++ b/usr/src/boot/sys/boot/libcrypto/amd64/Makefile @@ -0,0 +1,31 @@ +# +# 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 2016 Toomas Soome <tsoome@me.com> +# + +COMDIR= $(SRC)/common/crypto +MACHINE= $(MACH64) +AS= $(AS_amd64_64) + +all: libcrypto.a + +SRCS = sha1-x86_64.s +OBJS = sha1-x86_64.o + +include ../Makefile.com +ASFLAGS = $(amd64_AS_XARCH) -I$(SRC)/uts/common -D_ASM + +CFLAGS += -m64 +CLEANFILES += machine x86 sha1-x86_64.s + +$(OBJS): machine x86 diff --git a/usr/src/boot/sys/boot/libcrypto/digest.c b/usr/src/boot/sys/boot/libcrypto/digest.c new file mode 100644 index 0000000000..f3b37b7cb7 --- /dev/null +++ b/usr/src/boot/sys/boot/libcrypto/digest.c @@ -0,0 +1,48 @@ + +#include <sys/cdefs.h> +#include <stdbool.h> +#include <stand.h> +#include <sys/sha1.h> + +#include <bootstrap.h> + +bool +sha1(void *data, size_t size, uint8_t *result) +{ + SHA1_CTX sha1_ctx; + + SHA1Init(&sha1_ctx); + SHA1Update(&sha1_ctx, data, size); + SHA1Final(result, &sha1_ctx); + + return (true); +} + +static int +command_sha1(int argc, char **argv) +{ + void *ptr; + size_t size, i; + uint8_t resultbuf[SHA1_DIGEST_LENGTH]; + + /* + * usage: address size + */ + if (argc != 3) { + command_errmsg = "usage: address size"; + return (CMD_ERROR); + } + + ptr = (void *)(uintptr_t)strtol(argv[1], NULL, 0); + size = strtol(argv[2], NULL, 0); + + if (sha1(ptr, size, resultbuf) == false) + return (CMD_OK); + + for (i = 0; i < SHA1_DIGEST_LENGTH; i++) + printf("%02x", resultbuf[i]); + printf("\n"); + return (CMD_OK); +} + +COMMAND_SET(sha1, "sha1", "print the sha1 checksum", command_sha1); diff --git a/usr/src/boot/sys/boot/libcrypto/i386/Makefile b/usr/src/boot/sys/boot/libcrypto/i386/Makefile new file mode 100644 index 0000000000..64630eaeef --- /dev/null +++ b/usr/src/boot/sys/boot/libcrypto/i386/Makefile @@ -0,0 +1,27 @@ +# +# 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 2016 Toomas Soome <tsoome@me.com> +# + +MACHINE= $(MACH) +ASFLAGS= -m32 + +all: libcrypto.a + +include ../Makefile.com + +CFLAGS += -m32 + +CLEANFILES += machine x86 + +$(OBJS): machine x86 diff --git a/usr/src/cmd/tic/Makefile.common b/usr/src/cmd/tic/Makefile.common index c9c53005af..354ef9e8c3 100644 --- a/usr/src/cmd/tic/Makefile.common +++ b/usr/src/cmd/tic/Makefile.common @@ -24,6 +24,7 @@ # Use is subject to license terms. # Copyright 2017 Nexenta Systems, Inc. # +# Copyright (c) 2018, Joyent, Inc. PROG= tic OBJS= tic_captab.o \ @@ -45,3 +46,6 @@ CERRWARN += -_gcc=-Wno-char-subscripts CERRWARN += -_gcc=-Wno-implicit-function-declaration CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-uninitialized + +# not linted +SMATCH=off diff --git a/usr/src/cmd/vtfontcvt/Makefile.common b/usr/src/cmd/vtfontcvt/Makefile.common index f951eef71b..9b9924ba5a 100644 --- a/usr/src/cmd/vtfontcvt/Makefile.common +++ b/usr/src/cmd/vtfontcvt/Makefile.common @@ -12,6 +12,7 @@ # # Copyright 2017 Toomas Soome <tsoome@me.com> # +# Copyright (c) 2018, Joyent, Inc. PROG= vtfontcvt OBJS= vtfontcvt.o @@ -22,6 +23,9 @@ OBJS += $(LZ4_OBJS) LDLIBS += -lumem +# not linted +SMATCH=off + %.o: $(LZ4COMMONDIR)/%.c $(COMPILE.c) $< $(POST_PROCESS_O) diff --git a/usr/src/cmd/zic/Makefile.common b/usr/src/cmd/zic/Makefile.common index 4f8526020c..197de36fb0 100644 --- a/usr/src/cmd/zic/Makefile.common +++ b/usr/src/cmd/zic/Makefile.common @@ -2,6 +2,7 @@ # Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # +# Copyright (c) 2018, Joyent, Inc. PROG= zic @@ -12,3 +13,5 @@ SRCS= $(OBJS:%.o=%.c) CERRWARN += -_gcc=-Wno-unused-variable CERRWARN += -_gcc=-Wno-uninitialized + +SMOFF += signed diff --git a/usr/src/man/man5/Makefile b/usr/src/man/man5/Makefile index 60aedf95cb..8e582ade35 100644 --- a/usr/src/man/man5/Makefile +++ b/usr/src/man/man5/Makefile @@ -63,6 +63,7 @@ _MANFILES= Intro.5 \ inotify.5 \ ipfilter.5 \ isalist.5 \ + isoboot.5 \ kerberos.5 \ krb5_auth_rules.5 \ krb5envvar.5 \ diff --git a/usr/src/man/man5/isoboot.5 b/usr/src/man/man5/isoboot.5 new file mode 100644 index 0000000000..541f06d2ed --- /dev/null +++ b/usr/src/man/man5/isoboot.5 @@ -0,0 +1,66 @@ +.\" Copyright (c) 2018 iXsystems, Inc. +.\" 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 AUTHORS 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 AUTHORS 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. +.\" +.Dd March 30, 2018 +.Dt ISOBOOT 5 +.Os +.Sh NAME +.Nm isoboot +.Nd Boot code for hybrid ISO/USB images on BIOS-based computers +.Sh DESCRIPTION +.Nm +is used on BIOS-based computers to boot from an ISO image that has +been written to a USB flash drive or other HDD-like device. +.Nm +is installed in a +.Cm x86 Boot +partition with +.Xr installboot 1M . +.Sh IMPLEMENTATION NOTES +The El Torito standard for bootable CDs provides a 32KB "System Area" +at the beginning of an image. +To create an image that is able to be booted by the BIOS as either a +CD-ROM ("ISO") and as a more HDD-like image (e.g. on a USB flash drive) +it is necessary to have both a standard El Torito boot catalog +containing a HDD-style partition table and boot code. +.Nm +is intended to be placed in a MBR x86 boot partition to allow the system to find +the standard +.Fx +.Xr loader 5 +in the ISO filesystem later in the image. +.Sh BOOTING +.Nm +looks for an ISO filesystem image on the device it was booted from and +seeks to read the primary illumos +.Xr loader 5 +from there. +.Sh SEE ALSO +.Xr installboot 1M +.Sh HISTORY +.Nm +appeared in FreeBSD 12.0. +.Sh AUTHORS +This manual page written by +.An Benno Rice Aq benno@FreeBSD.org . diff --git a/usr/src/man/man7p/tcp.7p b/usr/src/man/man7p/tcp.7p index 1e555956a0..752133bec2 100644 --- a/usr/src/man/man7p/tcp.7p +++ b/usr/src/man/man7p/tcp.7p @@ -1,478 +1,873 @@ -'\" te +'\" +.\" 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 (c) 2006, Sun Microsystems, Inc. All Rights Reserved. .\" Copyright (c) 2011 Nexenta Systems, Inc. All rights reserved. +.\" Copyright 2019 Joyent, Inc. .\" Copyright 1989 AT&T -.\" 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 TCP 7P "Feb 5, 2018" -.SH NAME -tcp, TCP \- Internet Transmission Control Protocol -.SH SYNOPSIS -.LP -.nf -\fB#include <sys/socket.h>\fR -.fi - -.LP -.nf -\fB#include <netinet/in.h>\fR -.fi - -.LP -.nf -\fBs = socket(AF_INET, SOCK_STREAM, 0);\fR -.fi - -.LP -.nf -\fBs = socket(AF_INET6, SOCK_STREAM, 0);\fR -.fi - -.LP -.nf -\fBt = t_open("/dev/tcp", O_RDWR);\fR -.fi - -.LP -.nf -\fBt = t_open("/dev/tcp6", O_RDWR);\fR -.fi - -.SH DESCRIPTION -.LP -\fBTCP\fR is the virtual circuit protocol of the Internet protocol family. It -provides reliable, flow-controlled, in order, two-way transmission of data. It -is a byte-stream protocol layered above the Internet Protocol (\fBIP\fR), or -the Internet Protocol Version 6 (\fBIPv6\fR), the Internet protocol family's +.\" +.Dd "Jan 07, 2019" +.Dt TCP 7P +.Os +.Sh NAME +.Nm tcp , +.Nm TCP +.Nd Internet Transmission Control Protocol +.Sh SYNOPSIS +.In sys/socket.h +.In netinet/in.h +.In netinet/tcp.h +.Bd -literal +s = socket(AF_INET, SOCK_STREAM, 0); +s = socket(AF_INET6, SOCK_STREAM, 0); +t = t_open("/dev/tcp", O_RDWR); +t = t_open("/dev/tcp6", O_RDWR); +.Ed +.Sh DESCRIPTION +TCP is the virtual circuit protocol of the Internet protocol family. +It provides reliable, flow-controlled, in-order, two-way transmission of data. +It is a byte-stream protocol layered above the Internet Protocol +.Po Sy IP Pc , +or the Internet Protocol Version 6 +.Po Sy IPv6 Pc , +the Internet protocol family's internetwork datagram delivery protocol. -.sp -.LP -Programs can access \fBTCP\fR using the socket interface as a \fBSOCK_STREAM\fR -socket type, or using the Transport Level Interface (\fBTLI\fR) where it -supports the connection-oriented (\fBT_COTS_ORD\fR) service type. -.sp -.LP -\fBTCP\fR uses \fBIP\fR's host-level addressing and adds its own per-host -collection of "port addresses." The endpoints of a \fBTCP\fR connection are -identified by the combination of an \fBIP\fR or IPv6 address and a \fBTCP\fR -port number. Although other protocols, such as the User Datagram Protocol -(UDP), may use the same host and port address format, the port space of these -protocols is distinct. See \fBinet\fR(7P) and \fBinet6\fR(7P) for details on +.Pp +Programs can access TCP using the socket interface as a +.Dv SOCK_STREAM +socket type, or using the Transport Level Interface +.Po Sy TLI Pc +where it supports the connection-oriented +.Po Dv BT_COTS_ORD Pc +service type. +.Pp +A checksum over all data helps TCP provide reliable communication. +Using a window-based flow control mechanism that makes use of positive +acknowledgements, sequence numbers, and a retransmission strategy, TCP can +usually recover when datagrams are damaged, delayed, duplicated or delivered +out of order by the underlying medium. +.Pp +TCP provides several socket options, defined in +.In netinet/tcp.h +and described throughout this document, +which may be set using +.Xr setsockopt 3SOCKET +and read using +.Xr getsockopt 3SOCKET . +The +.Fa level +argument for these calls is the protocol number for TCP, available from +.Xr getprotobyname 3SOCKET . +IP level options may also be used with TCP. +See +.Xr ip 7P +and +.Xr ip6 7P . +.Ss "Listening And Connecting" +TCP uses IP's host-level addressing and adds its own per-host +collection of +.Dq port addresses . +The endpoints of a TCP connection are +identified by the combination of an IPv4 or IPv6 address and a TCP +port number. +Although other protocols, such as the User Datagram Protocol +.Po Sy UDP Pc , +may use the same host and port address format, the port space of these +protocols is distinct. +See +.Xr inet 7P +and +.Xr inet6 7P +for details on the common aspects of addressing in the Internet protocol family. -.sp -.LP -Sockets utilizing \fBTCP\fR are either "active" or "passive." Active sockets -initiate connections to passive sockets. Both types of sockets must have their -local \fBIP\fR or IPv6 address and \fBTCP\fR port number bound with the -\fBbind\fR(3SOCKET) system call after the socket is created. By default, -\fBTCP\fR sockets are active. A passive socket is created by calling the -\fBlisten\fR(3SOCKET) system call after binding the socket with \fBbind()\fR. -This establishes a queueing parameter for the passive socket. After this, -connections to the passive socket can be received with the -\fBaccept\fR(3SOCKET) system call. Active sockets use the -\fBconnect\fR(3SOCKET) call after binding to initiate connections. -.sp -.LP -By using the special value \fBINADDR_ANY\fR with \fBIP\fR, or the unspecified -address (all zeroes) with IPv6, the local \fBIP\fR address can be left -unspecified in the \fBbind()\fR call by either active or passive \fBTCP\fR -sockets. This feature is usually used if the local address is either unknown or -irrelevant. If left unspecified, the local \fBIP\fR or IPv6 address will be -bound at connection time to the address of the network interface used to -service the connection. -.sp -.LP +.Pp +Sockets utilizing TCP are either +.Dq active +or +.Dq passive . +Active sockets +initiate connections to passive sockets. +Passive sockets must have their local IPv4 or IPv6 address and TCP port number +bound with the +.Xr bind 3SOCKET +system call after the socket is created. +If an active socket has not been bound by the time +.Xr connect 3SOCKET +is called, then the operating system will choose a local address and port for +the application. +By default, TCP sockets are active. +A passive socket is created by calling the +.Xr listen 3SOCKET +system call after binding, which establishes a queueing parameter for the +passive socket. +Connections to the passive socket can then be received using the +.Xr accept 3SOCKET +system call. +Active sockets use the +.Xr connect 3SOCKET +call after binding to initiate connections. +.Pp +If incoming connection requests include an IP source route option, then the +reverse source route will be used when responding. +.Pp +By using the special value +.Dv INADDR_ANY +with IPv4, or the unspecified +address (all zeroes) with IPv6, the local IP address can be left +unspecified in the +.Fn bind +call by either active or passive TCP +sockets. +This feature is usually used if the local address is either unknown or +irrelevant. +If left unspecified, the local IP address will be bound at connection time to +the address of the network interface used to service the connection. +For passive sockets, this is the destination address used by the connecting +peer. +For active sockets, this is usually an address on the same subnet as the +destination or default gateway address, although the rules can be more complex. +See +.Sy "Source Address Selection" +in +.Xr inet6 7P +for a detailed discussion of how this works in IPv6. +.Pp Note that no two TCP sockets can be bound to the same port unless the bound IP -addresses are different. IPv4 \fBINADDR_ANY\fR and IPv6 unspecified addresses -compare as equal to any IPv4 or IPv6 address. For example, if a socket is bound -to \fBINADDR_ANY\fR or unspecified address and port X, no other socket can bind -to port X, regardless of the binding address. This special consideration of -\fBINADDR_ANY\fR and unspecified address can be changed using the socket option -\fBSO_REUSEADDR\fR. If \fBSO_REUSEADDR\fR is set on a socket doing a bind, IPv4 -\fBINADDR_ANY\fR and IPv6 unspecified address do not compare as equal to any IP -address. This means that as long as the two sockets are not both bound to -\fBINADDR_ANY\fR/unspecified address or the same IP address, the two sockets -can be bound to the same port. -.sp -.LP -If an application does not want to allow another socket using the -\fBSO_REUSEADDR\fR option to bind to a port its socket is bound to, the -application can set the socket level option \fBSO_EXCLBIND\fR on a socket. The +addresses are different. +IPv4 +.Dv INADDR_ANY +and IPv6 unspecified addresses compare as equal to any IPv4 or IPv6 address. +For example, if a socket is bound to +.Dv INADDR_ANY +or the unspecified address and port +.Em N , +no other socket can bind to port +.Em N , +regardless of the binding address. +This special consideration of +.Dv INADDR_ANY +and the unspecified address can be changed using the socket option +.Dv SO_REUSEADDR . +If +.Dv SO_REUSEADDR +is set on a socket doing a bind, IPv4 +.Dv INADDR_ANY +and the IPv6 unspecified address do not compare as equal to any IP address. +This means that as long as the two sockets are not both bound to +.Dv INADDR_ANY , +the unspecified address, or the same IP address, then the two sockets can be +bound to the same port. +.Pp +If an application does not want to allow another socket using the +.Dv SO_REUSEADDR +option to bind to a port its socket is bound to, the +application can set the socket-level +.Po Dv SOL_SOCKET Pc +option +.Dv SO_EXCLBIND +on a socket. +The option values of 0 and 1 mean enabling and disabling the option respectively. Once this option is enabled on a socket, no other socket can be bound to the same port. -.sp -.LP +.Ss "Sending And Receiving Data" Once a connection has been established, data can be exchanged using the -\fBread\fR(2) and \fBwrite\fR(2) system calls. -.sp -.LP -Under most circumstances, \fBTCP\fR sends data when it is presented. When -outstanding data has not yet been acknowledged, \fBTCP\fR gathers small amounts -of output to be sent in a single packet once an acknowledgement has been -received. For a small number of clients, such as window systems that send a -stream of mouse events which receive no replies, this packetization may cause -significant delays. To circumvent this problem, \fBTCP\fR provides a -socket-level boolean option, \fBTCP_NODELAY.\fR \fBTCP_NODELAY\fR is defined in -\fB<netinet/tcp.h>\fR, and is set with \fBsetsockopt\fR(3SOCKET) and tested -with \fBgetsockopt\fR(3SOCKET). The option level for the \fBsetsockopt()\fR -call is the protocol number for \fBTCP,\fR available from -\fBgetprotobyname\fR(3SOCKET). -.sp -.LP -For some applications, it may be desirable for TCP not to send out data unless -a full TCP segment can be sent. To enable this behavior, an application can use -the \fBTCP_CORK\fR socket option. When \fBTCP_CORK\fR is set with a non-zero -value, TCP sends out a full TCP segment only. When \fBTCP_CORK\fR is set to -zero after it has been enabled, all buffered data is sent out (as permitted by -the peer's receive window and the current congestion window). \fBTCP_CORK\fR is -defined in <\fBnetinet/tcp.h\fR>, and is set with \fBsetsockopt\fR(3SOCKET) -and tested with \fBgetsockopt\fR(3SOCKET). The option level for the -\fBsetsockopt()\fR call is the protocol number for TCP, available from -\fBgetprotobyname\fR(3SOCKET). -.sp -.LP -The \fBSO_RCVBUF\fR socket level option can be used to control the window -that \fBTCP\fR advertises to the peer. \fBIP\fR level options may also be used -with \fBTCP.\fR See \fBip\fR(7P) and \fBip6\fR(7P). -.sp -.LP -\fBTCP\fR provides an urgent data mechanism, which may be invoked using the -out-of-band provisions of \fBsend\fR(3SOCKET). The caller may mark one byte as -"urgent" with the \fBMSG_OOB\fR flag to \fBsend\fR(3SOCKET). This sets an -"urgent pointer" pointing to this byte in the \fBTCP\fR stream. The receiver on -the other side of the stream is notified of the urgent data by a \fBSIGURG\fR -signal. The \fBSIOCATMARK\fR \fBioctl\fR(2) request returns a value indicating -whether the stream is at the urgent mark. Because the system never returns data -across the urgent mark in a single \fBread\fR(2) call, it is possible to +.Xr read 2 +and +.Xr write 2 +system calls. +If, after sending data, the local TCP receives no acknowledgements from its +peer for a period of time (for example, if the remote machine crashes), the +connection is closed and an error is returned. +.Pp +When a peer is sending data, it will only send up to the advertised +.Dq receive window , +which is determined by how much more data the recipient can fit in its buffer. +Applications can use the socket-level option +.Dv SO_RCVBUF +to increase or decrease the receive buffer size. +Similarly, the socket-level option +.Dv SO_SNDBUF +can be used to allow TCP to buffer more unacknowledged and unsent data locally. +.Pp +Under most circumstances, TCP will send data when it is written by the +application. +When outstanding data has not yet been acknowledged, though, TCP will gather +small amounts of output to be sent as a single packet once an acknowledgement +has been received. +Usually referred to as Nagle's Algorithm (RFC 896), this behavior helps prevent +flooding the network with many small packets. +.Pp +However, for some highly interactive clients (such as remote shells or +windowing systems that send a stream of keypresses or mouse events), this +batching may cause significant delays. +To disable this behavior, TCP provides a boolean socket option, +.Dv TCP_NODELAY . +.Pp +Conversely, for other applications, it may be desirable for TCP not to send out +any data until a full TCP segment can be sent. +To enable this behavior, an application can use the TCP-level socket option +.Dv TCP_CORK . +When set to a non-zero value, TCP will only send out a full TCP segment. +When +.Dv TCP_CORK +is set to zero after it has been enabled, all currently buffered data is sent +out (as permitted by the peer's receive window and the current congestion +window). +.Pp +TCP provides an urgent data mechanism, which may be invoked using the +out-of-band provisions of +.Xr send 3SOCKET . +The caller may mark one byte as +.Dq urgent +with the +.Dv MSG_OOB +flag to +.Xr send 3SOCKET . +This sets an +.Dq urgent pointer +pointing to this byte in the TCP stream. +The receiver on the other side of the stream is notified of the urgent data by a +.Dv SIGURG +signal. +The +.Dv SIOCATMARK +.Xr ioctl 2 +request returns a value indicating whether the stream is at the urgent mark. +Because the system never returns data across the urgent mark in a single +.Xr read 2 +call, it is possible to advance to the urgent data in a simple loop which reads data, testing the -socket with the \fBSIOCATMARK\fR \fBioctl()\fR request, until it reaches the -mark. -.sp -.LP -Incoming connection requests that include an \fBIP\fR source route option are -noted, and the reverse source route is used in responding. -.sp -.LP -A checksum over all data helps \fBTCP\fR implement reliability. Using a -window-based flow control mechanism that makes use of positive -acknowledgements, sequence numbers, and a retransmission strategy, \fBTCP\fR -can usually recover when datagrams are damaged, delayed, duplicated or -delivered out of order by the underlying communication medium. -.sp -.LP -If the local \fBTCP\fR receives no acknowledgements from its peer for a period -of time, (for example, if the remote machine crashes), the connection is closed -and an error is returned. -.sp -.LP -TCP follows the congestion control algorithm described in \fIRFC 2581\fR, and -also supports the initial congestion window (cwnd) changes in \fIRFC 3390\fR. +socket with the +.Dv SIOCATMARK +.Fn ioctl +request, until it reaches the mark. +.Ss "Congestion Control" +TCP follows the congestion control algorithm described in RFC 2581, and +also supports the initial congestion window (cwnd) changes in RFC 3390. The initial cwnd calculation can be overridden by the socket option -TCP_INIT_CWND. An application can use this option to set the initial cwnd to a -specified number of TCP segments. This applies to the cases when the connection -first starts and restarts after an idle period. The process must have the -PRIV_SYS_NET_CONFIG privilege if it wants to specify a number greater than that -calculated by \fIRFC 3390\fR. -.sp -.LP -illumos supports \fBTCP\fR Extensions for High Performance (\fIRFC 7323\fR) +.Dv TCP_INIT_CWND . +An application can use this option to set the initial cwnd to a +specified number of TCP segments. +This applies to the cases when the connection +first starts and restarts after an idle period. +The process must have the +.Dv PRIV_SYS_NET_CONFIG +privilege if it wants to specify a number greater than that +calculated by RFC 3390. +.Ss "TCP Keep-Alive" +Since TCP determines whether a remote peer is no longer reachable by timing out +waiting for acknowledgements, a host that never sends any new data may never +notice a peer that has gone away. +While consumers can avoid this problem by sending their own periodic heartbeat +messages (Transport Layer Security does this, for example), +TCP describes an optional keep-alive mechanism in RFC 1122. +Applications can enable it using the socket-level option +.Dv SO_KEEPALIVE . +When enabled, the first keep-alive probe is sent out after a TCP connection is +idle for two hours. +If the peer does not respond to the probe within eight minutes, the TCP +connection is aborted. +An application can alter the probe behavior using the following TCP-level +socket options: +.Bl -tag -offset indent -width 16m +.It Dv TCP_KEEPALIVE_THRESHOLD +Determines the interval for sending the first probe. +The option value is specified as an unsigned integer in milliseconds. +The system default is controlled by the TCP +.Nm ndd +parameter +.Cm tcp_keepalive_interval . +The minimum value is ten seconds. +The maximum is ten days, while the default is two hours. +.It Dv TCP_KEEPALIVE_ABORT_THRESHOLD +If TCP does not receive a response to the probe, then this option determines +how long to wait before aborting a TCP connection. +The option value is an unsigned integer in milliseconds. +The value zero indicates that TCP should never time +out and abort the connection when probing. +The system default is controlled by the TCP +.Nm ndd +parameter +.Sy tcp_keepalive_abort_interval . +The default is eight minutes. +.It Dv TCP_KEEPIDLE +This option, like +.Dv TCP_KEEPALIVE_THRESHOLD , +determines the interval for sending the first probe, except that +the option value is an unsigned integer in +.Sy seconds . +It is provided primarily for compatibility with other Unix flavors. +.It Dv TCP_KEEPCNT +This option specifies the number of keep-alive probes that should be sent +without any response from the peer before aborting the connection. +.It Dv TCP_KEEPINTVL +This option specifies the interval in seconds between successive, +unacknowledged keep-alive probes. +.El +.Ss "Additional Configuration" +illumos supports TCP Extensions for High Performance (RFC 7323) which includes the window scale and timestamp options, and Protection Against -Wrap Around Sequence Numbers (PAWS). Note that if timestamps are negotiated on +Wrap Around Sequence Numbers +.Po Sy PAWS Pc . +Note that if timestamps are negotiated on a connection, received segments without timestamps on that connection are silently dropped per the suggestion in the RFC. illumos also supports Selective -Acknowledgment (SACK) capabilities (RFC 2018) and Explicit Congestion -Notification (ECN) mechanism (\fIRFC 3168\fR). -.sp -.LP +Acknowledgment +.Po Sy SACK Pc +capabilities (RFC 2018) and Explicit Congestion +Notification +.Po Sy ECN Pc +mechanism (RFC 3168). +.Pp Turn on the window scale option in one of the following ways: -.RS +4 -.TP -.ie t \(bu -.el o -An application can set \fBSO_SNDBUF\fR or \fBSO_RCVBUF\fR size in the -\fBsetsockopt()\fR option to be larger than 64K. This must be done \fIbefore\fR -the program calls \fBlisten()\fR or \fBconnect()\fR, because the window scale -option is negotiated when the connection is established. Once the connection +.Bl -bullet -offset indent -width 4m +.It +An application can set +.Dv SO_SNDBUF +or +.Dv SO_RCVBUF +size in the +.Fn setsockopt +option to be larger than 64K. +This must be done +.Em before +the program calls +.Fn listen +or +.Fn connect , +because the window scale +option is negotiated when the connection is established. +Once the connection has been made, it is too late to increase the send or receive window beyond the -default \fBTCP\fR limit of 64K. -.RE -.RS +4 -.TP -.ie t \(bu -.el o -For all applications, use \fBndd\fR(1M) to modify the configuration parameter -\fBtcp_wscale_always\fR. If \fBtcp_wscale_always\fR is set to \fB1\fR, the -window scale option will always be set when connecting to a remote system. If -\fBtcp_wscale_always\fR is \fB0,\fR the window scale option will be set only if -the user has requested a send or receive window larger than 64K. The default -value of \fBtcp_wscale_always\fR is \fB1\fR. -.RE -.RS +4 -.TP -.ie t \(bu -.el o -Regardless of the value of \fBtcp_wscale_always\fR, the window scale option +default TCP limit of 64K. +.It +For all applications, use +.Xr ndd 1M +to modify the configuration parameter +.Cm tcp_wscale_always . +If +.Cm tcp_wscale_always +is set to +.Sy 1 , +the +window scale option will always be set when connecting to a remote system. +If +.Cm tcp_wscale_always +is +.Sy 0 , +the window scale option will be set only if +the user has requested a send or receive window larger than 64K. +The default value of +.Cm tcp_wscale_always +is +.Sy 1 . +.It +Regardless of the value of +.Cm tcp_wscale_always , +the window scale option will always be included in a connect acknowledgement if the connecting system has used the option. -.RE -.sp -.LP -Turn on \fBSACK\fR capabilities in the following way: -.RS +4 -.TP -.ie t \(bu -.el o -Use \fBndd\fR to modify the configuration parameter \fBtcp_sack_permitted\fR. -If \fBtcp_sack_permitted\fR is set to \fB0\fR, \fBTCP\fR will not accept -\fBSACK\fR or send out \fBSACK\fR information. If \fBtcp_sack_permitted\fR is -set to \fB1\fR, \fBTCP\fR will not initiate a connection with \fBSACK\fR -permitted option in the \fBSYN\fR segment, but will respond with \fBSACK\fR -permitted option in the \fBSYN|ACK\fR segment if an incoming connection request -has the \fBSACK \fR permitted option. This means that \fBTCP\fR will only -accept \fBSACK\fR information if the other side of the connection also accepts -\fBSACK\fR information. If \fBtcp_sack_permitted\fR is set to \fB2\fR, it will -both initiate and accept connections with \fBSACK\fR information. The default -for \fBtcp_sack_permitted\fR is \fB2\fR (active enabled). -.RE -.sp -.LP -Turn on \fBTCP ECN\fR mechanism in the following way: -.RS +4 -.TP -.ie t \(bu -.el o -Use \fBndd\fR to modify the configuration parameter \fBtcp_ecn_permitted\fR. If -\fBtcp_ecn_permitted\fR is set to \fB0\fR, \fBTCP\fR will not negotiate with a -peer that supports \fBECN\fR mechanism. If \fBtcp_ecn_permitted\fR is set to -\fB1\fR when initiating a connection, TCP will not tell a peer that it supports -ECN mechanism. However, it will tell a peer that it supports \fBECN\fR +.El +.Pp +Turn on SACK capabilities in the following way: +.Bl -bullet -offset indent -width 4m +.It +Use +.Nm ndd +to modify the configuration parameter +.Cm tcp_sack_permitted . +If +.Cm tcp_sack_permitted +is set to +.Sy 0 , +TCP will not accept SACK or send out SACK information. +If +.Cm tcp_sack_permitted +is +set to +.Sy 1 , +TCP will not initiate a connection with SACK permitted option in the +.Sy SYN +segment, but will respond with SACK permitted option in the +.Sy SYN|ACK +segment if an incoming connection request has the SACK permitted option. +This means that TCP will only accept SACK information if the other side of the +connection also accepts SACK information. +If +.Cm tcp_sack_permitted +is set to +.Sy 2 , +it will both initiate and accept connections with SACK information. +The default for +.Cm tcp_sack_permitted +is +.Sy 2 +.Pq active enabled . +.El +.Pp +Turn on the TCP ECN mechanism in the following way: +.Bl -bullet -offset indent -width 4m +.It +Use +.Nm ndd +to modify the configuration parameter +.Cm tcp_ecn_permitted . +If +.Cm tcp_ecn_permitted +is set to +.Sy 0 , +then TCP will not negotiate with a peer that supports ECN mechanism. +If +.Cm tcp_ecn_permitted +is set to +.Sy 1 +when initiating a connection, TCP will not tell a peer that it supports +.Sy ECN +mechanism. +However, it will tell a peer that it supports +.Sy ECN mechanism when accepting a new incoming connection request if the peer -indicates that it supports \fBECN\fR mechanism in the SYN segment. If -tcp_ecn_permitted is set to 2, in addition to negotiating with a peer on ECN -mechanism when accepting connections, TCP will indicate in the outgoing SYN -segment that it supports \fBECN\fR mechanism when \fBTCP\fR makes active -outgoing connections. The default for \fBtcp_ecn_permitted\fR is 1. -.RE -.sp -.LP +indicates that it supports +.Sy ECN +mechanism in the +.Sy SYN +segment. +If +.Cm tcp_ecn_permitted +is set to 2, in addition to negotiating with a peer on +.Sy ECN +mechanism when accepting connections, TCP will indicate in the outgoing +.Sy SYN +segment that it supports +.Sy ECN +mechanism when TCP makes active outgoing connections. +The default for +.Cm tcp_ecn_permitted +is 1. +.El +.Pp Turn on the timestamp option in the following way: -.RS +4 -.TP -.ie t \(bu -.el o -Use \fBndd\fR to modify the configuration parameter \fBtcp_tstamp_always\fR. If -\fBtcp_tstamp_always\fR is \fB1\fR, the timestamp option will always be set -when connecting to a remote machine. If \fBtcp_tstamp_always\fR is \fB0\fR, the -timestamp option will not be set when connecting to a remote system. The -default for \fBtcp_tstamp_always\fR is \fB0\fR. -.RE -.RS +4 -.TP -.ie t \(bu -.el o -Regardless of the value of \fBtcp_tstamp_always\fR, the timestamp option will +.Bl -bullet -offset indent -width 4m +.It +Use +.Nm ndd +to modify the configuration parameter +.Cm tcp_tstamp_always . +If +.Cm tcp_tstamp_always +is +.Sy 1 , +the timestamp option will always be set +when connecting to a remote machine. +If +.Cm tcp_tstamp_always +is +.Sy 0 , +the timestamp option will not be set when connecting to a remote system. +The +default for +.Cm tcp_tstamp_always +is +.Sy 0 . +.It +Regardless of the value of +.Cm tcp_tstamp_always , +the timestamp option will always be included in a connect acknowledgement (and all succeeding packets) if the connecting system has used the timestamp option. -.RE -.sp -.LP +.El +.Pp Use the following procedure to turn on the timestamp option only when the window scale option is in effect: -.RS +4 -.TP -.ie t \(bu -.el o -Use \fBndd\fR to modify the configuration parameter \fBtcp_tstamp_if_wscale\fR. -Setting \fBtcp_tstamp_if_wscale\fR to \fB1\fR will cause the timestamp option +.Bl -bullet -offset indent -width 4m +.It +Use +.Nm ndd +to modify the configuration parameter +.Cm tcp_tstamp_if_wscale . +Setting +.Cm tcp_tstamp_if_wscale +to +.Sy 1 +will cause the timestamp option to be set when connecting to a remote system, if the window scale option has -been set. If \fBtcp_tstamp_if_wscale\fR is \fB0\fR, the timestamp option will -not be set when connecting to a remote system. The default for -\fBtcp_tstamp_if_wscale\fR is \fB1\fR. -.RE -.sp -.LP -Protection Against Wrap Around Sequence Numbers (PAWS) is always used when the +been set. +If +.Cm tcp_tstamp_if_wscale +is +.Sy 0 , +the timestamp option will +not be set when connecting to a remote system. +The default for +.Cm tcp_tstamp_if_wscale +is +.Sy 1 . +.El +.Pp +Protection Against Wrap Around Sequence Numbers +.Po Sy PAWS Pc +is always used when the timestamp option is set. -.sp -.LP -SunOS also supports multiple methods of generating initial sequence numbers. -One of these methods is the improved technique suggested in \fBRFC\fR 1948. We -\fBHIGHLY\fR recommend that you set sequence number generation parameters as -close to boot time as possible. This prevents sequence number problems on +.Pp +The operating system also supports multiple methods of generating initial sequence numbers. +One of these methods is the improved technique suggested in RFC 1948. +We +.Em HIGHLY +recommend that you set sequence number generation parameters as +close to boot time as possible. +This prevents sequence number problems on connections that use the same connection-ID as ones that used a different -sequence number generation. The \fBsvc:/network/initial:default\fR service -configures the initial sequence number generation. The service reads the value -contained in the configuration file \fB/etc/default/inetinit\fR to determine -which method to use. -.sp -.LP -The \fB/etc/default/inetinit\fR file is an unstable interface, and may change -in future releases. -.sp -.LP -\fBTCP\fR may be configured to report some information on connections that -terminate by means of an \fBRST\fR packet. By default, no logging is done. If -the \fBndd\fR(1M) parameter \fItcp_trace\fR is set to 1, then trace data is -collected for all new connections established after that time. -.sp -.LP -The trace data consists of the \fBTCP\fR headers and \fBIP\fR source and -destination addresses of the last few packets sent in each direction before RST -occurred. Those packets are logged in a series of \fBstrlog\fR(9F) calls. This -trace facility has a very low overhead, and so is superior to such utilities as -\fBsnoop\fR(1M) for non-intrusive debugging for connections terminating by -means of an \fBRST\fR. -.sp -.LP -SunOS supports the keep-alive mechanism described in \fIRFC 1122\fR. It is -enabled using the socket option SO_KEEPALIVE. When enabled, the first -keep-alive probe is sent out after a TCP is idle for two hours If the peer does -not respond to the probe within eight minutes, the TCP connection is aborted. -You can alter the interval for sending out the first probe using the socket -option TCP_KEEPALIVE_THRESHOLD. The option value is an unsigned integer in -milliseconds. The system default is controlled by the TCP ndd parameter -tcp_keepalive_interval. The minimum value is ten seconds. The maximum is ten -days, while the default is two hours. If you receive no response to the probe, -you can use the TCP_KEEPALIVE_ABORT_THRESHOLD socket option to change the time -threshold for aborting a TCP connection. The option value is an unsigned -integer in milliseconds. The value zero indicates that TCP should never time -out and abort the connection when probing. The system default is controlled by -the TCP ndd parameter tcp_keepalive_abort_interval. The default is eight -minutes. -.sp -.LP -socket options TCP_KEEPIDLE, TCP_KEEPCNT and TCP_KEEPINTVL are also supported -for compatibility with other Unix Flavors. TCP_KEEPIDLE option specifies the -interval in seconds for sending out the first keep-alive probe. TCP_KEEPCNT -specifies the number of keep-alive probes to be sent before aborting the -connection in the event of no response from peer. TCP_KEEPINTVL specifies the -interval in seconds between successive keep-alive probes. -.SH SEE ALSO -.LP -\fBsvcs\fR(1), \fBndd\fR(1M), \fBioctl\fR(2), \fBread\fR(2), \fBsvcadm\fR(1M), -\fBwrite\fR(2), \fBaccept\fR(3SOCKET), \fBbind\fR(3SOCKET), -\fBconnect\fR(3SOCKET), \fBgetprotobyname\fR(3SOCKET), -\fBgetsockopt\fR(3SOCKET), \fBlisten\fR(3SOCKET), \fBsend\fR(3SOCKET), -\fBsmf\fR(5), \fBinet\fR(7P), \fBinet6\fR(7P), \fBip\fR(7P), \fBip6\fR(7P) -.sp -.LP -Ramakrishnan, K., Floyd, S., Black, D., RFC 3168, \fIThe Addition of Explicit -Congestion Notification (ECN) to IP\fR, September 2001. -.sp -.LP -Mathias, M. and Hahdavi, J. Pittsburgh Supercomputing Center; Ford, S. Lawrence -Berkeley National Laboratory; Romanow, A. Sun Microsystems, Inc. \fIRFC 2018, -TCP Selective Acknowledgement Options\fR, October 1996. -.sp -.LP -Bellovin, S., \fIRFC 1948, Defending Against Sequence Number Attacks\fR, May -1996. -.sp -.LP -D. Borman, B. Braden, V. Jacobson and R. Scheffenegger, Ed., \fIRFC 7323, TCP -Extensions for High Performance\fR, September 2014. -.sp -.LP -Postel, Jon, \fIRFC 793, Transmission Control Protocol - DARPA Internet Program -Protocol Specification\fR, Network Information Center, SRI International, Menlo -Park, CA., September 1981. -.SH DIAGNOSTICS -.LP +sequence number generation. +The +.Sy svc:/network/initial:default +service configures the initial sequence number generation. +The service reads the value contained in the configuration file +.Pa /etc/default/inetinit +to determine which method to use. +.Pp +The +.Pa /etc/default/inetinit +file is an unstable interface, and may change in future releases. +.Sh EXAMPLES +.Ss Example 1: Connecting to a server +.Bd -literal +$ gcc -std=c99 -Wall -lsocket -o client client.c +$ cat client.c +#include <sys/socket.h> +#include <netinet/in.h> +#include <netinet/tcp.h> +#include <netdb.h> +#include <stdio.h> +#include <string.h> +#include <unistd.h> + +int +main(int argc, char *argv[]) +{ + struct addrinfo hints, *gair, *p; + int fd, rv, rlen; + char buf[1024]; + int y = 1; + + if (argc != 3) { + fprintf(stderr, "%s <host> <port>\\n", argv[0]); + return (1); + } + + memset(&hints, 0, sizeof (hints)); + hints.ai_family = PF_UNSPEC; + hints.ai_socktype = SOCK_STREAM; + + if ((rv = getaddrinfo(argv[1], argv[2], &hints, &gair)) != 0) { + fprintf(stderr, "getaddrinfo() failed: %s\\n", + gai_strerror(rv)); + return (1); + } + + for (p = gair; p != NULL; p = p->ai_next) { + if ((fd = socket( + p->ai_family, + p->ai_socktype, + p->ai_protocol)) == -1) { + perror("socket() failed"); + continue; + } + + if (connect(fd, p->ai_addr, p->ai_addrlen) == -1) { + close(fd); + perror("connect() failed"); + continue; + } + + break; + } + + if (p == NULL) { + fprintf(stderr, "failed to connect to server\\n"); + return (1); + } + + freeaddrinfo(gair); + + if (setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, &y, + sizeof (y)) == -1) { + perror("setsockopt(SO_KEEPALIVE) failed"); + return (1); + } + + while ((rlen = read(fd, buf, sizeof (buf))) > 0) { + fwrite(buf, rlen, 1, stdout); + } + + if (rlen == -1) { + perror("read() failed"); + } + + fflush(stdout); + + if (close(fd) == -1) { + perror("close() failed"); + } + + return (0); +} +$ ./client 127.0.0.1 8080 +hello +$ ./client ::1 8080 +hello +.Ed +.Ss Example 2: Accepting client connections +.Bd -literal +$ gcc -std=c99 -Wall -lsocket -o server server.c +$ cat server.c +#include <sys/socket.h> +#include <netinet/in.h> +#include <netinet/tcp.h> +#include <netdb.h> +#include <stdio.h> +#include <string.h> +#include <unistd.h> +#include <arpa/inet.h> + +void +logmsg(struct sockaddr *s, int bytes) +{ + char dq[INET6_ADDRSTRLEN]; + + switch (s->sa_family) { + case AF_INET: { + struct sockaddr_in *s4 = (struct sockaddr_in *)s; + inet_ntop(AF_INET, &s4->sin_addr, dq, sizeof (dq)); + fprintf(stdout, "sent %d bytes to %s:%d\\n", + bytes, dq, ntohs(s4->sin_port)); + break; + } + case AF_INET6: { + struct sockaddr_in6 *s6 = (struct sockaddr_in6 *)s; + inet_ntop(AF_INET6, &s6->sin6_addr, dq, sizeof (dq)); + fprintf(stdout, "sent %d bytes to [%s]:%d\\n", + bytes, dq, ntohs(s6->sin6_port)); + break; + } + default: + fprintf(stdout, "sent %d bytes to unknown client\\n", + bytes); + break; + } +} + +int +main(int argc, char *argv[]) +{ + struct addrinfo hints, *gair, *p; + int sfd, cfd; + int slen, wlen, rv; + + if (argc != 3) { + fprintf(stderr, "%s <port> <message>\\n", argv[0]); + return (1); + } + + slen = strlen(argv[2]); + + memset(&hints, 0, sizeof (hints)); + hints.ai_family = PF_UNSPEC; + hints.ai_socktype = SOCK_STREAM; + hints.ai_flags = AI_PASSIVE; + + if ((rv = getaddrinfo(NULL, argv[1], &hints, &gair)) != 0) { + fprintf(stderr, "getaddrinfo() failed: %s\\n", + gai_strerror(rv)); + return (1); + } + + for (p = gair; p != NULL; p = p->ai_next) { + if ((sfd = socket( + p->ai_family, + p->ai_socktype, + p->ai_protocol)) == -1) { + perror("socket() failed"); + continue; + } + + if (bind(sfd, p->ai_addr, p->ai_addrlen) == -1) { + close(sfd); + perror("bind() failed"); + continue; + } + + break; + } + + if (p == NULL) { + fprintf(stderr, "server failed to bind()\\n"); + return (1); + } + + freeaddrinfo(gair); + + if (listen(sfd, 1024) != 0) { + perror("listen() failed"); + return (1); + } + + fprintf(stdout, "waiting for clients...\\n"); + + for (int times = 0; times < 5; times++) { + struct sockaddr_storage stor; + socklen_t alen = sizeof (stor); + struct sockaddr *addr = (struct sockaddr *)&stor; + + if ((cfd = accept(sfd, addr, &alen)) == -1) { + perror("accept() failed"); + continue; + } + + wlen = 0; + + do { + wlen += write(cfd, argv[2] + wlen, slen - wlen); + } while (wlen < slen); + + logmsg(addr, wlen); + + if (close(cfd) == -1) { + perror("close(cfd) failed"); + } + } + + if (close(sfd) == -1) { + perror("close(sfd) failed"); + } + + fprintf(stdout, "finished.\\n"); + + return (0); +} +$ ./server 8080 $'hello\\n' +waiting for clients... +sent 6 bytes to [::ffff:127.0.0.1]:59059 +sent 6 bytes to [::ffff:127.0.0.1]:47448 +sent 6 bytes to [::ffff:127.0.0.1]:54949 +sent 6 bytes to [::ffff:127.0.0.1]:55186 +sent 6 bytes to [::1]:62256 +finished. +.Ed +.Sh DIAGNOSTICS A socket operation may fail if: -.sp -.ne 2 -.na -\fB\fBEISCONN\fR\fR -.ad -.RS 17n -A \fBconnect()\fR operation was attempted on a socket on which a -\fBconnect()\fR operation had already been performed. -.RE - -.sp -.ne 2 -.na -\fB\fBETIMEDOUT\fR\fR -.ad -.RS 17n +.Bl -tag -offset indent -width 16m +.It Er EISCONN +A +.Fn connect +operation was attempted on a socket on which a +.Fn connect +operation had already been performed. +.It Er ETIMEDOUT A connection was dropped due to excessive retransmissions. -.RE - -.sp -.ne 2 -.na -\fB\fBECONNRESET\fR\fR -.ad -.RS 17n +.It Er ECONNRESET The remote peer forced the connection to be closed (usually because the remote machine has lost state information about the connection due to a crash). -.RE - -.sp -.ne 2 -.na -\fB\fBECONNREFUSED\fR\fR -.ad -.RS 17n +.It Er ECONNREFUSED The remote peer actively refused connection establishment (usually because no process is listening to the port). -.RE - -.sp -.ne 2 -.na -\fB\fBEADDRINUSE\fR\fR -.ad -.RS 17n -A \fBbind()\fR operation was attempted on a socket with a network address/port -pair that has already been bound to another socket. -.RE - -.sp -.ne 2 -.na -\fB\fBEADDRNOTAVAIL\fR\fR -.ad -.RS 17n -A \fBbind()\fR operation was attempted on a socket with a network address for -which no network interface exists. -.RE - -.sp -.ne 2 -.na -\fB\fBEACCES\fR\fR -.ad -.RS 17n -A \fBbind()\fR operation was attempted with a "reserved" port number and the -effective user \fBID\fR of the process was not the privileged user. -.RE - -.sp -.ne 2 -.na -\fB\fBENOBUFS\fR\fR -.ad -.RS 17n +.It Er EADDRINUSE +A +.Fn bind +operation was attempted on a socket with a network address/port pair that has +already been bound to another socket. +.It Er EADDRNOTAVAIL +A +.Fn bind +operation was attempted on a socket with a network address for which no network +interface exists. +.It Er EACCES +A +.Fn bind +operation was attempted with a +.Dq reserved +port number and the effective user ID of the process was not the privileged user. +.It Er ENOBUFS The system ran out of memory for internal data structures. -.RE - -.SH NOTES -.LP -The \fBtcp\fR service is managed by the service management facility, -\fBsmf\fR(5), under the service identifier: -.sp -.in +2 -.nf -svc:/network/initial:default -.fi -.in -2 -.sp - -.sp -.LP +.El +.Sh SEE ALSO +.Xr svcs 1 , +.Xr ndd 1M , +.Xr svcadm 1M , +.Xr ioctl 2 , +.Xr read 2 , +.Xr write 2 , +.Xr accept 3SOCKET , +.Xr bind 3SOCKET , +.Xr connect 3SOCKET , +.Xr getprotobyname 3SOCKET , +.Xr getsockopt 3SOCKET , +.Xr listen 3SOCKET , +.Xr send 3SOCKET , +.Xr smf 5 , +.Xr inet 7P , +.Xr inet6 7P , +.Xr ip 7P , +.Xr ip6 7P +.Rs +.%A "K. Ramakrishnan" +.%A "S. Floyd" +.%A "D. Black" +.%T "The Addition of Explicit Congestion Notification (ECN) to IP" +.%R "RFC 3168" +.%D "September 2001" +.Re +.Rs +.%A "M. Mathias" +.%A "J. Mahdavi" +.%A "S. Ford" +.%A "A. Romanow" +.%T "TCP Selective Acknowledgement Options" +.%R "RFC 2018" +.%D "October 1996" +.Re +.Rs +.%A "S. Bellovin" +.%T "Defending Against Sequence Number Attacks" +.%R "RFC 1948" +.%D "May 1996" +.Re +.Rs +.%A "D. Borman" +.%A "B. Braden" +.%A "V. Jacobson" +.%A "R. Scheffenegger, Ed." +.%T "TCP Extensions for High Performance" +.%R "RFC 7323" +.%D "September 2014" +.Re +.Rs +.%A "Jon Postel" +.%T "Transmission Control Protocol - DARPA Internet Program Protocol Specification" +.%R "RFC 793" +.%C "Network Information Center, SRI International, Menlo Park, CA." +.%D "September 1981" +.Re +.Sh NOTES +The +.Sy tcp +service is managed by the service management facility, +.Xr smf 5 , +under the service identifier +.Sy svc:/network/initial:default . +.Pp Administrative actions on this service, such as enabling, disabling, or -requesting restart, can be performed using \fBsvcadm\fR(1M). The service's -status can be queried using the \fBsvcs\fR(1) command. +requesting restart, can be performed using +.Xr svcadm 1M . +The service's +status can be queried using the +.Xr svcs 1 +command. diff --git a/usr/src/pkg/manifests/system-boot-loader.mf b/usr/src/pkg/manifests/system-boot-loader.mf index d4508edfbc..4b69fa9098 100644 --- a/usr/src/pkg/manifests/system-boot-loader.mf +++ b/usr/src/pkg/manifests/system-boot-loader.mf @@ -72,6 +72,7 @@ $(i386_ONLY)file path=boot/forth/support.4th group=sys mode=0444 $(i386_ONLY)file path=boot/forth/version.4th group=sys mode=0444 $(i386_ONLY)file path=boot/gptzfsboot group=sys mode=0444 $(i386_ONLY)file path=boot/illumos.png group=sys mode=0444 +$(i386_ONLY)file path=boot/isoboot group=sys mode=0444 $(i386_ONLY)file path=boot/loader group=sys mode=0444 $(i386_ONLY)file path=boot/loader.help group=sys mode=0444 $(i386_ONLY)file path=boot/loader.rc group=sys mode=0444 @@ -85,6 +86,7 @@ $(i386_ONLY)file path=usr/share/man/man5/check-password.4th.5 $(i386_ONLY)file path=usr/share/man/man5/color.4th.5 $(i386_ONLY)file path=usr/share/man/man5/delay.4th.5 $(i386_ONLY)file path=usr/share/man/man5/gptzfsboot.5 +$(i386_ONLY)file path=usr/share/man/man5/isoboot.5 $(i386_ONLY)file path=usr/share/man/man5/loader.4th.5 $(i386_ONLY)file path=usr/share/man/man5/loader.5 $(i386_ONLY)file path=usr/share/man/man5/menu.4th.5 diff --git a/usr/src/prototypes/README b/usr/src/prototypes/README index 3e28352a2b..9caa807985 100644 --- a/usr/src/prototypes/README +++ b/usr/src/prototypes/README @@ -17,5 +17,5 @@ CDDL version 1.0 for each new file introduced in illumos. */ /* - * Copyright 2015 <contributor> + * Copyright 2019 <contributor> */ diff --git a/usr/src/prototypes/prototype.Makefile b/usr/src/prototypes/prototype.Makefile index 86bbbbd87e..1076b28511 100644 --- a/usr/src/prototypes/prototype.Makefile +++ b/usr/src/prototypes/prototype.Makefile @@ -10,6 +10,6 @@ # # -# Copyright 2018 <contributor> +# Copyright 2019 <contributor> # diff --git a/usr/src/prototypes/prototype.c b/usr/src/prototypes/prototype.c index c52559fefe..c5b0610800 100644 --- a/usr/src/prototypes/prototype.c +++ b/usr/src/prototypes/prototype.c @@ -10,7 +10,7 @@ */ /* - * Copyright 2018 <contributor> + * Copyright 2019 <contributor> */ /* diff --git a/usr/src/prototypes/prototype.csh b/usr/src/prototypes/prototype.csh index 7e9688a037..8a0b329c85 100644 --- a/usr/src/prototypes/prototype.csh +++ b/usr/src/prototypes/prototype.csh @@ -12,6 +12,6 @@ # # -# Copyright 2018 <contributor> +# Copyright 2019 <contributor> # diff --git a/usr/src/prototypes/prototype.h b/usr/src/prototypes/prototype.h index 4d07840359..ad13c8d3bc 100644 --- a/usr/src/prototypes/prototype.h +++ b/usr/src/prototypes/prototype.h @@ -10,7 +10,7 @@ */ /* - * Copyright 2018 <contributor> + * Copyright 2019 <contributor> */ #ifndef _PROTOTYPE_H diff --git a/usr/src/prototypes/prototype.java b/usr/src/prototypes/prototype.java index 39ef7b6f29..fb1244599a 100644 --- a/usr/src/prototypes/prototype.java +++ b/usr/src/prototypes/prototype.java @@ -10,7 +10,7 @@ */ /* - * Copyright 2018 <contributor> + * Copyright 2019 <contributor> */ /* diff --git a/usr/src/prototypes/prototype.ksh b/usr/src/prototypes/prototype.ksh index 4dcc85a52c..461f955820 100644 --- a/usr/src/prototypes/prototype.ksh +++ b/usr/src/prototypes/prototype.ksh @@ -12,6 +12,6 @@ # # -# Copyright 2018 <contributor> +# Copyright 2019 <contributor> # diff --git a/usr/src/prototypes/prototype.man b/usr/src/prototypes/prototype.man index 90649d643a..f611dcfa6b 100644 --- a/usr/src/prototypes/prototype.man +++ b/usr/src/prototypes/prototype.man @@ -9,5 +9,5 @@ .\" http://www.illumos.org/license/CDDL. .\" .\" -.\" Copyright 2018 <contributor> +.\" Copyright 2019 <contributor> .\" diff --git a/usr/src/prototypes/prototype.mapfile-vers b/usr/src/prototypes/prototype.mapfile-vers index 832368154a..3a97d1dffa 100644 --- a/usr/src/prototypes/prototype.mapfile-vers +++ b/usr/src/prototypes/prototype.mapfile-vers @@ -10,7 +10,7 @@ # # -# Copyright 2018 <contributor> +# Copyright 2019 <contributor> # # diff --git a/usr/src/prototypes/prototype.pl b/usr/src/prototypes/prototype.pl index ffcbd46665..e010953597 100644 --- a/usr/src/prototypes/prototype.pl +++ b/usr/src/prototypes/prototype.pl @@ -11,7 +11,7 @@ # # -# Copyright 2018 <contributor> +# Copyright 2019 <contributor> # # diff --git a/usr/src/prototypes/prototype.py b/usr/src/prototypes/prototype.py index bab22f21cd..fcaf1e3fe2 100644 --- a/usr/src/prototypes/prototype.py +++ b/usr/src/prototypes/prototype.py @@ -11,7 +11,7 @@ # # -# Copyright 2018 <contributor> +# Copyright 2019 <contributor> # # diff --git a/usr/src/prototypes/prototype.s b/usr/src/prototypes/prototype.s index 294c0cb3ca..00009214db 100644 --- a/usr/src/prototypes/prototype.s +++ b/usr/src/prototypes/prototype.s @@ -10,7 +10,7 @@ */ /* - * Copyright 2018 <contributor> + * Copyright 2019 <contributor> */ .file "prototype.s" diff --git a/usr/src/prototypes/prototype.sh b/usr/src/prototypes/prototype.sh index 283bb34f6a..e048830fb2 100644 --- a/usr/src/prototypes/prototype.sh +++ b/usr/src/prototypes/prototype.sh @@ -12,6 +12,6 @@ # # -# Copyright 2018 <contributor> +# Copyright 2019 <contributor> # diff --git a/usr/src/test/crypto-tests/tests/common/cryptotest_kcf.c b/usr/src/test/crypto-tests/tests/common/cryptotest_kcf.c index c4724613ea..364551b904 100644 --- a/usr/src/test/crypto-tests/tests/common/cryptotest_kcf.c +++ b/usr/src/test/crypto-tests/tests/common/cryptotest_kcf.c @@ -76,8 +76,10 @@ cryptotest_init(cryptotest_t *arg, crypto_func_group_t fg) return (NULL); while ((fd = open(CRYPTO_DEVICE, O_RDWR)) < 0) { - if (errno != EINTR) + if (errno != EINTR) { + free(op); return (NULL); + } } op->in = (char *)arg->in; diff --git a/usr/src/test/libc-tests/tests/Makefile b/usr/src/test/libc-tests/tests/Makefile index 4d53e707e5..aa2e874fa9 100644 --- a/usr/src/test/libc-tests/tests/Makefile +++ b/usr/src/test/libc-tests/tests/Makefile @@ -12,7 +12,7 @@ # # Copyright (c) 2012 by Delphix. All rights reserved. # Copyright 2015 Garrett D'Amore <garrett@damore.org> -# Copyright 2016 Joyent, Inc. +# Copyright (c) 2018, Joyent, Inc. # SUBDIRS = \ @@ -57,6 +57,9 @@ SCRIPTS = \ CPPFLAGS += -D_REENTRANT +# needs work +SMOFF += all_func_returns,snprintf_overflow + PROGS32 = $(PROGS:%=%.32) PROGS64 = \ $(PROGS:%=%.64) \ diff --git a/usr/src/test/libc-tests/tests/regex/Makefile b/usr/src/test/libc-tests/tests/regex/Makefile index 6f22161163..a6b3ac8377 100644 --- a/usr/src/test/libc-tests/tests/regex/Makefile +++ b/usr/src/test/libc-tests/tests/regex/Makefile @@ -37,6 +37,9 @@ CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-uninitialized CERRWARN += -_gcc=-Wno-clobbered +# needs work +SMOFF += all_func_returns,testing_index_after_use + CMDS= $(PROG:%=$(TESTDIR)/%) $(SHPROG:%=$(TESTDIR)/%) $(CMDS):= FILEMODE=0555 TESTDATA= $(DATA:%=$(DATADIR)/%) diff --git a/usr/src/test/libc-tests/tests/select/Makefile b/usr/src/test/libc-tests/tests/select/Makefile index c5b70a03af..2b0d80c6d6 100644 --- a/usr/src/test/libc-tests/tests/select/Makefile +++ b/usr/src/test/libc-tests/tests/select/Makefile @@ -10,6 +10,7 @@ # # Copyright 2016, Richard Lowe. +# Copyright (c) 2018, Joyent, Inc. include $(SRC)/Makefile.master include $(SRC)/Makefile.master.64 @@ -24,6 +25,9 @@ PROGS= select_test CSTD= $(CSTD_GNU99) +# needs work +SMOFF += all_func_returns + select_test: select_test.c $(LINK64.c) -o $@ select_test.c $(LDLIBS64) $(POST_PROCESS) diff --git a/usr/src/test/libc-tests/tests/symbols/Makefile b/usr/src/test/libc-tests/tests/symbols/Makefile index a5eef8a3a8..ac2ede1092 100644 --- a/usr/src/test/libc-tests/tests/symbols/Makefile +++ b/usr/src/test/libc-tests/tests/symbols/Makefile @@ -50,6 +50,9 @@ EXTRAPROG += $(SYMTESTS) include ../Makefile.com +# needs work +SMOFF += testing_index_after_use + LDLIBS += -lcustr LDLIBS64 += -lcustr diff --git a/usr/src/test/os-tests/tests/i386/badseg.c b/usr/src/test/os-tests/tests/i386/badseg.c index 7e5e8b8a32..51de1211cf 100644 --- a/usr/src/test/os-tests/tests/i386/badseg.c +++ b/usr/src/test/os-tests/tests/i386/badseg.c @@ -68,7 +68,7 @@ resetseg(uint_t seg) if (rc == 0) { done = 1; ucp.uc_mcontext.gregs[seg] = selector; - setcontext(&ucp); + (void) setcontext(&ucp); } abort(); } diff --git a/usr/src/test/os-tests/tests/i386/ldt.c b/usr/src/test/os-tests/tests/i386/ldt.c index dbe816b19c..1f39e1a9bd 100644 --- a/usr/src/test/os-tests/tests/i386/ldt.c +++ b/usr/src/test/os-tests/tests/i386/ldt.c @@ -28,7 +28,7 @@ char foo[4096]; static void * donothing(void *nothing) { - sleep(5); + (void) sleep(5); return (NULL); } @@ -68,13 +68,13 @@ main(void) } for (int i = 0; i < 10; i++) - pthread_create(&tid, NULL, donothing, NULL); + (void) pthread_create(&tid, NULL, donothing, NULL); if (forkall() == 0) { - sleep(2); + (void) sleep(2); _exit(0); } - sleep(6); + (void) sleep(6); return (0); } diff --git a/usr/src/test/os-tests/tests/secflags/stacky.c b/usr/src/test/os-tests/tests/secflags/stacky.c index 417dea9dd7..a6f145b18c 100644 --- a/usr/src/test/os-tests/tests/secflags/stacky.c +++ b/usr/src/test/os-tests/tests/secflags/stacky.c @@ -3,6 +3,6 @@ int main(int argc, char **argv) { - sleep(100000); + (void) sleep(100000); return (0); } diff --git a/usr/src/test/os-tests/tests/sockfs/Makefile b/usr/src/test/os-tests/tests/sockfs/Makefile index 08aecce191..638250a400 100644 --- a/usr/src/test/os-tests/tests/sockfs/Makefile +++ b/usr/src/test/os-tests/tests/sockfs/Makefile @@ -12,6 +12,7 @@ # # Copyright (c) 2012 by Delphix. All rights reserved. # Copyright 2017 Gordon W. Ross +# Copyright (c) 2018, Joyent, Inc. # include $(SRC)/cmd/Makefile.cmd @@ -25,6 +26,9 @@ LDLIBS += -lsocket CSTD = $(CSTD_GNU99) CPPFLAGS += -D_XOPEN_SOURCE=600 -D__EXTENSIONS__ +# needs work +SMOFF += all_func_returns + nosignal := LDLIBS += -lnsl nosignal.ln := LDLIBS += -lnsl diff --git a/usr/src/test/smbclient-tests/cmd/Makefile.cmd b/usr/src/test/smbclient-tests/cmd/Makefile.cmd index 13fd47c643..f47eee1fe6 100644 --- a/usr/src/test/smbclient-tests/cmd/Makefile.cmd +++ b/usr/src/test/smbclient-tests/cmd/Makefile.cmd @@ -11,6 +11,7 @@ # # Copyright 2015 Nexenta Systems, Inc. All rights reserved. +# Copyright (c) 2018, Joyent, Inc. # include $(SRC)/test/Makefile.com @@ -27,6 +28,9 @@ LINTFLAGS += -erroff=E_BAD_FORMAT_STR2 LINTFLAGS += -erroff=E_NAME_DECL_NOT_USED_DEF2 LINTFLAGS += -erroff=E_FUNC_RET_ALWAYS_IGNOR2 +# needs work +SMOFF += all_func_returns,leaks + all: $(PROG) $(PROG): $(OBJS) diff --git a/usr/src/test/smbclient-tests/cmd/mkfile_mmap/mkfile_mmap.c b/usr/src/test/smbclient-tests/cmd/mkfile_mmap/mkfile_mmap.c index b11a55cd4f..04eaafb61f 100644 --- a/usr/src/test/smbclient-tests/cmd/mkfile_mmap/mkfile_mmap.c +++ b/usr/src/test/smbclient-tests/cmd/mkfile_mmap/mkfile_mmap.c @@ -12,6 +12,7 @@ /* * Copyright 2012 Jilin Xpd <jilinxpd@gmail.com> * Copyright 2018 Nexenta Systems, Inc. + * Copyright (c) 2018, Joyent, Inc. */ /* @@ -139,20 +140,20 @@ main(int argc, char **argv) break; } - /* tag each block (to aid debug) */ - p = file_addr; - q = file_addr + blksize - K; - memset(p, ' ', K); - snprintf(p, K, "\nblk=%d\n\n", i); - p += K; - - /* fill something into mapped addr */ - while (p < q) { + /* tag each block (to aid debug) */ + p = file_addr; + q = file_addr + blksize - K; memset(p, ' ', K); - snprintf(p, K, "\noff=0x%x\n\n", - (i * blksize) + (p - file_addr)); + snprintf(p, K, "\nblk=%d\n\n", i); p += K; - } + + /* fill something into mapped addr */ + while (p < q) { + memset(p, ' ', K); + snprintf(p, K, "\noff=0x%x\n\n", + (i * blksize) + (p - file_addr)); + p += K; + } /* sync mapped pages to file */ if (msync(file_addr, blksize, MS_SYNC) == -1) { diff --git a/usr/src/test/zfs-tests/cmd/randfree_file/randfree_file.c b/usr/src/test/zfs-tests/cmd/randfree_file/randfree_file.c index dc9ae8b8a1..7251b0e57d 100644 --- a/usr/src/test/zfs-tests/cmd/randfree_file/randfree_file.c +++ b/usr/src/test/zfs-tests/cmd/randfree_file/randfree_file.c @@ -28,6 +28,10 @@ * Copyright (c) 2012 by Delphix. All rights reserved. */ +/* + * Copyright (c) 2018, Joyent, Inc. + */ + #include "../file_common.h" /* @@ -84,10 +88,12 @@ main(int argc, char *argv[]) if ((fd = open(filename, O_RDWR | O_CREAT | O_TRUNC, mode)) < 0) { perror("open"); + free(buf); return (1); } if (write(fd, buf, filesize) < filesize) { perror("write"); + free(buf); return (1); } fl.l_whence = SEEK_SET; @@ -95,6 +101,7 @@ main(int argc, char *argv[]) fl.l_len = off_len; if (fcntl(fd, F_FREESP, &fl) != 0) { perror("fcntl"); + free(buf); return (1); } diff --git a/usr/src/test/zfs-tests/tests/functional/ctime/ctime_001_pos.c b/usr/src/test/zfs-tests/tests/functional/ctime/ctime_001_pos.c index a6e02fbea3..d17f835ae1 100644 --- a/usr/src/test/zfs-tests/tests/functional/ctime/ctime_001_pos.c +++ b/usr/src/test/zfs-tests/tests/functional/ctime/ctime_001_pos.c @@ -28,6 +28,9 @@ * Copyright (c) 2013 by Delphix. All rights reserved. */ +/* + * Copyright (c) 2018, Joyent, Inc. + */ #include <sys/types.h> #include <sys/stat.h> @@ -322,7 +325,7 @@ main(int argc, char *argv[]) * Sleep 2 seconds, then invoke command on given file */ (void) sleep(2); - timetest_table[i].func(tfile); + (void) timetest_table[i].func(tfile); /* * Get time after operating. diff --git a/usr/src/tools/aw/Makefile b/usr/src/tools/aw/Makefile index af2bf8f735..746cdbcbe2 100644 --- a/usr/src/tools/aw/Makefile +++ b/usr/src/tools/aw/Makefile @@ -23,6 +23,7 @@ # Copyright 2004 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # +# Copyright (c) 2018, Joyent, Inc. PROG = aw @@ -31,6 +32,9 @@ include ../Makefile.tools CFLAGS += $(CCVERBOSE) CERRWARN += -_gcc=-Wno-uninitialized +# not linted +SMATCH=off + LINTFLAGS += -ux -Xa -errchk=locfmtchk,parentheses CPPFLAGS += -DDEFAULT_AS_DIR='"$(GNU_ROOT)/bin"' diff --git a/usr/src/tools/btxld/Makefile b/usr/src/tools/btxld/Makefile index 6165fb6017..1d18254a59 100644 --- a/usr/src/tools/btxld/Makefile +++ b/usr/src/tools/btxld/Makefile @@ -12,6 +12,7 @@ # # Copyright 2016 Toomas Soome <tsoome@me.com> # +# Copyright (c) 2018, Joyent, Inc. include ../Makefile.tools @@ -30,6 +31,9 @@ LDLIBS += -lmd5 CSTD= $(CSTD_GNU99) CPPFLAGS += -I$(SRC)/uts/common -I$(COMMON_SRC) +# not linted +SMATCH=off + $(ROOTONBLDMAN1ONBLDFILES) := FILEMODE= 644 all: $(PROG) $(MAN1ONBLDFILES) diff --git a/usr/src/tools/cscope-fast/Makefile b/usr/src/tools/cscope-fast/Makefile index 247915451a..513534747f 100644 --- a/usr/src/tools/cscope-fast/Makefile +++ b/usr/src/tools/cscope-fast/Makefile @@ -24,6 +24,7 @@ # Copyright 2004 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # +# Copyright (c) 2018, Joyent, Inc. PROG= cscope-fast @@ -50,6 +51,9 @@ CERRWARN += -_gcc=-Wno-implicit-function-declaration CERRWARN += -_gcc=-Wno-unused CERRWARN += -_gcc=-Wno-uninitialized +# not linted +SMATCH=off + CFLAGS += $(CCVERBOSE) LDLIBS += -lcurses -ll diff --git a/usr/src/tools/ctf/Makefile.ctf b/usr/src/tools/ctf/Makefile.ctf index 0cf32bf1bc..830da0990f 100644 --- a/usr/src/tools/ctf/Makefile.ctf +++ b/usr/src/tools/ctf/Makefile.ctf @@ -22,6 +22,7 @@ # Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # +# Copyright (c) 2018, Joyent, Inc. include ../../../Makefile.tools @@ -47,3 +48,5 @@ HDRDIRS= \ CPPFLAGS += $(HDRDIRS) CFLAGS += $(CCVERBOSE) CERRWARN += -_gcc=-Wno-parentheses + +SMOFF += all_func_returns diff --git a/usr/src/tools/ctf/ctfstrip/ctfstrip.c b/usr/src/tools/ctf/ctfstrip/ctfstrip.c index 60180c6921..3cb3ed9fea 100644 --- a/usr/src/tools/ctf/ctfstrip/ctfstrip.c +++ b/usr/src/tools/ctf/ctfstrip/ctfstrip.c @@ -11,6 +11,7 @@ /* * Copyright 2011 Jason King. All rights reserved. + * Copyright (c) 2018, Joyent, Inc. */ #include <stdlib.h> @@ -132,7 +133,7 @@ fix_file(const char *filename, mode_t mode) return (B_FALSE); } - waitpid(pid, &stat, 0); + (void) waitpid(pid, &stat, 0); if (!WIFEXITED(stat) || WEXITSTATUS(stat) != 0) { warnx("Removing CTF information from %s failed", filename); return (B_FALSE); diff --git a/usr/src/tools/ctf/cvt/st_parse.c b/usr/src/tools/ctf/cvt/st_parse.c index 03facfd5cb..37e7756cdf 100644 --- a/usr/src/tools/ctf/cvt/st_parse.c +++ b/usr/src/tools/ctf/cvt/st_parse.c @@ -23,6 +23,10 @@ */ /* + * Copyright (c) 2018, Joyent, Inc. + */ + +/* * This file is a sewer. */ @@ -629,7 +633,7 @@ tdefdecl(char *cp, int h, tdesc_t **rtdp) /* record it as unresolved */ parse_debug(3, NULL, "tdefdecl unres type %d", h2); - *rtdp = calloc(sizeof (**rtdp), 1); + *rtdp = calloc(1, sizeof (**rtdp)); (*rtdp)->t_type = TYPEDEF_UNRES; (*rtdp)->t_id = h2; break; @@ -639,7 +643,7 @@ tdefdecl(char *cp, int h, tdesc_t **rtdp) /* define a new type */ cp = tdefdecl(cp, h2, rtdp); if ((*rtdp)->t_id && (*rtdp)->t_id != h2) { - ntdp = calloc(sizeof (*ntdp), 1); + ntdp = calloc(1, sizeof (*ntdp)); ntdp->t_type = TYPEDEF; ntdp->t_tdesc = *rtdp; *rtdp = ntdp; diff --git a/usr/src/tools/ctf/cvt/stabs.c b/usr/src/tools/ctf/cvt/stabs.c index 53b4565859..db6c8ae111 100644 --- a/usr/src/tools/ctf/cvt/stabs.c +++ b/usr/src/tools/ctf/cvt/stabs.c @@ -24,6 +24,10 @@ */ /* + * Copyright (c) 2018, Joyent, Inc. + */ + +/* * Routines used to read stabs data from a file, and to build a tdata structure * based on the interesting parts of that data. */ @@ -328,8 +332,7 @@ stabs_read(tdata_t *td, Elf *elf, const char *file) * the N_PSYM stabs. */ if (scope && stab->n_type != N_PSYM) { - if (iidescp) - iidesc_free(iidescp); + iidesc_free(iidescp); goto parse_loop_end; } diff --git a/usr/src/tools/ctf/dwarf/Makefile.com b/usr/src/tools/ctf/dwarf/Makefile.com index d90e85b55a..67ffd64a62 100644 --- a/usr/src/tools/ctf/dwarf/Makefile.com +++ b/usr/src/tools/ctf/dwarf/Makefile.com @@ -3,6 +3,8 @@ # Use is subject to license terms. # # Copyright 2011, Richard Lowe. +# +# Copyright (c) 2018, Joyent, Inc. include ../../Makefile.ctf @@ -76,6 +78,9 @@ CPPFLAGS += -I$(SRCDIR) -DELF_TARGET_ALL=1 CERRWARN += -_gcc=-Wno-unused CERRWARN += -_gcc=-Wno-implicit-function-declaration +# libdwarf not clean +SMATCH=off + LDLIBS = -lelf -lc .KEEP_STATE: diff --git a/usr/src/tools/elfextract/elfextract.c b/usr/src/tools/elfextract/elfextract.c index a99025c45e..72507ee62d 100644 --- a/usr/src/tools/elfextract/elfextract.c +++ b/usr/src/tools/elfextract/elfextract.c @@ -24,8 +24,11 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" +/* + * Copyright (c) 2018, Joyent, Inc. + */ +#include <unistd.h> #include <stdlib.h> #include <fcntl.h> #include <strings.h> diff --git a/usr/src/tools/findunref/findunref.c b/usr/src/tools/findunref/findunref.c index 6495272004..9d2f82d24e 100644 --- a/usr/src/tools/findunref/findunref.c +++ b/usr/src/tools/findunref/findunref.c @@ -23,6 +23,10 @@ */ /* + * Copyright (c) 2018, Joyent, Inc. + */ + +/* * Finds all unreferenced files in a source tree that do not match a list of * permitted pathnames. */ @@ -200,7 +204,7 @@ hg_manifest(const char *hgroot) pnset_t *pnsetp; char path[MAXPATHLEN]; - pnsetp = calloc(sizeof (pnset_t), 1); + pnsetp = calloc(1, sizeof (pnset_t)); if (pnsetp == NULL || asprintf(&hgcmd, "hg manifest -R %s", hgroot) == -1) goto fail; @@ -242,7 +246,7 @@ git_manifest(const char *gitroot) pnset_t *pnsetp; char path[MAXPATHLEN]; - pnsetp = calloc(sizeof (pnset_t), 1); + pnsetp = calloc(1, sizeof (pnset_t)); if (pnsetp == NULL || asprintf(&gitcmd, "git --git-dir=%s/.git ls-files", gitroot) == -1) goto fail; @@ -400,7 +404,7 @@ make_exset(const char *exceptfile) pnset_t *pnsetp; unsigned int i; - pnsetp = calloc(sizeof (pnset_t), 1); + pnsetp = calloc(1, sizeof (pnset_t)); if (pnsetp == NULL) return (NULL); diff --git a/usr/src/tools/install.bin/install.bin.c b/usr/src/tools/install.bin/install.bin.c index 40234e5c01..32b4cffe57 100644 --- a/usr/src/tools/install.bin/install.bin.c +++ b/usr/src/tools/install.bin/install.bin.c @@ -22,6 +22,9 @@ * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. */ +/* + * Copyright (c) 2018, Joyent, Inc. + */ #include <stdio.h> #include <stdlib.h> @@ -103,13 +106,13 @@ chown_file(const char *file, const char *group, const char *owner) if (group) { grp = stdfind(group, groupnames); - if (grp < 0) + if (grp == (gid_t)-1) (void) fprintf(stderr, "unknown group(%s)\n", group); } if (owner) { own = stdfind(owner, usernames); - if (own < 0) { + if (own == (uid_t)-1) { (void) fprintf(stderr, "unknown owner(%s)\n", owner); exit(1); } diff --git a/usr/src/tools/makesoftcore/Makefile b/usr/src/tools/makesoftcore/Makefile index c30ddacd14..88a2f5251b 100644 --- a/usr/src/tools/makesoftcore/Makefile +++ b/usr/src/tools/makesoftcore/Makefile @@ -12,6 +12,7 @@ # # Copyright 2018 Toomas Soome <tsoome@me.com> # +# Copyright (c) 2018, Joyent, Inc. include ../Makefile.tools @@ -23,6 +24,9 @@ OBJS= makesoftcore.o lz4.o SRCS= makesoftcore.c lz4.c LDLIBS= -lumem +# not linted +SMOFF += all_func_returns + .KEEP_STATE: all: $(PROG) diff --git a/usr/src/tools/mandoc/Makefile b/usr/src/tools/mandoc/Makefile index f6e39d759d..5b4d1ea764 100644 --- a/usr/src/tools/mandoc/Makefile +++ b/usr/src/tools/mandoc/Makefile @@ -33,6 +33,9 @@ CPPFLAGS += -I. -include fts.h CPPFLAGS += -I$(NATIVE_ADJUNCT)/include LDFLAGS += -L$(NATIVE_ADJUNCT)/lib -R$(NATIVE_ADJUNCT)/lib +# 3rd party code +SMATCH=off + .KEEP_STATE: all: $(PROG) diff --git a/usr/src/tools/protocmp/exception_list.c b/usr/src/tools/protocmp/exception_list.c index f44f5296e9..5701168b37 100644 --- a/usr/src/tools/protocmp/exception_list.c +++ b/usr/src/tools/protocmp/exception_list.c @@ -24,6 +24,8 @@ * Use is subject to license terms. * * Copyright 2015 PALO, Richard + * + * Copyright (c) 2018, Joyent, Inc. */ #include <stdio.h> @@ -76,6 +78,7 @@ parse_exception_line(char *line, elem_list *list) while ((e->arch = assign_arch(arch)) == 0) { if ((arch = strtok(NULL, FS)) == NULL) { + free(e); return (0); } } diff --git a/usr/src/tools/protocmp/proto_list.c b/usr/src/tools/protocmp/proto_list.c index e09a8c03b7..7d29570ce2 100644 --- a/usr/src/tools/protocmp/proto_list.c +++ b/usr/src/tools/protocmp/proto_list.c @@ -23,7 +23,9 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" +/* + * Copyright (c) 2018, Joyent, Inc. + */ #include <stdio.h> #include <fcntl.h> @@ -193,7 +195,7 @@ parse_line(char **v, elem *e) else { e->symsrc = malloc(strlen(v[SYM]) + 1); (void) strcpy(e->symsrc, v[SYM]); - if (e->file_type != SYM_LINK_T) + if (e->file_type != SYM_LINK_T) #if defined(__sparc) if (strncmp(e->symsrc, "sun4/", 5) == 0) e->arch = P_SUN4; diff --git a/usr/src/uts/i86pc/acpi_drv/Makefile b/usr/src/uts/i86pc/acpi_drv/Makefile index ce5eb13317..da499c485e 100644 --- a/usr/src/uts/i86pc/acpi_drv/Makefile +++ b/usr/src/uts/i86pc/acpi_drv/Makefile @@ -23,7 +23,7 @@ # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -# Copyright 2016 Joyent, Inc. +# Copyright (c) 2018, Joyent, Inc. # # This makefile drives the production of the acpi_drv @@ -65,6 +65,9 @@ CPPFLAGS += -DSUNDDI CERRWARN += -_gcc=-Wno-unused-function +# needs work +$(OBJS_DIR)/acpi_video.o := SMOFF += all_func_returns + LDFLAGS += -dy -N misc/acpica # diff --git a/usr/src/uts/i86pc/acpidev/Makefile b/usr/src/uts/i86pc/acpidev/Makefile index b59e9501b1..f910150ec6 100644 --- a/usr/src/uts/i86pc/acpidev/Makefile +++ b/usr/src/uts/i86pc/acpidev/Makefile @@ -24,7 +24,7 @@ # Copyright (c) 2009, Intel Corporation. # All rights reserved. # -# Copyright 2016, Joyent, Inc. +# Copyright (c) 2018, Joyent, Inc. # # This makefile drives the production of the ACPI device configuration # kernel module. @@ -66,6 +66,9 @@ CERRWARN += -_gcc=-Wno-uninitialized CERRWARN += -_gcc=-Wno-unused-function CERRWARN += -_gcc=-Wno-type-limits +# needs work +SMOFF += deref_check + # # Default build targets. # diff --git a/usr/src/uts/i86pc/acpinex/Makefile b/usr/src/uts/i86pc/acpinex/Makefile index 5269dc4115..4f6354af69 100644 --- a/usr/src/uts/i86pc/acpinex/Makefile +++ b/usr/src/uts/i86pc/acpinex/Makefile @@ -24,9 +24,9 @@ # Copyright (c) 2009, Intel Corporation. # All rights reserved. # -# Copyright 2016, Joyent, Inc. +# Copyright (c) 2018, Joyent, Inc. # -# This makefile drives the production of the ACPI virtual nexus +# This makefile drives the production of the ACPI virtual nexus # kernel module. # # intel platform dependent @@ -64,6 +64,9 @@ LDFLAGS += -dy -N misc/acpica -N misc/acpidev CERRWARN += -_gcc=-Wno-unused-function +# needs work +SMOFF += deref_check + # # Default build targets. # diff --git a/usr/src/uts/i86pc/apix/Makefile b/usr/src/uts/i86pc/apix/Makefile index 21df6e6098..383fff42a9 100644 --- a/usr/src/uts/i86pc/apix/Makefile +++ b/usr/src/uts/i86pc/apix/Makefile @@ -22,7 +22,7 @@ # uts/i86pc/apix/Makefile # # Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. -# Copyright 2017, Joyent, Inc. +# Copyright (c) 2018, Joyent, Inc. # # This makefile drives the production of the apix "mach" # kernel module. @@ -63,6 +63,11 @@ $(NOT_RELEASE_BUILD)DEBUG_DEFS += $(DEBUG_FLGS) # LDFLAGS += -dy -N misc/acpica +# needs work, real bug in apic_allocate_irq() +$(OBJS_DIR)/mp_platform_common.o := SMOFF += indenting +# needs work +$(OBJS_DIR)/psm_common.o := SMOFF += deref_check + # # Default build targets. # diff --git a/usr/src/uts/i86pc/dr/Makefile b/usr/src/uts/i86pc/dr/Makefile index 84d6ff1a4f..90d07cf914 100644 --- a/usr/src/uts/i86pc/dr/Makefile +++ b/usr/src/uts/i86pc/dr/Makefile @@ -25,10 +25,7 @@ # Copyright (c) 2010, Intel Corporation. # All rights reserved. # -# This makefile drives the production of the dr driver module. -# -# i86pc architecture dependent -# +# Copyright (c) 2018, Joyent, Inc. # # Path to the base of the uts directory tree (usually /usr/src/uts). @@ -72,6 +69,9 @@ CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-uninitialized CERRWARN += -_gcc=-Wno-empty-body +# needs work +SMOFF += index_overflow + # # module dependencies # diff --git a/usr/src/uts/i86pc/i86hvm/Makefile.i86hvm b/usr/src/uts/i86pc/i86hvm/Makefile.i86hvm index 74d04631ab..18b0397f70 100644 --- a/usr/src/uts/i86pc/i86hvm/Makefile.i86hvm +++ b/usr/src/uts/i86pc/i86hvm/Makefile.i86hvm @@ -23,6 +23,7 @@ # Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # +# Copyright (c) 2018, Joyent, Inc. ROOT_HVM_DIR = $(ROOT_PLAT_DIR)/i86hvm ROOT_HVM_MOD_DIR = $(ROOT_HVM_DIR)/kernel @@ -58,3 +59,6 @@ LINT_LIB_DIR = $(UTSBASE)/$(PLATFORM)/lint-libs/$(OBJS_DIR) # CPPFLAGS += -DXPV_HVM_DRIVER -D_SOLARIS ASFLAGS += -DXPV_HVM_DRIVER + +# needs work +SMATCH=off diff --git a/usr/src/uts/i86pc/isa/Makefile b/usr/src/uts/i86pc/isa/Makefile index 9cfd72f370..40412e11b9 100644 --- a/usr/src/uts/i86pc/isa/Makefile +++ b/usr/src/uts/i86pc/isa/Makefile @@ -23,7 +23,7 @@ # Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -# Copyright 2016 Joyent, Inc. +# Copyright (c) 2018, Joyent, Inc. # # This makefile drives the production of the ISA nexus driver # @@ -58,6 +58,9 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) $(OBJS_DIR)/isa.o := CERRWARN += -_gcc=-Wno-unused-function +# needs work +$(OBJS_DIR)/i8237A.o := SMOFF += indenting + # # lint pass one enforcement # diff --git a/usr/src/uts/i86pc/pcie/Makefile b/usr/src/uts/i86pc/pcie/Makefile index 475ed19ff7..2451a9d8f0 100644 --- a/usr/src/uts/i86pc/pcie/Makefile +++ b/usr/src/uts/i86pc/pcie/Makefile @@ -24,12 +24,7 @@ # Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -# -# This makefile drives the production of the kernel/misc/pcie module -# for PCI-E Error handling support in PCI-E nexus drivers. -# -# i86pc implementation architecture dependent -# +# Copyright (c) 2018, Joyent, Inc. # # Path to the base of the uts directory tree (usually /usr/src/uts). @@ -69,6 +64,9 @@ CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-unused-variable CERRWARN += -_gcc=-Wno-unused-function # safe +# needs work +SMOFF += all_func_returns,deref_check + # # Default build targets. # diff --git a/usr/src/uts/i86pc/pcplusmp/Makefile b/usr/src/uts/i86pc/pcplusmp/Makefile index 6795ea994a..ee597e2b3b 100644 --- a/usr/src/uts/i86pc/pcplusmp/Makefile +++ b/usr/src/uts/i86pc/pcplusmp/Makefile @@ -24,7 +24,7 @@ # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -# Copyright 2017, Joyent, Inc. +# Copyright (c) 2018, Joyent, Inc. # # @@ -67,6 +67,11 @@ $(NOT_RELEASE_BUILD)DEBUG_DEFS += $(DEBUG_FLGS) # LDFLAGS += -dy -N misc/acpica +# needs work +$(OBJS_DIR)/mp_platform_common.o := SMOFF += indenting +# needs work +$(OBJS_DIR)/psm_common.o := SMOFF += deref_check + # # Default build targets. # diff --git a/usr/src/uts/i86pc/rootnex/Makefile b/usr/src/uts/i86pc/rootnex/Makefile index 63b027b90e..5f2410edef 100644 --- a/usr/src/uts/i86pc/rootnex/Makefile +++ b/usr/src/uts/i86pc/rootnex/Makefile @@ -24,10 +24,7 @@ # Copyright (c) 2011 Bayard G. Bell. All rights reserved. # Use is subject to license terms. # -# This makefile drives the production of the rootnex driver -# -# i86pc implementation architecture dependent -# +# Copyright (c) 2018, Joyent, Inc. # # Path to the base of the uts directory tree (usually /usr/src/uts). @@ -74,6 +71,9 @@ CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-unused-function CERRWARN += -_gcc=-Wno-uninitialized +# needs work +$(OBJS_DIR)/immu_qinv.o := SMOFF += index_overflow + # # Default build targets. # diff --git a/usr/src/uts/i86pc/unix/Makefile b/usr/src/uts/i86pc/unix/Makefile index 24dbc2970a..54bad0496c 100644 --- a/usr/src/uts/i86pc/unix/Makefile +++ b/usr/src/uts/i86pc/unix/Makefile @@ -18,16 +18,11 @@ # # CDDL HEADER END # - -# # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # Copyright 2016 Joyent, Inc. # -# This makefile drives the production of unix (and unix.o). -# -# i86pc implementation architecture dependent -# +# Copyright (c) 2018, Joyent, Inc. # # Path to the base of the uts directory tree (usually /usr/src/uts). @@ -163,6 +158,16 @@ CERRWARN += -_gcc=-Wno-clobbered CERRWARN += -_gcc=-Wno-empty-body CERRWARN += -_gcc=-Wno-unused-value +# false positives +SMOFF += index_overflow + +# needs work +SMOFF += all_func_returns,deref_check,signed + +$(OBJS_DIR)/fmsmb.o := SMOFF += indenting +$(OBJS_DIR)/zutil.o := SMOFF += indenting +$(OBJS_DIR)/bootrd_cpio.o := SMOFF += allocating_enough_data + # Ensure that lint sees 'struct cpu' containing a fully declared # embedded 'struct machcpu' # diff --git a/usr/src/uts/i86pc/uppc/Makefile b/usr/src/uts/i86pc/uppc/Makefile index 5e3dc71b4c..dbd949be09 100644 --- a/usr/src/uts/i86pc/uppc/Makefile +++ b/usr/src/uts/i86pc/uppc/Makefile @@ -23,7 +23,7 @@ # Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -# Copyright 2016 Joyent, Inc. +# Copyright (c) 2018, Joyent, Inc. # # This makefile drives the production of the uppc mach # kernel module. @@ -63,6 +63,9 @@ CERRWARN += -_gcc=-Wno-unused-function DEBUG_FLGS = DEBUG_DEFS += $(DEBUG_FLGS) +# needs work +$(OBJS_DIR)/psm_common.o := SMOFF += deref_check + # # Depends on ACPI CA interpreter # diff --git a/usr/src/uts/i86xpv/isa/Makefile b/usr/src/uts/i86xpv/isa/Makefile index 04df9350d3..348a36ba23 100644 --- a/usr/src/uts/i86xpv/isa/Makefile +++ b/usr/src/uts/i86xpv/isa/Makefile @@ -23,7 +23,7 @@ # Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -# Copyright 2016 Joyent, Inc. +# Copyright (c) 2018, Joyent, Inc. # # This makefile drives the production of the ISA nexus driver # @@ -58,6 +58,9 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) $(OBJS_DIR)/isa.o := CERRWARN += -_gcc=-Wno-unused-function +# needs work +$(OBJS_DIR)/i8237A.o := SMOFF += indenting + # # lint pass one enforcement # diff --git a/usr/src/uts/i86xpv/unix/Makefile b/usr/src/uts/i86xpv/unix/Makefile index b244c02387..d078cd727e 100644 --- a/usr/src/uts/i86xpv/unix/Makefile +++ b/usr/src/uts/i86xpv/unix/Makefile @@ -23,7 +23,7 @@ # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -# Copyright 2016 Joyent, Inc. +# Copyright (c) 2018, Joyent, Inc. # # This makefile drives the production of unix (and unix.o). # @@ -150,6 +150,9 @@ CERRWARN += -_gcc=-Wno-clobbered CERRWARN += -_gcc=-Wno-unused-value CERRWARN += -_gcc=-Wno-empty-body +# needs work +SMATCH=off + # Ensure that lint sees 'struct cpu' containing a fully declared # embedded 'struct machcpu' # diff --git a/usr/src/uts/i86xpv/xnb/Makefile b/usr/src/uts/i86xpv/xnb/Makefile index 132ede9860..59d6c55882 100644 --- a/usr/src/uts/i86xpv/xnb/Makefile +++ b/usr/src/uts/i86xpv/xnb/Makefile @@ -23,12 +23,7 @@ # Copyright 2010 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -# -# This makefile drives the production of the xnb -# network driver support module. -# -# i86xpv architecture dependent -# +# Copyright (c) 2018, Joyent, Inc. # # Path to the base of the uts directory tree (usually /usr/src/uts). @@ -78,6 +73,9 @@ LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN CERRWARN += -_gcc=-Wno-uninitialized +# needs work +SMOFF += signed + # # Default build targets. # diff --git a/usr/src/uts/i86xpv/xnf/Makefile b/usr/src/uts/i86xpv/xnf/Makefile index 7bc5c8844f..e897ea37e2 100644 --- a/usr/src/uts/i86xpv/xnf/Makefile +++ b/usr/src/uts/i86xpv/xnf/Makefile @@ -25,13 +25,7 @@ # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -# ident "%Z%%M% %I% %E% SMI" -# -# This makefile drives the production of the xve -# network driver kernel module. -# -# i86xpv architecture dependent -# +# Copyright (c) 2018, Joyent, Inc. # # Path to the base of the uts directory tree (usually /usr/src/uts). @@ -73,6 +67,9 @@ LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV LINTTAGS += -erroff=E_PTRDIFF_OVERFLOW LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN +# needs work +SMATCH=off + # # Default build targets. # diff --git a/usr/src/uts/i86xpv/xpv_psm/Makefile b/usr/src/uts/i86xpv/xpv_psm/Makefile index 23d1b62ba4..f971123f53 100644 --- a/usr/src/uts/i86xpv/xpv_psm/Makefile +++ b/usr/src/uts/i86xpv/xpv_psm/Makefile @@ -23,7 +23,7 @@ # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -# Copyright 2016 Joyent, Inc. +# Copyright (c) 2018, Joyent, Inc. # # @@ -81,6 +81,9 @@ CERRWARN += -_gcc=-Wno-uninitialized CERRWARN += -_gcc=-Wno-empty-body CERRWARN += -_gcc=-Wno-unused-function +# needs work +SMATCH=off + # Default build targets. # .KEEP_STATE: diff --git a/usr/src/uts/i86xpv/xpv_uppc/Makefile b/usr/src/uts/i86xpv/xpv_uppc/Makefile index 81537582ac..be887878b9 100644 --- a/usr/src/uts/i86xpv/xpv_uppc/Makefile +++ b/usr/src/uts/i86xpv/xpv_uppc/Makefile @@ -23,7 +23,7 @@ # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -# Copyright 2016 Joyent, Inc. +# Copyright (c) 2018, Joyent, Inc. # # This makefile drives the production of the xpv_uppc mach # kernel module. @@ -64,6 +64,9 @@ DEBUG_DEFS += $(DEBUG_FLGS) CERRWARN += -_gcc=-Wno-unused-function +# needs work +$(OBJS_DIR)/psm_common.o := SMOFF += deref_check + # # # Depends on ACPI CA interpreter diff --git a/usr/src/uts/intel/FSS/Makefile b/usr/src/uts/intel/FSS/Makefile index e5ccd5a9a0..dd4ea315d6 100644 --- a/usr/src/uts/intel/FSS/Makefile +++ b/usr/src/uts/intel/FSS/Makefile @@ -22,8 +22,7 @@ # Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -# uts/intel/FSS/Makefile -# +# Copyright (c) 2018, Joyent, Inc. # # This makefile drives the production of the FSS scheduling class @@ -66,6 +65,9 @@ LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV CERRWARN += -_gcc=-Wno-uninitialized +# needs work +$(OBJS_DIR)/fss.o := SMOFF += deref_check + # # Default build targets. # diff --git a/usr/src/uts/intel/aac/Makefile b/usr/src/uts/intel/aac/Makefile index d619d9fece..dc832d136e 100644 --- a/usr/src/uts/intel/aac/Makefile +++ b/usr/src/uts/intel/aac/Makefile @@ -23,6 +23,7 @@ # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # +# Copyright (c) 2018, Joyent, Inc. # # This makefile drives the production of the aac driver kernel module. @@ -71,6 +72,9 @@ CERRWARN += -_gcc=-Wno-unused-value CERRWARN += -_gcc=-Wno-unused-label CERRWARN += -_gcc=-Wno-switch +# needs work +$(OBJS_DIR)/aac.o := SMOFF += shift_to_zero + # # Default build targets. # diff --git a/usr/src/uts/intel/ac97/Makefile b/usr/src/uts/intel/ac97/Makefile index 2905c1a6ad..17e0293df5 100644 --- a/usr/src/uts/intel/ac97/Makefile +++ b/usr/src/uts/intel/ac97/Makefile @@ -24,7 +24,7 @@ # Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -# This makefile drives the production of the ac97 support module. +# Copyright (c) 2018, Joyent, Inc. # # @@ -54,6 +54,9 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) LDFLAGS += -dy -Ndrv/audio +# needs work +$(OBJS_DIR)/ac97.o := SMOFF += index_overflow + # # Default build targets. # diff --git a/usr/src/uts/intel/acpica/Makefile b/usr/src/uts/intel/acpica/Makefile index a72d55bacb..e9ae57ab4c 100644 --- a/usr/src/uts/intel/acpica/Makefile +++ b/usr/src/uts/intel/acpica/Makefile @@ -2,7 +2,7 @@ # Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -# Copyright 2016 Joyent, Inc. +# Copyright (c) 2018, Joyent, Inc. # # # This makefile drives the production of the ACPI CA services @@ -54,6 +54,8 @@ CFLAGS += $(CCVERBOSE) -DPWRDMN -DACPI_USE_LOCAL_CACHE -DACPI_DEBUG_OUTPUT # CERRWARN += -erroff=E_STATEMENT_NOT_REACHED +SMOFF += all_func_returns + LINTFLAGS += -errchk=%none LINTFLAGS += -errhdr=%none LINTFLAGS += -erroff=%all diff --git a/usr/src/uts/intel/agpgart/Makefile b/usr/src/uts/intel/agpgart/Makefile index e80b1db6cf..85153fd65c 100644 --- a/usr/src/uts/intel/agpgart/Makefile +++ b/usr/src/uts/intel/agpgart/Makefile @@ -2,8 +2,7 @@ # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -# uts/intel/agpgart/Makefile -# +# Copyright (c) 2018, Joyent, Inc. # # This makefile drives the framework of agp protocol @@ -39,6 +38,9 @@ CERRWARN += -_gcc=-Wno-switch CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-uninitialized +# needs work +$(OBJS_DIR)/agpgart.o := SMOFF += deref_check + # # For now, disable these lint checks; maintainers should endeavor # to investigate and remove these for maximum lint coverage. diff --git a/usr/src/uts/intel/amd8111s/Makefile b/usr/src/uts/intel/amd8111s/Makefile index ae77fff1bf..1a6309b68e 100755 --- a/usr/src/uts/intel/amd8111s/Makefile +++ b/usr/src/uts/intel/amd8111s/Makefile @@ -22,11 +22,7 @@ # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -# ident "%Z%%M% %I% %E% SMI" -# -# This makefile drives the production of the AMD8111 -# Fast Ethernet (amd8111s) driver module in intel systems -# +# Copyright (c) 2018, Joyent, Inc. # # Path to the base of the uts directory tree (usually /usr/src/uts). @@ -62,6 +58,9 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) # LDFLAGS += -dy -N misc/mac +# seems wrong +$(OBJS_DIR)/amd8111s_hw.o := SMOFF += precedence + # # Default build targets. # diff --git a/usr/src/uts/intel/arcmsr/Makefile b/usr/src/uts/intel/arcmsr/Makefile index 286162de07..d389365c10 100644 --- a/usr/src/uts/intel/arcmsr/Makefile +++ b/usr/src/uts/intel/arcmsr/Makefile @@ -21,6 +21,7 @@ # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # +# Copyright (c) 2018, Joyent, Inc. # # Paths to the base of the uts directory trees @@ -46,6 +47,9 @@ CERRWARN += -_gcc=-Wno-unused-label CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-uninitialized +# needs work +$(OBJS_DIR)/arcmsr.o := SMOFF += deref_check + # # Define targets. # diff --git a/usr/src/uts/intel/arn/Makefile b/usr/src/uts/intel/arn/Makefile index fc133828cd..f25a80418f 100644 --- a/usr/src/uts/intel/arn/Makefile +++ b/usr/src/uts/intel/arn/Makefile @@ -22,6 +22,7 @@ # Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # +# Copyright (c) 2018, Joyent, Inc. # @@ -38,7 +39,7 @@ UTSBASE = ../.. # Define the module and object file sets. # MODULE = arn -OBJECTS = $(ARN_OBJS:%=$(OBJS_DIR)/%) +OBJECTS = $(ARN_OBJS:%=$(OBJS_DIR)/%) LINTS = $(ARN_OBJS:%.o=$(LINTS_DIR)/%.ln) ROOTMODULE = $(ROOT_DRV_DIR)/$(MODULE) @@ -65,6 +66,9 @@ CERRWARN += -_gcc=-Wno-unused-variable CERRWARN += -_gcc=-Wno-uninitialized CERRWARN += -_gcc=-Wno-char-subscripts +# various issues +SMATCH=off + # # Default build targets. # diff --git a/usr/src/uts/intel/arp/Makefile b/usr/src/uts/intel/arp/Makefile index 9b91950434..33a2cbb716 100644 --- a/usr/src/uts/intel/arp/Makefile +++ b/usr/src/uts/intel/arp/Makefile @@ -24,10 +24,7 @@ # Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -# This makefile drives the production of the arp driver kernel module. -# -# intel implementation architecture dependent -# +# Copyright (c) 2018, Joyent, Inc. # # Path to the base of the uts directory tree (usually /usr/src/uts). @@ -76,6 +73,9 @@ LDFLAGS += -dy -Ndrv/ip LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV +# false positive +SMOFF += index_overflow + # # Default build targets. # diff --git a/usr/src/uts/intel/ath/Makefile b/usr/src/uts/intel/ath/Makefile index fbf5b7d6eb..30c72db1b4 100644 --- a/usr/src/uts/intel/ath/Makefile +++ b/usr/src/uts/intel/ath/Makefile @@ -22,6 +22,7 @@ # Copyright 2010 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # +# Copyright (c) 2018, Joyent, Inc. # # This file makes the atheros driver for an intel system @@ -66,6 +67,9 @@ CERRWARN += -_gcc=-Wno-type-limits CERRWARN += -_gcc=-Wno-unused-variable CERRWARN += -_gcc=-Wno-empty-body +# needs work +$(OBJS_DIR)/ath_rate.o := SMOFF += index_overflow + # # Default build targets. # diff --git a/usr/src/uts/intel/atu/Makefile b/usr/src/uts/intel/atu/Makefile index 958ead1731..4418857ce5 100644 --- a/usr/src/uts/intel/atu/Makefile +++ b/usr/src/uts/intel/atu/Makefile @@ -22,6 +22,7 @@ # Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # +# Copyright (c) 2018, Joyent, Inc. # # This makefile drives the production of the atu driver kernel module. @@ -61,6 +62,9 @@ LDFLAGS += -dy -Nmisc/mac -Nmisc/net80211 -Nmisc/usba CERRWARN += -_gcc=-Wno-switch +# needs work +$(OBJS_DIR)/atu.o := SMOFF += all_func_returns + # # Default build targets. # diff --git a/usr/src/uts/intel/audio/Makefile b/usr/src/uts/intel/audio/Makefile index 7a3ba33a11..6b9547d4b5 100644 --- a/usr/src/uts/intel/audio/Makefile +++ b/usr/src/uts/intel/audio/Makefile @@ -24,8 +24,7 @@ # Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -# This makefile drives the production of the audio support module. -# +# Copyright (c) 2018, Joyent, Inc. # # Path to the base of the uts directory tree (usually /usr/src/uts). @@ -48,6 +47,9 @@ include $(UTSBASE)/intel/Makefile.intel CERRWARN += -_gcc=-Wno-uninitialized +# needs work +$(OBJS_DIR)/audio_grc3.o := SMOFF += index_overflow + # # Define targets # diff --git a/usr/src/uts/intel/audioemu10k/Makefile b/usr/src/uts/intel/audioemu10k/Makefile index d0155c40fe..c115cc4024 100644 --- a/usr/src/uts/intel/audioemu10k/Makefile +++ b/usr/src/uts/intel/audioemu10k/Makefile @@ -24,8 +24,7 @@ # Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -# This makefile drives the production of the audioemu10k driver. -# +# Copyright (c) 2018, Joyent, Inc. # # Path to the base of the uts directory tree (usually /usr/src/uts). @@ -62,6 +61,9 @@ LDFLAGS += -dy -Ndrv/audio -Nmisc/ac97 CERRWARN += -_gcc=-Wno-uninitialized +# needs work +SMOFF += all_func_returns + $(OBJS_DIR)/%.o := CPPFLAGS += -I$(OBJS_DIR) $(OBJS_DIR)/%.ln := CPPFLAGS += -I$(OBJS_DIR) $(OBJS_DIR)/emu10k_gpr.h := ASM10KFLAGS = -v -0 -P gpr diff --git a/usr/src/uts/intel/audiosolo/Makefile b/usr/src/uts/intel/audiosolo/Makefile index d8eac43ea9..cc3e29e1ca 100644 --- a/usr/src/uts/intel/audiosolo/Makefile +++ b/usr/src/uts/intel/audiosolo/Makefile @@ -24,8 +24,7 @@ # Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -# This makefile drives the production of the audiosolo driver. -# +# Copyright (c) 2018, Joyent, Inc. # # Path to the base of the uts directory tree (usually /usr/src/uts). @@ -56,6 +55,9 @@ LDFLAGS += -dy -Ndrv/audio CERRWARN += -_gcc=-Wno-uninitialized +# needs work +SMOFF += assign_vs_compare + # # Default build targets. # diff --git a/usr/src/uts/intel/av1394/Makefile b/usr/src/uts/intel/av1394/Makefile index 9ccf35ed33..acf063f91e 100644 --- a/usr/src/uts/intel/av1394/Makefile +++ b/usr/src/uts/intel/av1394/Makefile @@ -22,6 +22,7 @@ # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # +# Copyright (c) 2018, Joyent, Inc. # # Path to the base of the uts directory tree. @@ -74,6 +75,9 @@ CERRWARN += -_gcc=-Wno-uninitialized CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-type-limits +# needs work +$(OBJS_DIR)/av1394_isoch.o := SMOFF += signed + # # depends on misc/s1394 LDFLAGS += -dy -Nmisc/s1394 diff --git a/usr/src/uts/intel/bge/Makefile b/usr/src/uts/intel/bge/Makefile index 661d2b4fb3..eedd8c38c6 100644 --- a/usr/src/uts/intel/bge/Makefile +++ b/usr/src/uts/intel/bge/Makefile @@ -22,6 +22,7 @@ # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # +# Copyright (c) 2018, Joyent, Inc. # # This makefile drives the production of the Broadcom BCM57xx @@ -70,6 +71,9 @@ CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-unused-variable CERRWARN += -_gcc=-Wno-unused-function +# 3rd party source +SMOFF += all_func_returns + # # Driver depends on MAC # diff --git a/usr/src/uts/intel/blowfish/Makefile b/usr/src/uts/intel/blowfish/Makefile index 97ddabc38e..dd40e59c1e 100644 --- a/usr/src/uts/intel/blowfish/Makefile +++ b/usr/src/uts/intel/blowfish/Makefile @@ -18,6 +18,8 @@ # # CDDL HEADER END # +# Copyright (c) 2018, Joyent, Inc. +# # Copyright 2014 Garrett D'Amore <garrett@damore.org> # # Copyright 2008 Sun Microsystems, Inc. All rights reserved. @@ -76,6 +78,9 @@ LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV CERRWARN += -_gcc=-Wno-uninitialized CERRWARN += -_gcc=-Wno-parentheses +# needs work +$(OBJS_DIR)/blowfish_impl.o := SMOFF += precedence + # # Default build targets. # diff --git a/usr/src/uts/intel/bofi/Makefile b/usr/src/uts/intel/bofi/Makefile index 14a5fd7bc0..e419840e5f 100644 --- a/usr/src/uts/intel/bofi/Makefile +++ b/usr/src/uts/intel/bofi/Makefile @@ -22,6 +22,7 @@ # Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # +# Copyright (c) 2018, Joyent, Inc. # # This makefile drives the production of the bofi driver @@ -70,6 +71,9 @@ CPPFLAGS += -I../../sun4 CERRWARN += -_gcc=-Wno-uninitialized +# needs work +$(OBJS_DIR)/bofi.o := SMOFF += signed_integer_overflow_check,deref_check + # # For now, disable these lint checks; maintainers should endeavor # to investigate and remove these for maximum lint coverage. diff --git a/usr/src/uts/intel/bpf/Makefile b/usr/src/uts/intel/bpf/Makefile index 8986871c95..08e92c6fc7 100644 --- a/usr/src/uts/intel/bpf/Makefile +++ b/usr/src/uts/intel/bpf/Makefile @@ -22,10 +22,12 @@ # Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # +# Copyright (c) 2018, Joyent, Inc. +# # uts/intel/bpf/Makefile # # -# This makefile drives the production of the bpf driver +# This makefile drives the production of the bpf driver # kernel module. # # intel architecture dependent @@ -73,6 +75,9 @@ LINTTAGS += -erroff=E_PTRDIFF_OVERFLOW -erroff=E_BAD_PTR_CAST_ALIGN CERRWARN += -_gcc=-Wno-unused-label CERRWARN += -_gcc=-Wno-uninitialized +# needs work +$(OBJS_DIR)/bpf.o := SMOFF += all_func_returns + # # Default build targets. # @@ -88,7 +93,7 @@ clobber: $(CLOBBER_DEPS) lint: $(LINT_DEPS) -modlintlib: $(MODLINTLIB_DEPS) +modlintlib: $(MODLINTLIB_DEPS) clean.lint: $(CLEAN_LINT_DEPS) diff --git a/usr/src/uts/intel/cardbus/Makefile b/usr/src/uts/intel/cardbus/Makefile index 4b5fa7e764..a6eba6f056 100644 --- a/usr/src/uts/intel/cardbus/Makefile +++ b/usr/src/uts/intel/cardbus/Makefile @@ -22,8 +22,7 @@ # Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -# uts/intel/cardbus/Makefile -# +# Copyright (c) 2018, Joyent, Inc. # # This makefile drives the production of the cardbus kernel module. @@ -56,7 +55,7 @@ ALL_TARGET = $(BINARY) LINT_TARGET = $(MODULE).lint INSTALL_TARGET = $(BINARY) $(ROOTMODULE) -# +# # Include sun4u specific header files # INC_PATH += -I$(UTSBASE)/sun4u -I$(UTSBASE)/sun4 -I$(UTSBASE)/i86pc @@ -87,6 +86,8 @@ CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-unused-function CERRWARN += -_gcc=-Wno-unused-variable +SMOFF += indenting,no_if_block + # # Default build targets. # diff --git a/usr/src/uts/intel/chxge/Makefile b/usr/src/uts/intel/chxge/Makefile index dd835a13d2..1e2c3636d4 100644 --- a/usr/src/uts/intel/chxge/Makefile +++ b/usr/src/uts/intel/chxge/Makefile @@ -23,6 +23,7 @@ # Use is subject to license terms. # Copyright 2018 Joyent, Inc. # +# Copyright (c) 2018, Joyent, Inc. # # This makefile drives the production of the Chelsio N110 @@ -105,6 +106,11 @@ CERRWARN += -_gcc=-Wno-unused-function CERRWARN += -_gcc=-Wno-unused-variable CERRWARN += -_gcc=-Wno-parentheses +SMOFF += indenting,all_func_returns,no_if_block + +# needs work +$(OBJS_DIR)/sge.o := SMOFF += index_overflow + # # # Default build targets. diff --git a/usr/src/uts/intel/clone/Makefile b/usr/src/uts/intel/clone/Makefile index f2018b056e..06c6223eb7 100644 --- a/usr/src/uts/intel/clone/Makefile +++ b/usr/src/uts/intel/clone/Makefile @@ -25,12 +25,7 @@ # Copyright 2004 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -#pragma ident "%Z%%M% %I% %E% SMI" -# -# This makefile drives the production of the clone driver -# -# intel implementation architecture dependent -# +# Copyright (c) 2018, Joyent, Inc. # # Path to the base of the uts directory tree (usually /usr/src/uts). @@ -58,6 +53,9 @@ ALL_TARGET = $(BINARY) $(SRC_CONFILE) LINT_TARGET = $(MODULE).lint INSTALL_TARGET = $(BINARY) $(ROOTMODULE) $(ROOT_CONFFILE) +# needs work +$(OBJS_DIR)/clone.o := SMOFF += all_func_returns + # # Default build targets. # diff --git a/usr/src/uts/intel/cmlb/Makefile b/usr/src/uts/intel/cmlb/Makefile index 45158fec56..8e09b5c030 100644 --- a/usr/src/uts/intel/cmlb/Makefile +++ b/usr/src/uts/intel/cmlb/Makefile @@ -23,11 +23,8 @@ # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -# This makefile drives the production of the cmlb "misc" -# kernel module. -# -# intel architecture dependent -# +# Copyright (c) 2018, Joyent, Inc. + # # Path to the base of the uts directory tree (usually /usr/src/uts). @@ -80,6 +77,9 @@ CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-unused-function CERRWARN += -_gcc=-Wno-uninitialized +# needs work +$(OBJS_DIR)/cmlb.o := SMOFF += signed + # # Default build targets. # diff --git a/usr/src/uts/intel/cpqary3/Makefile b/usr/src/uts/intel/cpqary3/Makefile index 245a86c8cb..a2f1207c25 100644 --- a/usr/src/uts/intel/cpqary3/Makefile +++ b/usr/src/uts/intel/cpqary3/Makefile @@ -10,7 +10,7 @@ # # -# Copyright 2013 Joyent, Inc. All rights reserved. +# Copyright (c) 2018, Joyent, Inc. # # @@ -46,6 +46,8 @@ CPPFLAGS += -I$(UTSBASE)/common/io/cpqary3 # LDFLAGS += -dy -Nmisc/scsi +SMATCH=off + # # Default build targets. # diff --git a/usr/src/uts/intel/ctfs/Makefile b/usr/src/uts/intel/ctfs/Makefile index cbe7dd1c34..03934580b6 100644 --- a/usr/src/uts/intel/ctfs/Makefile +++ b/usr/src/uts/intel/ctfs/Makefile @@ -22,6 +22,7 @@ # Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # +# Copyright (c) 2018, Joyent, Inc. # # This makefile drives the production of the contract file system @@ -64,6 +65,9 @@ LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV CERRWARN += -_gcc=-Wno-parentheses +# needs work +$(OBJS_DIR)/ctfs_root.o := SMOFF += signed_integer_overflow_check + # # Default build targets. # diff --git a/usr/src/uts/intel/cxgbe/t4nex/Makefile b/usr/src/uts/intel/cxgbe/t4nex/Makefile index 8185b52238..20ddeb8cf7 100644 --- a/usr/src/uts/intel/cxgbe/t4nex/Makefile +++ b/usr/src/uts/intel/cxgbe/t4nex/Makefile @@ -12,6 +12,7 @@ # # Copyright (c) 2013 by Chelsio Communications, Inc. All rights reserved. # +# Copyright (c) 2018, Joyent, Inc. # # This makefile drives the production of the Chelsio Terminator 4 10G Ethernet @@ -90,6 +91,9 @@ LINTTAGS += -erroff=E_FUNC_RET_MAYBE_IGNORED2 LINTTAGS += -erroff=E_CASE_FALLTHRU LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV +# needs work +SMATCH=off + # # Default build targets. # diff --git a/usr/src/uts/intel/dadk/Makefile b/usr/src/uts/intel/dadk/Makefile index 85c6ff48be..d64833d0be 100644 --- a/usr/src/uts/intel/dadk/Makefile +++ b/usr/src/uts/intel/dadk/Makefile @@ -24,11 +24,7 @@ # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -# This makefile drives the production of the dadk "misc" -# kernel module. -# -# intel architecture dependent -# +# Copyright (c) 2018, Joyent, Inc. # # Path to the base of the uts directory tree (usually /usr/src/uts). @@ -75,6 +71,9 @@ LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV CERRWARN += -_gcc=-Wno-parentheses +# needs work +SMOFF += all_func_returns,signed + # # Default build targets. # diff --git a/usr/src/uts/intel/daplt/Makefile b/usr/src/uts/intel/daplt/Makefile index 3dcf2d7e07..ef99701369 100644 --- a/usr/src/uts/intel/daplt/Makefile +++ b/usr/src/uts/intel/daplt/Makefile @@ -23,6 +23,7 @@ # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # +# Copyright (c) 2018, Joyent, Inc. # # Paths to the base of the uts directory trees @@ -74,6 +75,9 @@ CERRWARN += -_gcc=-Wno-unused-variable CERRWARN += -_gcc=-Wno-unused-function CERRWARN += -_gcc=-Wno-uninitialized +# needs work +$(OBJS_DIR)/daplt.o := SMOFF += all_func_returns,deref_check + # # Default build targets. # diff --git a/usr/src/uts/intel/dca/Makefile b/usr/src/uts/intel/dca/Makefile index 034e2019c3..60cd04cd96 100644 --- a/usr/src/uts/intel/dca/Makefile +++ b/usr/src/uts/intel/dca/Makefile @@ -25,6 +25,7 @@ # Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # +# Copyright (c) 2018, Joyent, Inc. # # This makefile drives the production of the DCA kCF provider. @@ -40,7 +41,7 @@ UTSBASE = ../.. # # Define the module and object file sets. # -MODULE = dca +MODULE = dca OBJECTS = $(DCA_OBJS:%=$(OBJS_DIR)/%) LINTS = $(DCA_OBJS:%.o=$(LINTS_DIR)/%.ln) ROOTMODULE = $(ROOT_DRV_DIR)/$(MODULE) @@ -69,6 +70,9 @@ LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV CERRWARN += -_gcc=-Wno-parentheses +# needs work +$(OBJS_DIR)/dca_rsa.o := SMOFF += deref_check + # # Default build targets. # diff --git a/usr/src/uts/intel/devfs/Makefile b/usr/src/uts/intel/devfs/Makefile index c2a5b33098..9989fd4510 100644 --- a/usr/src/uts/intel/devfs/Makefile +++ b/usr/src/uts/intel/devfs/Makefile @@ -22,6 +22,7 @@ # Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # +# Copyright (c) 2018, Joyent, Inc. # # uts/intel/devfs/Makefile @@ -51,6 +52,9 @@ include $(UTSBASE)/intel/Makefile.intel CERRWARN += -_gcc=-Wno-parentheses +# needs work +$(OBJS_DIR)/devfs_vnops.o := SMOFF += signed + # # Define targets # diff --git a/usr/src/uts/intel/devinfo/Makefile b/usr/src/uts/intel/devinfo/Makefile index f9dd3056dd..98219434c6 100644 --- a/usr/src/uts/intel/devinfo/Makefile +++ b/usr/src/uts/intel/devinfo/Makefile @@ -24,6 +24,7 @@ # Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # +# Copyright (c) 2018, Joyent, Inc. # # This makefile drives the production of the devinfo kernel @@ -65,6 +66,9 @@ CERRWARN += -_gcc=-Wno-uninitialized CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-clobbered +# needs work +$(OBJS_DIR)/devinfo.o := SMOFF += deref_check,strcpy_overflow + # # Default build targets. # diff --git a/usr/src/uts/intel/dld/Makefile b/usr/src/uts/intel/dld/Makefile index beeef419a3..d2bf772b82 100644 --- a/usr/src/uts/intel/dld/Makefile +++ b/usr/src/uts/intel/dld/Makefile @@ -22,6 +22,7 @@ # Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # +# Copyright (c) 2018, Joyent, Inc. # # Path to the base of the uts directory tree (usually /usr/src/uts). @@ -70,6 +71,10 @@ CERRWARN += -_gcc=-Wno-uninitialized CERRWARN += -_gcc=-Wno-type-limits CERRWARN += -_gcc=-Wno-parentheses +# needs work +$(OBJS_DIR)/dld_proto.o := SMOFF += signed +$(OBJS_DIR)/dld_drv.o := SMOFF += cast_assign + # # Default build targets. # diff --git a/usr/src/uts/intel/dls/Makefile b/usr/src/uts/intel/dls/Makefile index 4546ae19e6..5bf2bdbcf8 100644 --- a/usr/src/uts/intel/dls/Makefile +++ b/usr/src/uts/intel/dls/Makefile @@ -22,6 +22,7 @@ # Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # +# Copyright (c) 2018, Joyent, Inc. # # Path to the base of the uts directory tree (usually /usr/src/uts). @@ -66,6 +67,10 @@ LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV CERRWARN += -_gcc=-Wno-uninitialized +# needs work +$(OBJS_DIR)/dls_link.o := SMOFF += all_func_returns + + # # Default build targets. # diff --git a/usr/src/uts/intel/dnet/Makefile b/usr/src/uts/intel/dnet/Makefile index e793392b1f..ea395c5f63 100644 --- a/usr/src/uts/intel/dnet/Makefile +++ b/usr/src/uts/intel/dnet/Makefile @@ -24,11 +24,7 @@ # Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -# This makefile drives the production of the dnet -# network driver kernel module. -# -# intel architecture dependent -# +# Copyright (c) 2018, Joyent, Inc. # # Path to the base of the uts directory tree (usually /usr/src/uts). @@ -67,6 +63,10 @@ LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-uninitialized +# needs work +$(OBJS_DIR)/dnet.o := SMOFF += index_overflow +$(OBJS_DIR)/dnet_mii.o := SMOFF += all_func_returns + LDFLAGS += -dy -N misc/mac # diff --git a/usr/src/uts/intel/doorfs/Makefile b/usr/src/uts/intel/doorfs/Makefile index f0bfcbee8b..289992ea9f 100644 --- a/usr/src/uts/intel/doorfs/Makefile +++ b/usr/src/uts/intel/doorfs/Makefile @@ -23,6 +23,7 @@ # Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # +# Copyright (c) 2018, Joyent, Inc. # # This makefile drives the production of the doorfs driver kernel module. @@ -76,6 +77,9 @@ LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-uninitialized +# needs work +$(OBJS_DIR)/door_sys.o := SMOFF += deref_check + # # Default build targets. # diff --git a/usr/src/uts/intel/drm/Makefile b/usr/src/uts/intel/drm/Makefile index 1e48127d53..69182b1531 100644 --- a/usr/src/uts/intel/drm/Makefile +++ b/usr/src/uts/intel/drm/Makefile @@ -23,6 +23,7 @@ # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # +# Copyright (c) 2018, Joyent, Inc. # # This makefile drives the production of the DRM (Direct Rendering @@ -56,6 +57,9 @@ CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-uninitialized CERRWARN += -_gcc=-Wno-unused-variable +# needs work +SMOFF += precedence,indenting,deref_check,all_func_returns + # # Define targets # diff --git a/usr/src/uts/intel/dtrace/Makefile b/usr/src/uts/intel/dtrace/Makefile index aeabf4a7e3..b3b5dd18ad 100644 --- a/usr/src/uts/intel/dtrace/Makefile +++ b/usr/src/uts/intel/dtrace/Makefile @@ -22,6 +22,7 @@ # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # +# Copyright (c) 2018, Joyent, Inc. UTSBASE = ../.. @@ -49,6 +50,9 @@ CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-type-limits CERRWARN += -_gcc=-Wno-uninitialized +# needs work +$(OBJS_DIR)/dtrace.o := SMOFF += signed_integer_overflow_check,deref_check + CPPFLAGS += -I$(SRC)/common/util ALL_TARGET = $(BINARY) $(SRC_CONFILE) diff --git a/usr/src/uts/intel/e1000g/Makefile b/usr/src/uts/intel/e1000g/Makefile index 65aa6b44bb..d48b8f77a0 100644 --- a/usr/src/uts/intel/e1000g/Makefile +++ b/usr/src/uts/intel/e1000g/Makefile @@ -22,13 +22,7 @@ # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -# uts/intel/e1000g/Makefile -# -# This makefile drives the production of the iprb -# network driver kernel module. -# -# intel architecture dependent -# +# Copyright (c) 2018, Joyent, Inc. # # Paths to the base of the uts directory trees @@ -71,6 +65,8 @@ CERRWARN += -_gcc=-Wno-unused-label CERRWARN += -_gcc=-Wno-unused-variable CERRWARN += -_cc=-erroff=E_STATEMENT_NOT_REACHED +SMOFF += all_func_returns,indenting,shift_to_zero + LINTTAGS += -erroff=E_CONSTANT_CONDITION # diff --git a/usr/src/uts/intel/ecc/Makefile b/usr/src/uts/intel/ecc/Makefile index 3302d43e23..04db887bcc 100644 --- a/usr/src/uts/intel/ecc/Makefile +++ b/usr/src/uts/intel/ecc/Makefile @@ -24,11 +24,7 @@ # Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -# -# This makefile drives the production of the ECc kef provider. -# -# intel implementation architecture dependent -# +# Copyright (c) 2018, Joyent, Inc. # # Path to the base of the uts directory tree (usually /usr/src/uts). @@ -76,6 +72,12 @@ CERRWARN += -_gcc=-Wno-empty-body CERRWARN += -_gcc=-Wno-unused-variable CERRWARN += -_gcc=-Wno-parentheses +# false positive +$(OBJS_DIR)/ecdecode.o := SMOFF += assign_vs_compare +$(OBJS_DIR)/ec.o := SMOFF += assign_vs_compare + +SMOFF += indenting,all_func_returns + # # Default build targets. # diff --git a/usr/src/uts/intel/ehci/Makefile b/usr/src/uts/intel/ehci/Makefile index 59ca760453..acae04f03c 100644 --- a/usr/src/uts/intel/ehci/Makefile +++ b/usr/src/uts/intel/ehci/Makefile @@ -22,9 +22,7 @@ # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -# -# This makefile drives the production of the ehci driver kernel module. -# +# Copyright (c) 2018, Joyent, Inc. # # Path to the base of the uts directory tree (usually /usr/src/uts). @@ -48,6 +46,9 @@ include $(UTSBASE)/intel/Makefile.intel CERRWARN += -_gcc=-Wno-uninitialized CERRWARN += -_gcc=-Wno-switch +# needs work +SMOFF += deref_check,shift_to_zero + # # depends on misc/usba # diff --git a/usr/src/uts/intel/eibnx/Makefile b/usr/src/uts/intel/eibnx/Makefile index dfcbf6bdc7..417c96518d 100644 --- a/usr/src/uts/intel/eibnx/Makefile +++ b/usr/src/uts/intel/eibnx/Makefile @@ -22,6 +22,7 @@ # # Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. # +# Copyright (c) 2018, Joyent, Inc. # # This makefile drives the production of the EoIB Nexus driver @@ -77,6 +78,9 @@ LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-uninitialized +# needs work +$(OBJS_DIR)/enx_ibt.o := SMOFF += deref_check + # # Default build targets # diff --git a/usr/src/uts/intel/emlxs/Makefile b/usr/src/uts/intel/emlxs/Makefile index 46594b4d60..4910ca9fdd 100644 --- a/usr/src/uts/intel/emlxs/Makefile +++ b/usr/src/uts/intel/emlxs/Makefile @@ -22,6 +22,7 @@ # Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # Copyright (c) 2011 Bayard G. Bell. All rights reserved. +# Copyright (c) 2018, Joyent, Inc. # # This makefile drives the production of the emlxs driver kernel module. # @@ -95,6 +96,11 @@ CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-unused-label CERRWARN += -_gcc=-Wno-uninitialized +SMOFF += indenting,deref_check,all_func_returns + +# seems definitely wrong +$(OBJS_DIR)/emlxs_fcf.o := SMOFF += logical_instead_of_bitwise + # # Default build targets. # diff --git a/usr/src/uts/intel/emul64/Makefile b/usr/src/uts/intel/emul64/Makefile index da916f1dbc..f7fdba6865 100644 --- a/usr/src/uts/intel/emul64/Makefile +++ b/usr/src/uts/intel/emul64/Makefile @@ -21,6 +21,7 @@ # Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # Copyright (c) 2011 Bayard G. Bell. All rights reserved. +# Copyright (c) 2018, Joyent, Inc. # # This makefile drives the production of the emul64 kernel # driver to testing hotplugging operations @@ -70,6 +71,9 @@ LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN CERRWARN += -_gcc=-Wno-unused-label CERRWARN += -_gcc=-Wno-uninitialized +# needs work +SMOFF += indenting,shift_to_zero + # # Depends on scsi # diff --git a/usr/src/uts/intel/eoib/Makefile b/usr/src/uts/intel/eoib/Makefile index f650f1eeac..f9097dfa01 100644 --- a/usr/src/uts/intel/eoib/Makefile +++ b/usr/src/uts/intel/eoib/Makefile @@ -22,6 +22,7 @@ # # Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. # +# Copyright (c) 2018, Joyent, Inc. # # This makefile drives the production of the EoIB Nexus driver @@ -66,6 +67,9 @@ CFLAGS += $(CCVERBOSE) CERRWARN += -_gcc=-Wno-switch CERRWARN += -_gcc=-Wno-uninitialized +# needs work +$(OBJS_DIR)/eib_ibt.o := SMOFF += deref_check + # # Depends on misc/ibtl # diff --git a/usr/src/uts/intel/fcip/Makefile b/usr/src/uts/intel/fcip/Makefile index f7187b5c4d..fd21612a52 100644 --- a/usr/src/uts/intel/fcip/Makefile +++ b/usr/src/uts/intel/fcip/Makefile @@ -23,10 +23,7 @@ # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -# This makefile drives the production of fcip driver kernel module. -# -# i86pc architecture dependent -# +# Copyright (c) 2018, Joyent, Inc. # # Path to the base of the uts directory tree (usually /usr/src/uts). @@ -74,6 +71,9 @@ LINTTAGS += -erroff=E_INCONS_VAL_TYPE_USED2 CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-type-limits +# needs work +SMATCH=off + # # Default build targets. # diff --git a/usr/src/uts/intel/fcoei/Makefile b/usr/src/uts/intel/fcoei/Makefile index 4f4c80292f..3a4aa6785c 100644 --- a/usr/src/uts/intel/fcoei/Makefile +++ b/usr/src/uts/intel/fcoei/Makefile @@ -22,8 +22,7 @@ # Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -# This makefile drives the production of the fcoei driver for -# LEADVILLE. +# Copyright (c) 2018, Joyent, Inc. # # Path to the base of the uts directory tree (usually /usr/src/uts). @@ -40,6 +39,9 @@ LINTS = $(FCOEI_OBJS:%.o=$(LINTS_DIR)/%.ln) ROOTMODULE = $(ROOT_DRV_DIR)/$(MODULE) CONF_SRCDIR = $(UTSBASE)/common/io/fibre-channel/fca/fcoei +# needs work +SMOFF += all_func_returns + # # Include common rules. # diff --git a/usr/src/uts/intel/fcoet/Makefile b/usr/src/uts/intel/fcoet/Makefile index b253318455..8f214649f9 100644 --- a/usr/src/uts/intel/fcoet/Makefile +++ b/usr/src/uts/intel/fcoet/Makefile @@ -22,8 +22,7 @@ # # Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. # -# This makefile drives the production of the fcoet driver for COMSTAR. -# +# Copyright (c) 2018, Joyent, Inc. # # Path to the base of the uts directory tree (usually /usr/src/uts). @@ -39,6 +38,9 @@ OBJECTS = $(FCOET_OBJS:%=$(OBJS_DIR)/%) LINTS = $(FCOET_OBJS:%.o=$(LINTS_DIR)/%.ln) ROOTMODULE = $(ROOT_DRV_DIR)/$(MODULE) +# needs work +SMOFF += all_func_returns,shift_to_zero + # # Include common rules. # diff --git a/usr/src/uts/intel/fcp/Makefile b/usr/src/uts/intel/fcp/Makefile index 9f22448393..1dfb19035f 100644 --- a/usr/src/uts/intel/fcp/Makefile +++ b/usr/src/uts/intel/fcp/Makefile @@ -23,8 +23,7 @@ # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -# This makefile drives the production of fcp driver kernel module. -# +# Copyright (c) 2018, Joyent, Inc. # # Path to the base of the uts directory tree (usually /usr/src/uts). @@ -69,6 +68,8 @@ CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-switch CERRWARN += -_gcc=-Wno-uninitialized +SMATCH=off + # # Default build targets. # diff --git a/usr/src/uts/intel/fct/Makefile b/usr/src/uts/intel/fct/Makefile index b61a18873d..ba4aa67b61 100644 --- a/usr/src/uts/intel/fct/Makefile +++ b/usr/src/uts/intel/fct/Makefile @@ -21,8 +21,7 @@ # # Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. # -# This makefile drives the production of the fct driver for -# COMSTAR. +# Copyright (c) 2018, Joyent, Inc. # # Path to the base of the uts directory tree (usually /usr/src/uts). @@ -74,6 +73,9 @@ CERRWARN += -_gcc=-Wno-unused-label CERRWARN += -_gcc=-Wno-switch CERRWARN += -_gcc=-Wno-uninitialized +# needs work +SMOFF += strcpy_overflow + # # Default build targets. # diff --git a/usr/src/uts/intel/fctl/Makefile b/usr/src/uts/intel/fctl/Makefile index e325f915e2..5d6dd01b08 100644 --- a/usr/src/uts/intel/fctl/Makefile +++ b/usr/src/uts/intel/fctl/Makefile @@ -23,12 +23,7 @@ # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -# ident "@(#)Makefile 1.10 08/07/25 SMI" -# -# This makefile drives the production of fctl driver kernel module. -# -# i86pc architecture dependent -# +# Copyright (c) 2018, Joyent, Inc. # # Path to the base of the uts directory tree (usually /usr/src/uts). @@ -70,6 +65,9 @@ LINTTAGS += -erroff=E_SUSPICIOUS_COMPARISON CERRWARN += -_gcc=-Wno-uninitialized +# needs work +$(OBJS_DIR)/fctl.o := SMOFF += all_func_returns,deref_check + # # Default build targets. # diff --git a/usr/src/uts/intel/fd/Makefile b/usr/src/uts/intel/fd/Makefile index 31f7be3535..fd08395482 100644 --- a/usr/src/uts/intel/fd/Makefile +++ b/usr/src/uts/intel/fd/Makefile @@ -24,12 +24,7 @@ # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # - -# -# This makefile drives the production of the floppy driver -# -# intel architecture dependent -# +# Copyright (c) 2018, Joyent, Inc. # # Path to the base of the uts directory tree (usually /usr/src/uts). @@ -72,6 +67,9 @@ LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV CERRWARN += -_gcc=-Wno-uninitialized +# needs work +$(OBJS_DIR)/fd.o := SMOFF += all_func_returns + # # Default build targets. # diff --git a/usr/src/uts/intel/fp/Makefile b/usr/src/uts/intel/fp/Makefile index 55f405d69f..63bb075df0 100644 --- a/usr/src/uts/intel/fp/Makefile +++ b/usr/src/uts/intel/fp/Makefile @@ -23,12 +23,7 @@ # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -# ident "@(#)Makefile 1.10 08/07/25 SMI" -# -# This makefile drives the production of fp driver kernel module. -# -# i86pc architecture dependent -# +# Copyright (c) 2018, Joyent, Inc. # # Path to the base of the uts directory tree (usually /usr/src/uts). @@ -79,6 +74,9 @@ LINTTAGS += -erroff=E_STATIC_UNUSED CERRWARN += -_gcc=-Wno-uninitialized CERRWARN += -_gcc=-Wno-unused-function +# needs work +$(OBJS_DIR)/fp.o := SMOFF += all_func_returns,deref_check + # # Default build targets. # diff --git a/usr/src/uts/intel/gen_drv/Makefile b/usr/src/uts/intel/gen_drv/Makefile index 7776a6d08b..bf58c6b4d7 100644 --- a/usr/src/uts/intel/gen_drv/Makefile +++ b/usr/src/uts/intel/gen_drv/Makefile @@ -22,11 +22,7 @@ # Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # - -# -# This makefile drives the production of the gen_drv kernel -# driver to testing hotplugging operations -# +# Copyright (c) 2018, Joyent, Inc. # # Path to the base of the uts directory tree (usually /usr/src/uts). @@ -64,6 +60,9 @@ LINTTAGS += -erroff=E_STATIC_UNUSED CERRWARN += -_gcc=-Wno-unused-variable +# needs work +$(OBJS_DIR)/gen_drv.o := SMOFF += indenting,deref_check + # # Default build targets. # diff --git a/usr/src/uts/intel/genunix/Makefile b/usr/src/uts/intel/genunix/Makefile index 897789505c..3603bce20a 100644 --- a/usr/src/uts/intel/genunix/Makefile +++ b/usr/src/uts/intel/genunix/Makefile @@ -23,6 +23,7 @@ # Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # +# Copyright (c) 2018, Joyent, Inc. # # This makefile drives the production of the generic @@ -110,6 +111,24 @@ CERRWARN += -_gcc=-Wno-uninitialized CERRWARN += -_gcc=-Wno-clobbered CERRWARN += -_gcc=-Wno-empty-body +# false positives +SMOFF += index_overflow +$(OBJS_DIR)/seg_vn.o := SMOFF += deref_check +$(OBJS_DIR)/ddi_intr_irm.o := SMOFF += deref_check + +# need work still +SMOFF += signed,indenting,all_func_returns +$(OBJS_DIR)/clock_highres.o := SMOFF += signed_integer_overflow_check +$(OBJS_DIR)/evchannels.o := SMOFF += allocating_enough_data +$(OBJS_DIR)/klpd.o := SMOFF += cast_assign +$(OBJS_DIR)/lookup.o := SMOFF += strcpy_overflow +$(OBJS_DIR)/process.o := SMOFF += or_vs_and +$(OBJS_DIR)/sunpci.o := SMOFF += deref_check +$(OBJS_DIR)/timers.o := SMOFF += signed_integer_overflow_check + +# definitely wrong +$(OBJS_DIR)/acl_common.o := SMOFF += or_vs_and + # # Ensure that lint sees 'struct cpu' containing a fully declared # embedded 'struct machcpu' diff --git a/usr/src/uts/intel/hermon/Makefile b/usr/src/uts/intel/hermon/Makefile index 1949d8f6ec..bfcc27f547 100644 --- a/usr/src/uts/intel/hermon/Makefile +++ b/usr/src/uts/intel/hermon/Makefile @@ -23,12 +23,7 @@ # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -# This makefile drives the production of the hermon InfiniBand module -# -# intel architecture dependent -# -# uts/intel/hermon/Makefile -# +# Copyright (c) 2018, Joyent, Inc. # # Path to the base of the uts directory tree (usually /usr/src/uts). @@ -78,6 +73,9 @@ CERRWARN += -_gcc=-Wno-unused-label CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-uninitialized +# needs work +SMATCH=off + # # Default build targets. # diff --git a/usr/src/uts/intel/hme/Makefile b/usr/src/uts/intel/hme/Makefile index ab1f31df18..d84a20ab87 100644 --- a/usr/src/uts/intel/hme/Makefile +++ b/usr/src/uts/intel/hme/Makefile @@ -24,9 +24,8 @@ # Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -# This makefile drives the production of the hme driver -# kernel module. -# +# Copyright (c) 2018, Joyent, Inc. + # # Path to the base of the uts directory tree (usually /usr/src/uts). @@ -63,6 +62,9 @@ CERRWARN += -_gcc=-Wno-switch CERRWARN += -_gcc=-Wno-unused-label CERRWARN += -_gcc=-Wno-uninitialized +# needs work +$(OBJS_DIR)/hme.o := SMOFF += indenting,deref_check + # # Default build targets. # diff --git a/usr/src/uts/intel/hook/Makefile b/usr/src/uts/intel/hook/Makefile index 91d0bda783..ab9f0b8e04 100644 --- a/usr/src/uts/intel/hook/Makefile +++ b/usr/src/uts/intel/hook/Makefile @@ -24,6 +24,7 @@ # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # +# Copyright (c) 2018, Joyent, Inc. # # This makefile drives the production of the hook driver kernel module. @@ -52,6 +53,9 @@ include $(UTSBASE)/intel/Makefile.intel CERRWARN += -_gcc=-Wno-uninitialized +# needs work +$(OBJS_DIR)/hook.o := SMOFF += all_func_returns + # # Define targets # diff --git a/usr/src/uts/intel/hpcsvc/Makefile b/usr/src/uts/intel/hpcsvc/Makefile index 9aae68f8f1..0a219218ce 100644 --- a/usr/src/uts/intel/hpcsvc/Makefile +++ b/usr/src/uts/intel/hpcsvc/Makefile @@ -24,13 +24,7 @@ # Copyright 2004 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # - -# -# This makefile drives the production of the hpcsvc "misc" -# kernel module. -# -# intel architecture dependent -# +# Copyright (c) 2018, Joyent, Inc. # # Path to the base of the uts directory tree (usually /usr/src/uts). @@ -65,6 +59,9 @@ DEBUG_DEFS += $(DEBUG_FLGS) CERRWARN += -_gcc=-Wno-uninitialized +# needs work +$(OBJS_DIR)/hpcsvc.o := SMOFF += all_func_returns + # # Default build targets. # diff --git a/usr/src/uts/intel/hsfs/Makefile b/usr/src/uts/intel/hsfs/Makefile index 09099a698c..10452c9754 100644 --- a/usr/src/uts/intel/hsfs/Makefile +++ b/usr/src/uts/intel/hsfs/Makefile @@ -25,11 +25,7 @@ # Use is subject to license terms. # Copyright (c) 2011 Bayard G. Bell. All rights reserved. # -# This makefile drives the production of the hsfs file system -# kernel module. -# -# intel architecture dependent -# +# Copyright (c) 2018, Joyent, Inc. # # Path to the base of the uts directory tree (usually /usr/src/uts). @@ -79,6 +75,9 @@ CERRWARN += -_gcc=-Wno-unused-function CERRWARN += -_gcc=-Wno-type-limits CERRWARN += -_gcc=-Wno-switch +# needs work +$(OBJS_DIR)/hsfs_vnops.o := SMOFF += 64bit_shift,signed + # # Default build targets. # diff --git a/usr/src/uts/intel/hxge/Makefile b/usr/src/uts/intel/hxge/Makefile index 3f2444702f..18e7597c86 100644 --- a/usr/src/uts/intel/hxge/Makefile +++ b/usr/src/uts/intel/hxge/Makefile @@ -22,9 +22,8 @@ # # Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. # -# This makefile drives the production of the Sun -# 10G hxge Ethernet leaf driver kernel module. -# +# Copyright (c) 2018, Joyent, Inc. + # # Path to the base of the uts directory tree (usually /usr/src/uts). # @@ -87,6 +86,8 @@ CERRWARN += -_gcc=-Wno-switch CERRWARN += -_gcc=-Wno-uninitialized CERRWARN += -_gcc=-Wno-parentheses +SMOFF += deref_check,logical_instead_of_bitwise + # # Driver depends on mac & IP # diff --git a/usr/src/uts/intel/i40e/Makefile b/usr/src/uts/intel/i40e/Makefile index 6c32e5674f..06cb47cba3 100644 --- a/usr/src/uts/intel/i40e/Makefile +++ b/usr/src/uts/intel/i40e/Makefile @@ -10,7 +10,7 @@ # # -# Copyright 2017 Joyent, Inc. +# Copyright (c) 2018, Joyent, Inc. # UTSBASE = ../.. @@ -43,6 +43,9 @@ LINTTAGS += -erroff=E_ENUM_VAL_OVERFLOWS_INT_MAX # CERRWARN += -_cc=-erroff=E_ENUM_VAL_OVERFLOWS_INT_MAX +# 3rd party code +SMOFF += all_func_returns + LDFLAGS += -dy -N misc/mac MAPFILES += ddi mac random diff --git a/usr/src/uts/intel/i8042/Makefile b/usr/src/uts/intel/i8042/Makefile index 0a67c8d5b0..0f0062d1f6 100644 --- a/usr/src/uts/intel/i8042/Makefile +++ b/usr/src/uts/intel/i8042/Makefile @@ -22,6 +22,7 @@ # Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # +# Copyright (c) 2018, Joyent, Inc. # # This makefile drives the production of the i8042 nexus driver @@ -64,6 +65,9 @@ LINTTAGS += -erroff=E_STATIC_UNUSED CERRWARN += -_gcc=-Wno-unused-function +# needs work +$(OBJS_DIR)/i8042.o := SMOFF += all_func_returns + # # Default build targets. # diff --git a/usr/src/uts/intel/i915/Makefile b/usr/src/uts/intel/i915/Makefile index e0c2a3002b..b71b8a2072 100644 --- a/usr/src/uts/intel/i915/Makefile +++ b/usr/src/uts/intel/i915/Makefile @@ -23,6 +23,7 @@ # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # +# Copyright (c) 2018, Joyent, Inc. # # uts/intel/drm/Makefile @@ -59,6 +60,9 @@ include $(UTSBASE)/intel/Makefile.intel CERRWARN += -_gcc=-Wno-unused-label +# needs work +SMATCH=off + # # Re-define targets # diff --git a/usr/src/uts/intel/ibcm/Makefile b/usr/src/uts/intel/ibcm/Makefile index 16799ca83f..38b6520778 100644 --- a/usr/src/uts/intel/ibcm/Makefile +++ b/usr/src/uts/intel/ibcm/Makefile @@ -22,11 +22,7 @@ # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -# uts/intel/ibcm/Makefile -# -# This makefile drives the production of the ibcm kernel -# module. SPARC architecture dependent -# +# Copyright (c) 2018, Joyent, Inc. # # Path to the base of the uts directory tree (usually /usr/src/uts). @@ -70,6 +66,9 @@ CERRWARN += -_gcc=-Wno-unused-function CERRWARN += -_gcc=-Wno-uninitialized CERRWARN += -_gcc=-Wno-unused-value +# needs work +SMATCH=off + # # depends on misc/ibtl and misc/ibmf # diff --git a/usr/src/uts/intel/ibmf/Makefile b/usr/src/uts/intel/ibmf/Makefile index 6a8efa3937..8fe06342ed 100644 --- a/usr/src/uts/intel/ibmf/Makefile +++ b/usr/src/uts/intel/ibmf/Makefile @@ -22,11 +22,7 @@ # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # - -# This makefile drives the production of the ibmf kernel module. -# -# intel architecture dependent -# +# Copyright (c) 2018, Joyent, Inc. # # Path to the base of the uts directory tree (usually /usr/src/uts). @@ -75,6 +71,9 @@ LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV CERRWARN += -_gcc=-Wno-uninitialized +# needs work +SMATCH=off + # # Default build targets. # diff --git a/usr/src/uts/intel/ibp/Makefile b/usr/src/uts/intel/ibp/Makefile index f9525a17d2..536aae0c8f 100644 --- a/usr/src/uts/intel/ibp/Makefile +++ b/usr/src/uts/intel/ibp/Makefile @@ -21,7 +21,7 @@ # # Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. # -# +# Copyright (c) 2018, Joyent, Inc. # # Path to the base of the uts directory tree (usually /usr/src/uts). @@ -62,6 +62,9 @@ LINTTAGS += -erroff=E_PTRDIFF_OVERFLOW CERRWARN += -_gcc=-Wno-uninitialized CERRWARN += -_gcc=-Wno-switch +# needs work +SMATCH=off + # # Default build targets. # diff --git a/usr/src/uts/intel/ibtl/Makefile b/usr/src/uts/intel/ibtl/Makefile index ecf5bdd849..7d0343b89c 100644 --- a/usr/src/uts/intel/ibtl/Makefile +++ b/usr/src/uts/intel/ibtl/Makefile @@ -22,12 +22,7 @@ # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # - -# -# This makefile drives the production of the ibtl kernel module. -# -# intel architecture dependent -# +# Copyright (c) 2018, Joyent, Inc. # # Path to the base of the uts directory tree (usually /usr/src/uts). @@ -58,9 +53,9 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) # Overrides. # -# -# lint pass one enforcement -# +# +# lint pass one enforcement +# CFLAGS += $(CCVERBOSE) # @@ -80,6 +75,9 @@ CERRWARN += -_gcc=-Wno-uninitialized CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-unused-value +# needs work +$(OBJS_DIR)/ibtl_impl.o := SMOFF += precedence + # # Default build targets. # diff --git a/usr/src/uts/intel/icmp/Makefile b/usr/src/uts/intel/icmp/Makefile index b6b1048254..f2a07516b8 100644 --- a/usr/src/uts/intel/icmp/Makefile +++ b/usr/src/uts/intel/icmp/Makefile @@ -23,7 +23,7 @@ # # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. -# Copyright 2016 Joyent, Inc. +# Copyright (c) 2018, Joyent, Inc. # # This makefile drives the production of the icmp IP driver # @@ -80,6 +80,9 @@ LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN LINTTAGS += -erroff=E_PTRDIFF_OVERFLOW LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV +# needs work +$(OBJS_DIR)/icmpddi.o := SMOFF += index_overflow + # # Default build targets. # diff --git a/usr/src/uts/intel/icmp6/Makefile b/usr/src/uts/intel/icmp6/Makefile index 0ee98acb50..19b3f4374e 100644 --- a/usr/src/uts/intel/icmp6/Makefile +++ b/usr/src/uts/intel/icmp6/Makefile @@ -23,12 +23,7 @@ # Copyright 2004 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -# ident "%Z%%M% %I% %E% SMI" -# -# This makefile drives the production of the icmp6 IP driver -# -# intel implementation architecture dependent -# +# Copyright (c) 2018, Joyent, Inc. # # Path to the base of the uts directory tree (usually /usr/src/uts). @@ -61,6 +56,8 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) $(ROOT_CONFFILE) # LDFLAGS += -dy -Ndrv/ip -Ndrv/ip6 -Ndrv/icmp +# needs work +$(OBJS_DIR)/icmp6ddi.o := SMOFF += index_overflow # # Default build targets. # diff --git a/usr/src/uts/intel/idm/Makefile b/usr/src/uts/intel/idm/Makefile index 99f4bb5cc3..703ca57dd3 100644 --- a/usr/src/uts/intel/idm/Makefile +++ b/usr/src/uts/intel/idm/Makefile @@ -24,11 +24,7 @@ # Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -# -# This makefile drives the production of the idm kernel module. -# -# intel architecture dependent -# +# Copyright (c) 2018, Joyent, Inc. # # Path to the base of the uts directory tree (usually /usr/src/uts). @@ -66,6 +62,9 @@ CERRWARN += -_gcc=-Wno-switch CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-uninitialized +# needs work +SMATCH=off + # Include INC_PATH += -I$(SRC)/common/hdcrc diff --git a/usr/src/uts/intel/igb/Makefile b/usr/src/uts/intel/igb/Makefile index b85fc2f5c2..1f6864efbe 100644 --- a/usr/src/uts/intel/igb/Makefile +++ b/usr/src/uts/intel/igb/Makefile @@ -22,13 +22,7 @@ # Copyright 2010 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -# uts/intel/igb/Makefile -# -# This makefile drives the production of the igb -# network driver kernel module. -# -# intel architecture dependent -# +# Copyright (c) 2018, Joyent, Inc. # # Paths to the base of the uts directory trees @@ -58,6 +52,9 @@ CERRWARN += -_gcc=-Wno-switch CERRWARN += -_gcc=-Wno-uninitialized CERRWARN += -_cc=-erroff=E_STATEMENT_NOT_REACHED +# needs work +SMOFF += all_func_returns,indenting + CFLAGS += -I$(UTSBASE)/common/io/e1000api CFLAGS += -I$(UTSBASE)/common/io/igb diff --git a/usr/src/uts/intel/intel_nb5000/Makefile b/usr/src/uts/intel/intel_nb5000/Makefile index 55ee9be813..54c012824e 100644 --- a/usr/src/uts/intel/intel_nb5000/Makefile +++ b/usr/src/uts/intel/intel_nb5000/Makefile @@ -21,6 +21,7 @@ # Use is subject to license terms. # Copyright (c) 2011 Bayard G. Bell. All rights reserved. # +# Copyright (c) 2018, Joyent, Inc. # # Intel 5000/5100/5400/7300 chipset memory controller hub (MCH) module @@ -63,6 +64,9 @@ LDFLAGS += -dy -N drv/smbios CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-uninitialized +# needs work +SMATCH=off + # # Default build targets. # diff --git a/usr/src/uts/intel/ip/Makefile b/usr/src/uts/intel/ip/Makefile index c0acd57445..db2647e0a3 100644 --- a/usr/src/uts/intel/ip/Makefile +++ b/usr/src/uts/intel/ip/Makefile @@ -22,8 +22,9 @@ # Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # +# Copyright (c) 2018, Joyent, Inc. # -# This makefile drives the production of the ip driver +# This makefile drives the production of the ip driver # kernel module. # # intel implementation architecture dependent @@ -68,6 +69,19 @@ CERRWARN += -_gcc=-Wno-switch CERRWARN += -_gcc=-Wno-uninitialized CERRWARN += -_gcc=-Wno-type-limits +# false positives +SMOFF += index_overflow + +# need work still +$(OBJS_DIR)/igmp.o := SMOFF += shift_to_zero +$(OBJS_DIR)/tnet.o := SMOFF += shift_to_zero +SMOFF += signed,all_func_returns +SMOFF += signed_integer_overflow_check + +# definitely wrong +$(OBJS_DIR)/ip_input.o := SMOFF += or_vs_and +$(OBJS_DIR)/ip6_input.o := SMOFF += or_vs_and + # # To get the BPF header files included by ipnet.h # @@ -78,7 +92,7 @@ INC_PATH += -I$(UTSBASE)/common/io/bpf # swrand as it needs random numbers early on during boot before # kCF subsystem can load swrand. # -LDFLAGS += -dy -Nmisc/md5 -Ncrypto/swrand -Nmisc/hook -Nmisc/neti +LDFLAGS += -dy -Nmisc/md5 -Ncrypto/swrand -Nmisc/hook -Nmisc/neti # # For now, disable these lint checks; maintainers should endeavor diff --git a/usr/src/uts/intel/ip6/Makefile b/usr/src/uts/intel/ip6/Makefile index 0e245bcd4a..c45b28ffa0 100644 --- a/usr/src/uts/intel/ip6/Makefile +++ b/usr/src/uts/intel/ip6/Makefile @@ -23,13 +23,7 @@ # Copyright 2004 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -# ident "%Z%%M% %I% %E% SMI" -# -# This makefile drives the production of the ip6 driver -# kernel module. -# -# intel implementation architecture dependent -# +# Copyright (c) 2018, Joyent, Inc. # # Path to the base of the uts directory tree (usually /usr/src/uts). @@ -62,6 +56,9 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) $(ROOT_CONFFILE) # LDFLAGS += -dy -Ndrv/ip +# needs work +$(OBJS_DIR)/ip6ddi.o := SMOFF += index_overflow + # # Default build targets. # diff --git a/usr/src/uts/intel/ipf/Makefile b/usr/src/uts/intel/ipf/Makefile index f033f016c4..7e0da79ba3 100644 --- a/usr/src/uts/intel/ipf/Makefile +++ b/usr/src/uts/intel/ipf/Makefile @@ -23,13 +23,7 @@ # Use is subject to license terms. # Copyright 2018 Joyent, Inc. # -# uts/intel/ipf/Makefile -# -# This makefile drives the production of the ipf driver -# kernel module. -# -# intel architecture dependent -# +# Copyright (c) 2018, Joyent, Inc. # # Path to the base of the uts directory tree (usually /usr/src/uts). @@ -80,6 +74,9 @@ CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-uninitialized CERRWARN += -_gcc=-Wno-empty-body +# needs work +SMATCH=off + # # Default build targets. # diff --git a/usr/src/uts/intel/ipgpc/Makefile b/usr/src/uts/intel/ipgpc/Makefile index 5b005a0022..6de28b7aed 100644 --- a/usr/src/uts/intel/ipgpc/Makefile +++ b/usr/src/uts/intel/ipgpc/Makefile @@ -22,6 +22,7 @@ # Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # +# Copyright (c) 2018, Joyent, Inc. # # This makefile drives the production of the IP generic packet classifier @@ -72,6 +73,9 @@ LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN CERRWARN += -_gcc=-Wno-uninitialized +# needs work +$(OBJS_DIR)/filters.o := SMOFF += deref_check + # # Default build targets. # diff --git a/usr/src/uts/intel/ipsecah/Makefile b/usr/src/uts/intel/ipsecah/Makefile index 90870c6a0a..1111d5fe5d 100644 --- a/usr/src/uts/intel/ipsecah/Makefile +++ b/usr/src/uts/intel/ipsecah/Makefile @@ -23,9 +23,10 @@ # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # +# Copyright (c) 2018, Joyent, Inc. # -# This makefile drives the production of the ipsecah driver +# This makefile drives the production of the ipsecah driver # kernel module. # # intel implementation architecture dependent @@ -76,6 +77,11 @@ LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-uninitialized +# needs work +$(OBJS_DIR)/ipsecahddi.o := SMOFF += index_overflow +$(OBJS_DIR)/ipsecah.o := SMOFF += deref_check +$(OBJS_DIR)/sadb.o := SMOFF += signed_integer_overflow_check,deref_check,indenting,shift_to_zero + # # Default build targets. # diff --git a/usr/src/uts/intel/ipsecesp/Makefile b/usr/src/uts/intel/ipsecesp/Makefile index 68cf590888..7e779dd409 100644 --- a/usr/src/uts/intel/ipsecesp/Makefile +++ b/usr/src/uts/intel/ipsecesp/Makefile @@ -23,6 +23,7 @@ # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # +# Copyright (c) 2018, Joyent, Inc. # # This makefile drives the production of the ipsecesp driver @@ -74,6 +75,10 @@ LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV CERRWARN += -_gcc=-Wno-uninitialized +# needs work +$(OBJS_DIR)/ipsecespddi.o := SMOFF += index_overflow +$(OBJS_DIR)/ipsecesp.o := SMOFF += deref_check + # # Default build targets. # diff --git a/usr/src/uts/intel/ipw/Makefile b/usr/src/uts/intel/ipw/Makefile index 4363bc43c4..8b29857bda 100644 --- a/usr/src/uts/intel/ipw/Makefile +++ b/usr/src/uts/intel/ipw/Makefile @@ -22,6 +22,7 @@ # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # +# Copyright (c) 2018, Joyent, Inc. # # This makefile drives the production of the ipw driver kernel module. @@ -37,7 +38,7 @@ UTSBASE = ../.. # # Define the module and object file sets. # -MODULE = ipw +MODULE = ipw OBJECTS = $(IPW_OBJS:%=$(OBJS_DIR)/%) LINTS = $(IPW_OBJS:%.o=$(LINTS_DIR)/%.ln) ROOTMODULE = $(ROOT_DRV_DIR)/$(MODULE) @@ -52,6 +53,9 @@ CERRWARN += -_gcc=-Wno-unused-label CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-uninitialized +# needs work +$(OBJS_DIR)/ipw2100.o := SMOFF += deref_check + # # Define targets # diff --git a/usr/src/uts/intel/iscsi/Makefile b/usr/src/uts/intel/iscsi/Makefile index ea010ebcc0..a9f2dc2140 100644 --- a/usr/src/uts/intel/iscsi/Makefile +++ b/usr/src/uts/intel/iscsi/Makefile @@ -23,6 +23,7 @@ # Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # +# Copyright (c) 2018, Joyent, Inc. # # This makefile drives the production of iSCSI initiator Driver @@ -74,6 +75,9 @@ CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-type-limits CERRWARN += -_gcc=-Wno-uninitialized +# needs work +SMATCH=off + # # Default build targets. # diff --git a/usr/src/uts/intel/iscsit/Makefile b/usr/src/uts/intel/iscsit/Makefile index 73b9139ec9..94bb0e9091 100644 --- a/usr/src/uts/intel/iscsit/Makefile +++ b/usr/src/uts/intel/iscsit/Makefile @@ -21,14 +21,11 @@ # # Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. # -# This makefile drives the production of the iscsit pseudo-driver for -# COMSTAR. +# Copyright (c) 2018, Joyent, Inc. # # Path to the base of the uts directory tree (usually /usr/src/uts). # - - UTSBASE = ../.. ARCHDIR:sh = cd ..; basename `pwd` @@ -66,6 +63,10 @@ CERRWARN += -_gcc=-Wno-switch CERRWARN += -_gcc=-Wno-uninitialized CERRWARN += -_gcc=-Wno-unused-label +# needs work +SMOFF += cast_assign,strcpy_overflow + + # # Default build targets. # diff --git a/usr/src/uts/intel/iser/Makefile b/usr/src/uts/intel/iser/Makefile index d3e7ffc8e2..0a8f4a2e2f 100644 --- a/usr/src/uts/intel/iser/Makefile +++ b/usr/src/uts/intel/iser/Makefile @@ -22,6 +22,8 @@ # # Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. +# +# Copyright (c) 2018, Joyent, Inc. # # Path to the base of the uts directory tree (usually /usr/src/uts). @@ -45,6 +47,9 @@ include $(UTSBASE)/intel/Makefile.intel CERRWARN += -_gcc=-Wno-uninitialized +# needs work +$(OBJS_DIR)/iser_ib.o := SMOFF += deref_check + # # Define targets # diff --git a/usr/src/uts/intel/iwi/Makefile b/usr/src/uts/intel/iwi/Makefile index 4caf4cf69c..926600b957 100755 --- a/usr/src/uts/intel/iwi/Makefile +++ b/usr/src/uts/intel/iwi/Makefile @@ -22,13 +22,7 @@ # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # - -# ident "%Z%%M% %I% %E% SMI" -# -# This makefile drives the production of the ipw driver kernel module. -# -# i86pc architecture dependent -# +# Copyright (c) 2018, Joyent, Inc. # # Path to the base of the uts directory tree (usually /usr/src/uts). @@ -38,7 +32,7 @@ UTSBASE = ../.. # # Define the module and object file sets. # -MODULE = iwi +MODULE = iwi OBJECTS = $(IWI_OBJS:%=$(OBJS_DIR)/%) LINTS = $(IWI_OBJS:%.o=$(LINTS_DIR)/%.ln) ROOTMODULE = $(ROOT_DRV_DIR)/$(MODULE) @@ -56,7 +50,10 @@ LINT_TARGET = $(MODULE).lint INSTALL_TARGET = $(BINARY) $(ROOTMODULE) CPPFLAGS += -I. -D_KERNEL -LDFLAGS += -dy -Nmisc/mac -Nmisc/net80211 -Ndrv/random -Ndrv/ip +LDFLAGS += -dy -Nmisc/mac -Nmisc/net80211 -Ndrv/random -Ndrv/ip + +# needs work +$(OBJS_DIR)/ipw2200.o := SMOFF += deref_check # # Default build targets. diff --git a/usr/src/uts/intel/iwk/Makefile b/usr/src/uts/intel/iwk/Makefile index 91668f9b3c..9cb38a51b0 100644 --- a/usr/src/uts/intel/iwk/Makefile +++ b/usr/src/uts/intel/iwk/Makefile @@ -22,6 +22,7 @@ # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # +# Copyright (c) 2018, Joyent, Inc. # # This makefile drives the production of the iwk driver kernel module. @@ -37,7 +38,7 @@ UTSBASE = ../.. # # Define the module and object file sets. # -MODULE = iwk +MODULE = iwk OBJECTS = $(IWK_OBJS:%=$(OBJS_DIR)/%) LINTS = $(IWK_OBJS:%.o=$(LINTS_DIR)/%.ln) ROOTMODULE = $(ROOT_DRV_DIR)/$(MODULE) @@ -61,11 +62,14 @@ LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN CPPFLAGS += -I. -D_KERNEL -DIWL=4965 -LDFLAGS += -dy -Nmisc/mac -Nmisc/net80211 -Ndrv/random -Ndrv/ip +LDFLAGS += -dy -Nmisc/mac -Nmisc/net80211 -Ndrv/random -Ndrv/ip CERRWARN += -_gcc=-Wno-unused-label CERRWARN += -_gcc=-Wno-uninitialized +# needs work +$(OBJS_DIR)/iwk2.o := SMOFF += precedence + # # Default build targets. # diff --git a/usr/src/uts/intel/iwn/Makefile b/usr/src/uts/intel/iwn/Makefile index 29ce82f9ac..9cc64b5c37 100644 --- a/usr/src/uts/intel/iwn/Makefile +++ b/usr/src/uts/intel/iwn/Makefile @@ -12,6 +12,7 @@ # # Copyright 2016 Hans Rosenfeld <rosenfeld@grumpf.hope-2000.org> # +# Copyright (c) 2018, Joyent, Inc. # # This makefile drives the production of the iwn driver kernel module. @@ -55,6 +56,9 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) $(ROOTFIRMWARE) LDFLAGS += -dy -Nmisc/mac -Nmisc/net80211 -Ndrv/random -Ndrv/ip +# needs work +SMOFF += all_func_returns + # # Default build targets. # diff --git a/usr/src/uts/intel/ixgbe/Makefile b/usr/src/uts/intel/ixgbe/Makefile index 26d0e670f2..f19f151d60 100644 --- a/usr/src/uts/intel/ixgbe/Makefile +++ b/usr/src/uts/intel/ixgbe/Makefile @@ -22,6 +22,7 @@ # Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # Copyright 2016 OmniTI Computer Consulting, Inc. All rights reserved. +# Copyright (c) 2018, Joyent, Inc. # # uts/intel/ixgbe/Makefile # @@ -60,6 +61,9 @@ CERRWARN += -_gcc=-Wno-uninitialized CERRWARN += -_gcc=-Wno-unused-value CERRWARN += -_cc=-erroff=E_STATEMENT_NOT_REACHED +# 3rd party code +SMOFF += all_func_returns + # # Define targets # diff --git a/usr/src/uts/intel/kcf/Makefile b/usr/src/uts/intel/kcf/Makefile index 1e3354a29e..3357077237 100644 --- a/usr/src/uts/intel/kcf/Makefile +++ b/usr/src/uts/intel/kcf/Makefile @@ -22,11 +22,7 @@ # Copyright 2010 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -# This makefile drives the production of the Kernel Cryptographic -# Framework core module. -# -# Intel implementation architecture dependent -# +# Copyright (c) 2018, Joyent, Inc. # # Path to the base of the uts directory tree (usually /usr/src/uts). @@ -74,6 +70,9 @@ CERRWARN += -_gcc=-Wno-uninitialized CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-unused-label +# needs work +SMOFF += all_func_returns,signed_integer_overflow_check + # # Default build targets. # diff --git a/usr/src/uts/intel/keysock/Makefile b/usr/src/uts/intel/keysock/Makefile index 99a1f7b1d8..2670a2e7b6 100644 --- a/usr/src/uts/intel/keysock/Makefile +++ b/usr/src/uts/intel/keysock/Makefile @@ -23,9 +23,10 @@ # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # +# Copyright (c) 2018, Joyent, Inc. # -# This makefile drives the production of the keysock driver +# This makefile drives the production of the keysock driver # kernel module. # # intel implementation architecture dependent @@ -75,6 +76,9 @@ LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV CERRWARN += -_gcc=-Wno-unused-variable +# needs work +$(OBJS_DIR)/keysockddi.o := SMOFF += index_overflow + # # Default build targets. # diff --git a/usr/src/uts/intel/kgssapi/Makefile b/usr/src/uts/intel/kgssapi/Makefile index d5c69eb049..ff27600ef6 100644 --- a/usr/src/uts/intel/kgssapi/Makefile +++ b/usr/src/uts/intel/kgssapi/Makefile @@ -25,10 +25,8 @@ # Use is subject to license terms. # Copyright (c) 2011 Bayard G. Bell. All rights reserved. # -# This makefile drives the production of the kgssapi kernel module. -# -# intel implementation architecture dependent -# +# Copyright (c) 2018, Joyent, Inc. + # # Path to the base of the uts directory tree (usually /usr/src/uts). # @@ -70,6 +68,9 @@ LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV CERRWARN += -_gcc=-Wno-unused-variable CERRWARN += -_gcc=-Wno-uninitialized +# needs work +$(OBJS_DIR)/gssd_clnt_stubs.o := SMOFF += indenting,deref_check + # # Default build targets. # diff --git a/usr/src/uts/intel/kiconv_ja/Makefile b/usr/src/uts/intel/kiconv_ja/Makefile index a72ae6e2a0..739a1768b6 100644 --- a/usr/src/uts/intel/kiconv_ja/Makefile +++ b/usr/src/uts/intel/kiconv_ja/Makefile @@ -24,12 +24,7 @@ # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -# ident "%Z%%M% %I% %E% SMI" -# -# This makefile drives the production of the kiconv_ja kernel module. -# -# intel architecture dependent -# +# Copyright (c) 2018, Joyent, Inc. # # Path to the base of the uts directory tree (usually /usr/src/uts). @@ -68,6 +63,9 @@ CFLAGS += $(CCVERBOSE) # LINTTAGS += -erroff=E_PTRDIFF_OVERFLOW +# smatch not happy with this source +SMATCH=off + # # Default build targets. # diff --git a/usr/src/uts/intel/klmmod/Makefile b/usr/src/uts/intel/klmmod/Makefile index 43e24b29b1..1ccdaf6b1e 100644 --- a/usr/src/uts/intel/klmmod/Makefile +++ b/usr/src/uts/intel/klmmod/Makefile @@ -24,11 +24,7 @@ # # Copyright (c) 2012 by Delphix. All rights reserved. # -# This makefile drives the production of the network lock manager server -# specific kernel module. -# -# intel implementation architecture dependent -# +# Copyright (c) 2018, Joyent, Inc. # # Path to the base of the uts directory tree (usually /usr/src/uts). @@ -67,6 +63,9 @@ CTFMRGFLAGS += -f # CERRWARN += -_gcc=-Wno-switch +# needs work +$(OBJS_DIR)/nlm_service.o := SMOFF += signed_integer_overflow_check + # # Default build targets. # diff --git a/usr/src/uts/intel/kmech_krb5/Makefile b/usr/src/uts/intel/kmech_krb5/Makefile index 1423cbc758..27b311c000 100644 --- a/usr/src/uts/intel/kmech_krb5/Makefile +++ b/usr/src/uts/intel/kmech_krb5/Makefile @@ -24,6 +24,7 @@ # Use is subject to license terms. # Copyright (c) 2011 Bayard G. Bell. All rights reserved. # +# Copyright (c) 2018, Joyent, Inc. # This makefile drives the production of the gl_kmech_krb5 kernel module. # @@ -73,6 +74,9 @@ CERRWARN += -_gcc=-Wno-unused-label CERRWARN += -_gcc=-Wno-uninitialized CERRWARN += -_gcc=-Wno-parentheses +# needs work +SMOFF += indenting + # # Default build targets. # diff --git a/usr/src/uts/intel/llc1/Makefile b/usr/src/uts/intel/llc1/Makefile index cd5a74a1d7..1ad058e06c 100644 --- a/usr/src/uts/intel/llc1/Makefile +++ b/usr/src/uts/intel/llc1/Makefile @@ -24,6 +24,7 @@ # Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # +# Copyright (c) 2018, Joyent, Inc. # # This makefile drives the production of the Sound-Blaster driver @@ -68,6 +69,9 @@ LINTTAGS += -erroff=E_PTRDIFF_OVERFLOW CERRWARN += -_gcc=-Wno-uninitialized +# needs work +$(OBJS_DIR)/llc1.o := SMOFF += no_if_block,deref_check + # # Default build targets. # diff --git a/usr/src/uts/intel/mac/Makefile b/usr/src/uts/intel/mac/Makefile index 327c1adb47..6766bd933b 100644 --- a/usr/src/uts/intel/mac/Makefile +++ b/usr/src/uts/intel/mac/Makefile @@ -22,10 +22,8 @@ # Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -# -# This makefile drives the production of the mac driver -# kernel module. -# +# Copyright (c) 2018, Joyent, Inc. + # # Path to the base of the uts directory tree (usually /usr/src/uts). # @@ -66,6 +64,13 @@ CERRWARN += -_gcc=-Wno-type-limits CERRWARN += -_gcc=-Wno-switch CERRWARN += -_gcc=-Wno-unused-variable +# needs work +SMOFF += all_func_returns +$(OBJS_DIR)/mac.o := SMOFF += deref_check +$(OBJS_DIR)/mac_util.o := SMOFF += signed + +# false positive +$(OBJS_DIR)/mac_sched.o := SMOFF += assign_vs_compare # # Default build targets. # diff --git a/usr/src/uts/intel/mega_sas/Makefile b/usr/src/uts/intel/mega_sas/Makefile index 20e4cf8e5d..3011ffa0f9 100644 --- a/usr/src/uts/intel/mega_sas/Makefile +++ b/usr/src/uts/intel/mega_sas/Makefile @@ -21,6 +21,7 @@ # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # +# Copyright (c) 2018, Joyent, Inc. # # uts/intel/mega_sas/Makefile @@ -63,6 +64,9 @@ LDFLAGS += -dy -Nmisc/scsi CERRWARN += -_gcc=-Wno-uninitialized +# needs work +$(OBJS_DIR)/megaraid_sas.o := SMOFF += snprintf_overflow,all_func_returns + # # Default build targets. # diff --git a/usr/src/uts/intel/mii/Makefile b/usr/src/uts/intel/mii/Makefile index 7f2167f18c..cd987a3a31 100644 --- a/usr/src/uts/intel/mii/Makefile +++ b/usr/src/uts/intel/mii/Makefile @@ -24,8 +24,7 @@ # Copyright 2010 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -# This makefile drives the production of the mii support module. -# +# Copyright (c) 2018, Joyent, Inc. # # Path to the base of the uts directory tree (usually /usr/src/uts). @@ -57,6 +56,9 @@ LDFLAGS += -dy -N misc/mac CERRWARN += -_gcc=-Wno-switch CERRWARN += -_gcc=-Wno-uninitialized +# needs work +SMOFF += all_func_returns + # # Default build targets. # diff --git a/usr/src/uts/intel/mpt_sas/Makefile b/usr/src/uts/intel/mpt_sas/Makefile index 9886d6ccd5..53e66fc2f2 100644 --- a/usr/src/uts/intel/mpt_sas/Makefile +++ b/usr/src/uts/intel/mpt_sas/Makefile @@ -21,10 +21,7 @@ # Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -# This makefile drives the production of the mpt_sas driver kernel module. -# -# intel architecture dependent -# +# Copyright (c) 2018, Joyent, Inc. # # Paths to the base of the uts directory trees @@ -59,6 +56,10 @@ include $(UTSBASE)/intel/Makefile.intel CERRWARN += -_gcc=-Wno-uninitialized +# needs work +$(OBJS_DIR)/mptsas_raid.o := SMOFF += index_overflow +$(OBJS_DIR)/mptsas.o := SMOFF += deref_check + # # Default build targets. # diff --git a/usr/src/uts/intel/mr_sas/Makefile b/usr/src/uts/intel/mr_sas/Makefile index a3dbbd5f89..d2771c91c9 100644 --- a/usr/src/uts/intel/mr_sas/Makefile +++ b/usr/src/uts/intel/mr_sas/Makefile @@ -23,10 +23,7 @@ # # uts/intel/mr_sas/Makefile # -# This makefile drives the production of the mr_sas driver kernel module. -# -# intel implementation architecture dependent -# +# Copyright (c) 2018, Joyent, Inc. # # Path to the base of the uts directory tree (usually /usr/src/uts). @@ -63,6 +60,9 @@ CERRWARN += -_gcc=-Wno-unused-label CERRWARN += -_gcc=-Wno-switch CERRWARN += -_gcc=-Wno-uninitialized +# needs work +SMATCH=off + # # Default build targets. # diff --git a/usr/src/uts/intel/mwl/Makefile b/usr/src/uts/intel/mwl/Makefile index 2c268ad0b6..3606a28511 100644 --- a/usr/src/uts/intel/mwl/Makefile +++ b/usr/src/uts/intel/mwl/Makefile @@ -22,6 +22,7 @@ # Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # +# Copyright (c) 2018, Joyent, Inc. # # This makefile drives the production of the rwd driver kernel module. @@ -67,6 +68,9 @@ LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN CERRWARN += -_gcc=-Wno-uninitialized CERRWARN += -_gcc=-Wno-unused-value +# needs work +SMOFF += return_cast + # # Default build targets. # diff --git a/usr/src/uts/intel/myri10ge/Makefile b/usr/src/uts/intel/myri10ge/Makefile index 761dcf6bf1..b12ef0d581 100644 --- a/usr/src/uts/intel/myri10ge/Makefile +++ b/usr/src/uts/intel/myri10ge/Makefile @@ -21,6 +21,7 @@ # # Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. # +# Copyright (c) 2018, Joyent, Inc. # # Path to the base of the uts directory tree (usually /usr/src/uts). @@ -55,7 +56,8 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) # LINTTAGS += -DSOLARIS_S11 -erroff=E_STATIC_UNUSED -#COPTIMIZE = -xO4 +# needs work +SMATCH=off INC_PATH += -I$(UTSBASE)/common/io/myri10ge -I$(UTSBASE)/common/io/myri10ge/firmware diff --git a/usr/src/uts/intel/nca/Makefile b/usr/src/uts/intel/nca/Makefile index beb7e0457f..457ac86abc 100644 --- a/usr/src/uts/intel/nca/Makefile +++ b/usr/src/uts/intel/nca/Makefile @@ -24,13 +24,7 @@ # Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -# ident "%Z%%M% %I% %E% SMI" -# -# This makefile drives the production of the nca driver -# kernel module. -# -# Intel architecture dependent -# +# Copyright (c) 2018, Joyent, Inc. # # Path to the base of the uts directory tree (usually /usr/src/uts). @@ -71,6 +65,9 @@ LDFLAGS += -dy -Nfs/sockfs -Ndrv/ip # LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN +# needs work +$(OBJS_DIR)/ncaddi.o := SMOFF += index_overflow + # # Default build targets. # diff --git a/usr/src/uts/intel/net80211/Makefile b/usr/src/uts/intel/net80211/Makefile index a08ee52384..525570481e 100644 --- a/usr/src/uts/intel/net80211/Makefile +++ b/usr/src/uts/intel/net80211/Makefile @@ -23,6 +23,7 @@ # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # +# Copyright (c) 2018, Joyent, Inc. # # This file makes the atheros driver for an intel system @@ -69,6 +70,9 @@ CERRWARN += -_gcc=-Wno-switch CERRWARN += -_gcc=-Wno-uninitialized CERRWARN += -_gcc=-Wno-parentheses +# needs work +SMATCH=off + # # Default build targets. # diff --git a/usr/src/uts/intel/nfs/Makefile b/usr/src/uts/intel/nfs/Makefile index e3524c9718..c7eb9b02a1 100644 --- a/usr/src/uts/intel/nfs/Makefile +++ b/usr/src/uts/intel/nfs/Makefile @@ -25,11 +25,7 @@ # Use is subject to license terms. # Copyright (c) 2011 Bayard G. Bell. All rights reserved. # -# This makefile drives the production of the nfs file system -# kernel module. -# -# intel implementation architecture dependent -# +# Copyright (c) 2018, Joyent, Inc. # # Path to the base of the uts directory tree (usually /usr/src/uts). @@ -90,6 +86,9 @@ CERRWARN += -_gcc=-Wno-unused-function CERRWARN += -_gcc=-Wno-unused-variable CERRWARN += -_gcc=-Wno-empty-body +# needs work +SMATCH=off + # # Default build targets. # diff --git a/usr/src/uts/intel/nfs_dlboot/Makefile b/usr/src/uts/intel/nfs_dlboot/Makefile index fcd505e38e..896762d6ab 100644 --- a/usr/src/uts/intel/nfs_dlboot/Makefile +++ b/usr/src/uts/intel/nfs_dlboot/Makefile @@ -24,6 +24,7 @@ # Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # +# Copyright (c) 2018, Joyent, Inc. # # This makefile drives the production of the dlboot_proto @@ -75,6 +76,9 @@ LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV CERRWARN += -_gcc=-Wno-parentheses +# needs work +$(OBJS_DIR)/nfs_dlinet.o := SMOFF += indenting,all_func_returns + # # Default build targets. # diff --git a/usr/src/uts/intel/nfssrv/Makefile b/usr/src/uts/intel/nfssrv/Makefile index 8cd5005557..5b2d459a8f 100644 --- a/usr/src/uts/intel/nfssrv/Makefile +++ b/usr/src/uts/intel/nfssrv/Makefile @@ -24,6 +24,7 @@ # Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # +# Copyright (c) 2018, Joyent, Inc. # # This makefile drives the production of the nfs server-specific @@ -82,6 +83,9 @@ CERRWARN += -_gcc=-Wno-unused-function CERRWARN += -_gcc=-Wno-uninitialized CERRWARN += -_gcc=-Wno-switch +# needs work +SMATCH=off + # # Default build targets. # diff --git a/usr/src/uts/intel/nge/Makefile b/usr/src/uts/intel/nge/Makefile index d2be242a1c..fbca64a4cb 100644 --- a/usr/src/uts/intel/nge/Makefile +++ b/usr/src/uts/intel/nge/Makefile @@ -22,9 +22,7 @@ # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -# This makefile drives the production of the nvidia toe/ge -# driver. -# +# Copyright (c) 2018, Joyent, Inc. # # Path to the base of the uts directory tree (usually /usr/src/uts). @@ -74,6 +72,9 @@ LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN CERRWARN += -_gcc=-Wno-switch CERRWARN += -_gcc=-Wno-uninitialized +# needs work +SMOFF += all_func_returns + # # Default build targets. # diff --git a/usr/src/uts/intel/nsmb/Makefile b/usr/src/uts/intel/nsmb/Makefile index c277170dc1..891de62ff4 100644 --- a/usr/src/uts/intel/nsmb/Makefile +++ b/usr/src/uts/intel/nsmb/Makefile @@ -24,6 +24,7 @@ # Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # +# Copyright (c) 2018, Joyent, Inc. # # intel architecture dependent @@ -99,6 +100,12 @@ LINTTAGS += -erroff=E_BAD_FORMAT_ARG_TYPE2 LGREP.nsmb = egrep -v ' ignored: (mb_init|mb_put|md_get)' LTAIL += 2>&1 | $(LGREP.2) | $(LGREP.nsmb) || true +# same for smatch +SMOFF += all_func_returns + +# needs work +SMOFF += signed,deref_check + # # Default build targets. # diff --git a/usr/src/uts/intel/ntxn/Makefile b/usr/src/uts/intel/ntxn/Makefile index 8843e8bfe5..092861743e 100644 --- a/usr/src/uts/intel/ntxn/Makefile +++ b/usr/src/uts/intel/ntxn/Makefile @@ -23,10 +23,7 @@ # Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -# -# This makefile drives the production of the Neterion Xframe -# 10G Ethernet (XGE) driver module in x86 systems -# +# Copyright (c) 2018, Joyent, Inc. # # Paths to the base of the uts directory trees @@ -73,6 +70,9 @@ CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-unused-label CERRWARN += -_gcc=-Wno-type-limits +# needs work +SMOFF += all_func_returns + # # # Default build targets. diff --git a/usr/src/uts/intel/nv_sata/Makefile b/usr/src/uts/intel/nv_sata/Makefile index 9723cca3cc..df6a1b50fd 100644 --- a/usr/src/uts/intel/nv_sata/Makefile +++ b/usr/src/uts/intel/nv_sata/Makefile @@ -23,6 +23,8 @@ # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # +# Copyright (c) 2018, Joyent, Inc. + # # Path to the base of the uts directory tree (usually /usr/src/uts). # @@ -75,6 +77,9 @@ LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN CERRWARN += -_gcc=-Wno-uninitialized +# needs work +$(OBJS_DIR)/nv_sata.o := SMOFF += deref_check + # # Default build targets. # diff --git a/usr/src/uts/intel/nxge/Makefile b/usr/src/uts/intel/nxge/Makefile index 7346a0b84b..61e3982ef5 100644 --- a/usr/src/uts/intel/nxge/Makefile +++ b/usr/src/uts/intel/nxge/Makefile @@ -22,10 +22,8 @@ # # Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. # -# -# This makefile drives the production of the Sun NIU -# 10G/1G Ethernet leaf driver kernel module. -# +# Copyright (c) 2018, Joyent, Inc. + # # Path to the base of the uts directory tree (usually /usr/src/uts). # @@ -92,6 +90,9 @@ CERRWARN += -_gcc=-Wno-switch CERRWARN += -_gcc=-Wno-uninitialized CERRWARN += -_gcc=-Wno-type-limits +# needs work +SMATCH=off + # # Driver depends on mac & IP # diff --git a/usr/src/uts/intel/objfs/Makefile b/usr/src/uts/intel/objfs/Makefile index 9c8a6e9bbd..fad14923da 100644 --- a/usr/src/uts/intel/objfs/Makefile +++ b/usr/src/uts/intel/objfs/Makefile @@ -22,6 +22,7 @@ # Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # +# Copyright (c) 2018, Joyent, Inc. # # This makefile drives the production of the object file system @@ -72,6 +73,9 @@ CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-unused-function CERRWARN += -_gcc=-Wno-uninitialized +# needs work +$(OBJS_DIR)/objfs_vfs.o := SMOFF += signed_integer_overflow_check + # # Default build targets. # diff --git a/usr/src/uts/intel/openeepr/Makefile b/usr/src/uts/intel/openeepr/Makefile index 762cd55a0c..1f7608e4ec 100644 --- a/usr/src/uts/intel/openeepr/Makefile +++ b/usr/src/uts/intel/openeepr/Makefile @@ -23,6 +23,7 @@ # Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # +# Copyright (c) 2018, Joyent, Inc. # # This makefile drives the production of the openeepr driver @@ -68,6 +69,9 @@ LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-uninitialized +# needs work +$(OBJS_DIR)/openprom.o := SMOFF += cast_assign,strcpy_overflow + # # Default build targets. # diff --git a/usr/src/uts/intel/pcfs/Makefile b/usr/src/uts/intel/pcfs/Makefile index 59d2650970..a9e4f7b085 100644 --- a/usr/src/uts/intel/pcfs/Makefile +++ b/usr/src/uts/intel/pcfs/Makefile @@ -24,6 +24,7 @@ # Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # +# Copyright (c) 2018, Joyent, Inc. # # This makefile drives the production of the DOS file system @@ -68,6 +69,9 @@ CERRWARN += -_gcc=-Wno-unused-label CERRWARN += -_gcc=-Wno-uninitialized CERRWARN += -_gcc=-Wno-unused-function +# needs work +SMATCH=off + # # Define targets # diff --git a/usr/src/uts/intel/pcic/Makefile b/usr/src/uts/intel/pcic/Makefile index 100973ecf1..5312ac7c21 100644 --- a/usr/src/uts/intel/pcic/Makefile +++ b/usr/src/uts/intel/pcic/Makefile @@ -23,6 +23,7 @@ # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # +# Copyright (c) 2018, Joyent, Inc. # # This makefile drives the PCIC style PCMCIA adapter @@ -78,6 +79,9 @@ CERRWARN += -_gcc=-Wno-unused-variable CERRWARN += -_gcc=-Wno-unused-function CERRWARN += -_gcc=-Wno-uninitialized +# needs work +SMOFF += no_if_block,indenting,all_func_returns + # # Default build targets. # diff --git a/usr/src/uts/intel/pcicfg/Makefile b/usr/src/uts/intel/pcicfg/Makefile index 90e0ba1970..68e00c9d1f 100644 --- a/usr/src/uts/intel/pcicfg/Makefile +++ b/usr/src/uts/intel/pcicfg/Makefile @@ -23,12 +23,7 @@ # Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -# This makefile drives the production of the kernel/misc/pcicfg module -# (PCI configurator module) for PCI hotplug support in PCI nexus -# drivers. -# -# intel implementation architecture dependent -# +# Copyright (c) 2018, Joyent, Inc. # # Path to the base of the uts directory tree (usually /usr/src/uts). @@ -80,6 +75,9 @@ LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV CERRWARN += -_gcc=-Wno-unused-function CERRWARN += -_gcc=-Wno-uninitialized +# needs work +$(OBJS_DIR)/pcicfg.o := SMOFF += deref_check + # # Default build targets. # diff --git a/usr/src/uts/intel/pcieb/Makefile b/usr/src/uts/intel/pcieb/Makefile index be0357f8b2..3b9f363520 100644 --- a/usr/src/uts/intel/pcieb/Makefile +++ b/usr/src/uts/intel/pcieb/Makefile @@ -24,9 +24,7 @@ # Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -# This makefile drives the production of the pcieb driver kernel -# module. -# +# Copyright (c) 2018, Joyent, Inc. # # Path to the base of the uts directory tree (usually /usr/src/uts). @@ -77,6 +75,9 @@ LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV CERRWARN += -_gcc=-Wno-unused-value +# needs work +SMOFF += all_func_returns + # # Default build targets. # diff --git a/usr/src/uts/intel/pcihp/Makefile b/usr/src/uts/intel/pcihp/Makefile index 6b8a0df43a..2d2b09a417 100644 --- a/usr/src/uts/intel/pcihp/Makefile +++ b/usr/src/uts/intel/pcihp/Makefile @@ -23,13 +23,7 @@ # Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -#ident "%Z%%M% %I% %E% SMI" -# -# This makefile drives the production of the kernel/misc/pcihp module -# for PCI hotplug support in PCI nexus drivers. -# -# intel implementation architecture dependent -# +# Copyright (c) 2018, Joyent, Inc. # # Path to the base of the uts directory tree (usually /usr/src/uts). @@ -69,6 +63,9 @@ LDFLAGS += -dy -Nmisc/busra -Nmisc/hpcsvc LINTTAGS += -erroff=E_SUSPICIOUS_COMPARISON LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN +# needs work +SMOFF += indenting + # # Default build targets. # diff --git a/usr/src/uts/intel/pcmcia/Makefile b/usr/src/uts/intel/pcmcia/Makefile index b50059c5ed..d48374ff64 100644 --- a/usr/src/uts/intel/pcmcia/Makefile +++ b/usr/src/uts/intel/pcmcia/Makefile @@ -24,6 +24,7 @@ # Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # +# Copyright (c) 2018, Joyent, Inc. # # This file makes the pcmcia nexus for an intel system @@ -83,6 +84,9 @@ LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV CERRWARN += -_gcc=-Wno-uninitialized CERRWARN += -_gcc=-Wno-parentheses +# needs work +SMATCH=off + # # Default build targets. # diff --git a/usr/src/uts/intel/pmcs/Makefile b/usr/src/uts/intel/pmcs/Makefile index 3bc177d9cf..62243ffa9f 100644 --- a/usr/src/uts/intel/pmcs/Makefile +++ b/usr/src/uts/intel/pmcs/Makefile @@ -20,11 +20,7 @@ # Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -# -# This makefile drives the production of the pmcs driver kernel module. -# -# intel architecture dependent -# +# Copyright (c) 2018, Joyent, Inc. # # Paths to the base of the uts directory trees @@ -72,6 +68,8 @@ CERRWARN += -_gcc=-Wno-unused-value CERRWARN += -_gcc=-Wno-unused-label CERRWARN += -_gcc=-Wno-parentheses +# needs work +SMATCH=off # # Default build targets. diff --git a/usr/src/uts/intel/portfs/Makefile b/usr/src/uts/intel/portfs/Makefile index acd107022c..2d784dcb70 100644 --- a/usr/src/uts/intel/portfs/Makefile +++ b/usr/src/uts/intel/portfs/Makefile @@ -23,6 +23,8 @@ # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # +# Copyright (c) 2018, Joyent, Inc. + # # This makefile drives the production of the portfs driver kernel module. @@ -75,6 +77,9 @@ LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV CERRWARN += -_gcc=-Wno-uninitialized CERRWARN += -_gcc=-Wno-parentheses +# needs work +$(OBJS_DIR)/port_fop.o := SMOFF += deref_check + # # Default build targets. # diff --git a/usr/src/uts/intel/procfs/Makefile b/usr/src/uts/intel/procfs/Makefile index 21057b40d8..1e5fc27935 100644 --- a/usr/src/uts/intel/procfs/Makefile +++ b/usr/src/uts/intel/procfs/Makefile @@ -24,6 +24,7 @@ # Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # +# Copyright (c) 2018, Joyent, Inc. # # This makefile drives the production of the procfs file system @@ -76,6 +77,15 @@ LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-switch CERRWARN += -_gcc=-Wno-uninitialized + +# needs work +$(OBJS_DIR)/prsubr.o := SMOFF += all_func_returns +$(OBJS_DIR)/prcontrol.o := SMOFF += all_func_returns +$(OBJS_DIR)/prioctl.o := SMOFF += signed + +# false positives +$(OBJS_DIR)/prvnops.o := SMOFF += strcpy_overflow + # # Default build targets. # diff --git a/usr/src/uts/intel/qede/Makefile b/usr/src/uts/intel/qede/Makefile index 3976cef74b..1ac554f074 100644 --- a/usr/src/uts/intel/qede/Makefile +++ b/usr/src/uts/intel/qede/Makefile @@ -10,7 +10,7 @@ # # -# Copyright (c) 2017 Joyent, Inc. +# Copyright (c) 2018, Joyent, Inc. # UTSBASE = ../.. @@ -48,6 +48,12 @@ CPPFLAGS += -I$(UTSBASE)/common/io/qede/579xx/hsi/mcp CERRWARN += -_gcc=-Wno-unused-variable CERRWARN += -_gcc=-Wno-unused-function +# 3rd party module +SMOFF += all_func_returns,indenting,no_if_block,deref_check,testing_index_after_use + +# real bug in qede_multicast() +$(OBJS_DIR)/qede_gld.o := SMOFF += assign_vs_compare + ALL_TARGET = $(BINARY) $(CONFMOD) INSTALL_TARGET = $(BINARY) $(ROOTMODULE) $(ROOT_CONFFILE) diff --git a/usr/src/uts/intel/qlc/Makefile b/usr/src/uts/intel/qlc/Makefile index c9071abe6a..22661960b6 100644 --- a/usr/src/uts/intel/qlc/Makefile +++ b/usr/src/uts/intel/qlc/Makefile @@ -22,7 +22,8 @@ # Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -# This makefile drives the production of qlc driver kernel module. +# Copyright (c) 2018, Joyent, Inc. + # # Path to the base of the uts directory tree (usually /usr/src/uts). # @@ -81,6 +82,9 @@ CERRWARN += -_gcc=-Wno-uninitialized CERRWARN += -_gcc=-Wno-type-limits CERRWARN += -_gcc=-Wno-parentheses +# needs work +SMATCH=off + # # Default build targets. # diff --git a/usr/src/uts/intel/qlge/Makefile b/usr/src/uts/intel/qlge/Makefile index d9951b0d1a..425923a037 100644 --- a/usr/src/uts/intel/qlge/Makefile +++ b/usr/src/uts/intel/qlge/Makefile @@ -22,7 +22,8 @@ # Copyright 2010 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -# This makefile drives the production of the qlge driver kernel module. +# Copyright (c) 2018, Joyent, Inc. + # # Path to the base of the uts directory tree (usually /usr/src/uts). # @@ -66,6 +67,9 @@ C99LMODE= -Xc99=%all CERRWARN += -_gcc=-Wno-switch CERRWARN += -_gcc=-Wno-uninitialized +# needs work +$(OBJS_DIR)/qlge.o := SMOFF += deref_check + # # Default build targets. # diff --git a/usr/src/uts/intel/rdsv3/Makefile b/usr/src/uts/intel/rdsv3/Makefile index 1250b9c42f..7ef904de97 100644 --- a/usr/src/uts/intel/rdsv3/Makefile +++ b/usr/src/uts/intel/rdsv3/Makefile @@ -21,6 +21,7 @@ # # Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. # +# Copyright (c) 2018, Joyent, Inc. # # Path to the base of the uts directory tree (usually /usr/src/uts). @@ -65,6 +66,9 @@ CERRWARN += -_gcc=-Wno-unused-function CERRWARN += -_gcc=-Wno-uninitialized CERRWARN += -_gcc=-Wno-parentheses +# needs work +SMATCH=off + # # Define targets # diff --git a/usr/src/uts/intel/rge/Makefile b/usr/src/uts/intel/rge/Makefile index aaa493f044..51ade3de5b 100644 --- a/usr/src/uts/intel/rge/Makefile +++ b/usr/src/uts/intel/rge/Makefile @@ -22,10 +22,7 @@ # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -# -# This makefile drives the production of the Realtek -# Gigabit Ethernet (BGE) driver module in intel systems -# +# Copyright (c) 2018, Joyent, Inc. # # Path to the base of the uts directory tree (usually /usr/src/uts). @@ -71,6 +68,9 @@ LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN CERRWARN += -_gcc=-Wno-switch CERRWARN += -_gcc=-Wno-uninitialized +# looks like a real bug in rge_phy_update() ! +$(OBJS_DIR)/rge_chip.o := SMOFF += indenting + # # Default build targets. # diff --git a/usr/src/uts/intel/rpcib/Makefile b/usr/src/uts/intel/rpcib/Makefile index f90003d045..ce04217815 100644 --- a/usr/src/uts/intel/rpcib/Makefile +++ b/usr/src/uts/intel/rpcib/Makefile @@ -22,6 +22,7 @@ # Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # +# Copyright (c) 2018, Joyent, Inc. # # This makefile drives the production of the kernel @@ -77,6 +78,9 @@ CERRWARN += -_gcc=-Wno-unused-variable CERRWARN += -_gcc=-Wno-unused-function CERRWARN += -_gcc=-Wno-uninitialized +# needs work +SMATCH=off + # # Default build targets. # diff --git a/usr/src/uts/intel/rpcmod/Makefile b/usr/src/uts/intel/rpcmod/Makefile index ae92a0a983..db4e739b07 100644 --- a/usr/src/uts/intel/rpcmod/Makefile +++ b/usr/src/uts/intel/rpcmod/Makefile @@ -24,6 +24,7 @@ # Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # +# Copyright (c) 2018, Joyent, Inc. # # This makefile drives the production of the rpcmod streams kernel @@ -89,6 +90,9 @@ CERRWARN += -_gcc=-Wno-unused-variable CERRWARN += -_gcc=-Wno-unused-label CERRWARN += -_gcc=-Wno-unused-function +# needs work +SMOFF += all_func_returns,indenting,no_if_block,deref_check + # # Default build targets. # diff --git a/usr/src/uts/intel/rpcsec/Makefile b/usr/src/uts/intel/rpcsec/Makefile index 3dd8a5e003..843d7dc880 100644 --- a/usr/src/uts/intel/rpcsec/Makefile +++ b/usr/src/uts/intel/rpcsec/Makefile @@ -25,10 +25,8 @@ # Use is subject to license terms. # Copyright (c) 2011 Bayard G. Bell. All rights reserved. # -# This makefile drives the production of the kernel rpcsec module. -# -# intel implementation architecture dependent -# +# Copyright (c) 2018, Joyent, Inc. + # # Path to the base of the uts directory tree (usually /usr/src/uts). # @@ -71,6 +69,9 @@ LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-uninitialized +# needs work +$(OBJS_DIR)/auth_des.o := SMOFF += deref_check + # # Default build targets. # diff --git a/usr/src/uts/intel/rsm/Makefile b/usr/src/uts/intel/rsm/Makefile index 26c3c45282..c828628870 100644 --- a/usr/src/uts/intel/rsm/Makefile +++ b/usr/src/uts/intel/rsm/Makefile @@ -23,6 +23,7 @@ # Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # +# Copyright (c) 2018, Joyent, Inc. # # This makefile drives the production of the rsm kernel agent @@ -81,6 +82,9 @@ LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV CERRWARN += -_gcc=-Wno-uninitialized CERRWARN += -_gcc=-Wno-parentheses +# needs work +SMATCH=off + # # Default build targets. # diff --git a/usr/src/uts/intel/rts/Makefile b/usr/src/uts/intel/rts/Makefile index 8e8ec349a5..d0ca2cd069 100644 --- a/usr/src/uts/intel/rts/Makefile +++ b/usr/src/uts/intel/rts/Makefile @@ -24,10 +24,7 @@ # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -# This makefile drives the production of the rts IP driver -# -# intel implementation architecture dependent -# +# Copyright (c) 2018, Joyent, Inc. # # Path to the base of the uts directory tree (usually /usr/src/uts). @@ -77,6 +74,9 @@ LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN LINTTAGS += -erroff=E_PTRDIFF_OVERFLOW LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV +# needs work +$(OBJS_DIR)/rtsddi.o := SMOFF += index_overflow + # # Default build targets. # diff --git a/usr/src/uts/intel/s1394/Makefile b/usr/src/uts/intel/s1394/Makefile index aa1961414b..f7f8fd3299 100644 --- a/usr/src/uts/intel/s1394/Makefile +++ b/usr/src/uts/intel/s1394/Makefile @@ -24,6 +24,7 @@ # Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # +# Copyright (c) 2018, Joyent, Inc. # # This makefile drives the production of the s1394 kernel module. @@ -83,6 +84,9 @@ CERRWARN += -_gcc=-Wno-uninitialized CERRWARN += -_gcc=-Wno-unused-variable CERRWARN += -_gcc=-Wno-parentheses +# needs work +SMOFF += indenting + # # Default build targets. # diff --git a/usr/src/uts/intel/sata/Makefile b/usr/src/uts/intel/sata/Makefile index 9d4e9bb2fc..9b0540e56b 100644 --- a/usr/src/uts/intel/sata/Makefile +++ b/usr/src/uts/intel/sata/Makefile @@ -23,6 +23,8 @@ # Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # +# Copyright (c) 2018, Joyent, Inc. + # # uts/intel/io/sata/Makefile @@ -91,6 +93,9 @@ CERRWARN += -_gcc=-Wno-unused-variable CERRWARN += -_gcc=-Wno-uninitialized CERRWARN += -_gcc=-Wno-empty-body +# needs work +SMATCH=off + # # Default build targets. # diff --git a/usr/src/uts/intel/scsa1394/Makefile b/usr/src/uts/intel/scsa1394/Makefile index 8e07952219..2545171295 100644 --- a/usr/src/uts/intel/scsa1394/Makefile +++ b/usr/src/uts/intel/scsa1394/Makefile @@ -22,6 +22,8 @@ # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # +# Copyright (c) 2018, Joyent, Inc. + # # Path to the base of the uts directory tree. @@ -65,6 +67,9 @@ LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-uninitialized +# needs work +$(OBJS_DIR)/sbp2_driver.o := SMOFF += indenting + # Default build targets. # .KEEP_STATE: diff --git a/usr/src/uts/intel/scsa2usb/Makefile b/usr/src/uts/intel/scsa2usb/Makefile index 61acb5215e..342cc1f0fa 100644 --- a/usr/src/uts/intel/scsa2usb/Makefile +++ b/usr/src/uts/intel/scsa2usb/Makefile @@ -25,9 +25,7 @@ # # Copyright 2014 Garrett D'Amore <garrett@damore.org> # -# This makefile drives the production of the scsa2usb driver -# kernel module. intel architecture dependent -# +# Copyright (c) 2018, Joyent, Inc. # # Path to the base of the uts directory tree (usually /usr/src/uts). @@ -76,6 +74,9 @@ LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN CERRWARN += -_gcc=-Wno-unused-label CERRWARN += -_gcc=-Wno-uninitialized +# needs work +$(OBJS_DIR)/scsa2usb.o := SMOFF += deref_check + # # Default build targets. # diff --git a/usr/src/uts/intel/scsi/Makefile b/usr/src/uts/intel/scsi/Makefile index 5aeaf4c0f1..60577c36d7 100644 --- a/usr/src/uts/intel/scsi/Makefile +++ b/usr/src/uts/intel/scsi/Makefile @@ -24,6 +24,7 @@ # Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # +# Copyright (c) 2018, Joyent, Inc. # # This makefile drives the production of the scsi kernel module. @@ -75,6 +76,9 @@ CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-switch CERRWARN += -_gcc=-Wno-uninitialized +# needs work +SMATCH=off + # # Default build targets. # diff --git a/usr/src/uts/intel/scsi_vhci/Makefile b/usr/src/uts/intel/scsi_vhci/Makefile index f18133d8dd..80191c40e0 100644 --- a/usr/src/uts/intel/scsi_vhci/Makefile +++ b/usr/src/uts/intel/scsi_vhci/Makefile @@ -23,6 +23,7 @@ # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # +# Copyright (c) 2018, Joyent, Inc. # # This makefile drives the production of SCSI vHCI Driver @@ -52,6 +53,9 @@ CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-uninitialized CERRWARN += -_gcc=-Wno-unused-label +# needs work +SMATCH=off + # # Define targets. # diff --git a/usr/src/uts/intel/sd/Makefile b/usr/src/uts/intel/sd/Makefile index cfa86ca4e5..1cdd67cd86 100644 --- a/usr/src/uts/intel/sd/Makefile +++ b/usr/src/uts/intel/sd/Makefile @@ -24,10 +24,7 @@ # Use is subject to license terms. # Copyright (c) 2011 Bayard G. Bell. All rights reserved. # -# This makefile drives the production of the sd -# kernel module. -# -# +# Copyright (c) 2018, Joyent, Inc. # # Path to the base of the uts directory tree (usually /usr/src/uts). @@ -74,6 +71,9 @@ LINTTAGS += -erroff=E_STATIC_UNUSED LINTTAGS += -erroff=E_PTRDIFF_OVERFLOW LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV +# needs work +SMOFF += index_overflow,shift_to_zero,signed + # # Depends on scsi and cmlb # diff --git a/usr/src/uts/intel/sda/Makefile b/usr/src/uts/intel/sda/Makefile index 7d0073b031..20be2108ad 100644 --- a/usr/src/uts/intel/sda/Makefile +++ b/usr/src/uts/intel/sda/Makefile @@ -22,6 +22,8 @@ # # Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. # +# Copyright (c) 2018, Joyent, Inc. + # # uts/intel/sda/Makefile @@ -76,6 +78,9 @@ MAPFILE = $(UTSBASE)/common/io/sdcard/impl/mapfile LDFLAGS += -dy -Ndrv/blkdev -B reduce -M $(MAPFILE) CTFMRGFLAGS += -f +# needs work +SMOFF += all_func_returns + # # Default build targets. # diff --git a/usr/src/uts/intel/sfe/Makefile b/usr/src/uts/intel/sfe/Makefile index 00aaa13a71..e0b2b5e461 100644 --- a/usr/src/uts/intel/sfe/Makefile +++ b/usr/src/uts/intel/sfe/Makefile @@ -22,6 +22,8 @@ # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # +# Copyright (c) 2018, Joyent, Inc. + # # This makefile drives the production of NS/SiS @@ -78,6 +80,9 @@ CERRWARN += -_gcc=-Wno-switch CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-uninitialized +# needs work +SMOFF += all_func_returns + # # Driver depends on MAC & IP # diff --git a/usr/src/uts/intel/sfxge/Makefile b/usr/src/uts/intel/sfxge/Makefile index 4db3a4dd22..5a7e71ff8c 100644 --- a/usr/src/uts/intel/sfxge/Makefile +++ b/usr/src/uts/intel/sfxge/Makefile @@ -12,6 +12,7 @@ # # Copyright 2016 Garrett D'Amore <garrett@damore.org> # +# Copyright (c) 2018, Joyent, Inc. UTSBASE = ../.. @@ -52,6 +53,10 @@ CFLAGS += $(CCVERBOSE) # LDFLAGS += -dy -N misc/mac +# needs work +$(OBJS_DIR)/sfxge_ev.o := SMOFF += index_overflow +SMOFF += all_func_returns + # # Default build targets. # diff --git a/usr/src/uts/intel/smbfs/Makefile b/usr/src/uts/intel/smbfs/Makefile index 6defe60e32..5a23cf0c54 100644 --- a/usr/src/uts/intel/smbfs/Makefile +++ b/usr/src/uts/intel/smbfs/Makefile @@ -24,11 +24,7 @@ # Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -# This makefile drives the production of the smbfs (Server -# message block file system) kernel module. -# -# intel architecture dependent -# +# Copyright (c) 2018, Joyent, Inc. # # Path to the base of the uts directory tree (usually /usr/src/uts). @@ -70,6 +66,9 @@ LINTTAGS += -erroff=E_BAD_FORMAT_ARG_TYPE2 CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-uninitialized +# needs work +SMOFF += all_func_returns,signed,deref_check + # The mb_put/md_get functions are intentionally used with and without # return value checks, so filter those out like LGREP.2 does. LGREP.nsmb = egrep -v ' ignored: (mb_init|mb_put|md_get)' diff --git a/usr/src/uts/intel/smbios/Makefile b/usr/src/uts/intel/smbios/Makefile index bc7c770bf5..ae91d18a7a 100644 --- a/usr/src/uts/intel/smbios/Makefile +++ b/usr/src/uts/intel/smbios/Makefile @@ -24,7 +24,8 @@ # Copyright 2005 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -#ident "%Z%%M% %I% %E% SMI" +# Copyright (c) 2018, Joyent, Inc. + UTSBASE = ../.. @@ -40,6 +41,9 @@ ALL_TARGET = $(BINARY) $(SRC_CONFILE) LINT_TARGET = $(MODULE).lint INSTALL_TARGET = $(BINARY) $(ROOTMODULE) $(ROOT_CONFFILE) +# needs work +SMOFF += signed_integer_overflow_check + .KEEP_STATE: def: $(DEF_DEPS) diff --git a/usr/src/uts/intel/smbsrv/Makefile b/usr/src/uts/intel/smbsrv/Makefile index 5dfe45a19c..8d7647c756 100644 --- a/usr/src/uts/intel/smbsrv/Makefile +++ b/usr/src/uts/intel/smbsrv/Makefile @@ -24,6 +24,7 @@ # # Copyright 2014 Nexenta Systems, Inc. All rights reserved. # +# Copyright (c) 2018, Joyent, Inc. # # This makefile drives the production of the cifs server file system @@ -74,6 +75,9 @@ INC_PATH += -I$(SRC)/common CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-switch +# needs work +SMATCH=off + # # Default build targets. # diff --git a/usr/src/uts/intel/sockfs/Makefile b/usr/src/uts/intel/sockfs/Makefile index 31ae52d1cc..a62b4eaf0a 100644 --- a/usr/src/uts/intel/sockfs/Makefile +++ b/usr/src/uts/intel/sockfs/Makefile @@ -24,6 +24,7 @@ # Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # +# Copyright (c) 2018, Joyent, Inc. # # This makefile drives the production of the sockfs file system @@ -93,6 +94,9 @@ CERRWARN += -_gcc=-Wno-unused-function CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-uninitialized +# needs work +SMATCH=off + # # Default build targets. # diff --git a/usr/src/uts/intel/sockpfp/Makefile b/usr/src/uts/intel/sockpfp/Makefile index ac5ca9209d..7b54398af3 100644 --- a/usr/src/uts/intel/sockpfp/Makefile +++ b/usr/src/uts/intel/sockpfp/Makefile @@ -22,11 +22,7 @@ # Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -# This makefile drives the production of the nca driver -# kernel module. -# -# intel architecture dependent -# +# Copyright (c) 2018, Joyent, Inc. # # Path to the base of the uts directory tree (usually /usr/src/uts). @@ -71,6 +67,9 @@ LINTTAGS += -erroff=E_PTRDIFF_OVERFLOW -erroff=E_BAD_PTR_CAST_ALIGN CERRWARN += -_gcc=-Wno-uninitialized CERRWARN += -_gcc=-Wno-unused-label +# needs work +SMOFF += all_func_returns + # # Default build targets. # diff --git a/usr/src/uts/intel/sol_ofs/Makefile b/usr/src/uts/intel/sol_ofs/Makefile index 8f1e756ee3..133af5c292 100644 --- a/usr/src/uts/intel/sol_ofs/Makefile +++ b/usr/src/uts/intel/sol_ofs/Makefile @@ -21,7 +21,8 @@ # # Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. # -# +# Copyright (c) 2018, Joyent, Inc. + # # Path to the base of the uts directory tree (usually /usr/src/uts). @@ -64,6 +65,9 @@ CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-type-limits CERRWARN += -_gcc=-Wno-unused-variable +# needs work +$(OBJS_DIR)/sol_cma.o := SMOFF += deref_check + # # Default build targets. # diff --git a/usr/src/uts/intel/sol_ucma/Makefile b/usr/src/uts/intel/sol_ucma/Makefile index 4b51aae13c..7069d920b4 100644 --- a/usr/src/uts/intel/sol_ucma/Makefile +++ b/usr/src/uts/intel/sol_ucma/Makefile @@ -21,7 +21,7 @@ # # Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. # -# +# Copyright (c) 2018, Joyent, Inc. # # Path to the base of the uts directory tree (usually /usr/src/uts). @@ -64,6 +64,9 @@ LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN LINTTAGS += -erroff=E_PTRDIFF_OVERFLOW LINTTAGS += -erroff=E_STATIC_UNUSED +# needs work +SMOFF += all_func_returns,logical_instead_of_bitwise + # # Default build targets. # diff --git a/usr/src/uts/intel/sol_uverbs/Makefile b/usr/src/uts/intel/sol_uverbs/Makefile index 548d80aad3..0a9fdbada8 100644 --- a/usr/src/uts/intel/sol_uverbs/Makefile +++ b/usr/src/uts/intel/sol_uverbs/Makefile @@ -21,7 +21,7 @@ # # Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. # -# +# Copyright (c) 2018, Joyent, Inc. # # Path to the base of the uts directory tree (usually /usr/src/uts). @@ -64,6 +64,9 @@ CERRWARN += -_gcc=-Wno-type-limits CERRWARN += -_gcc=-Wno-switch CERRWARN += -_gcc=-Wno-unused-label +# really broken +SMOFF += logical_instead_of_bitwise,or_vs_and + # # Default build targets. # diff --git a/usr/src/uts/intel/spdsock/Makefile b/usr/src/uts/intel/spdsock/Makefile index 5f980df27f..cae0da72f8 100644 --- a/usr/src/uts/intel/spdsock/Makefile +++ b/usr/src/uts/intel/spdsock/Makefile @@ -23,11 +23,7 @@ # Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -# This makefile drives the production of the spdsock driver -# kernel module. -# -# intel implementation architecture dependent -# +# Copyright (c) 2018, Joyent, Inc. # # Path to the base of the uts directory tree (usually /usr/src/uts). @@ -71,6 +67,10 @@ LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV CERRWARN += -_gcc=-Wno-uninitialized +# needs work +$(OBJS_DIR)/spdsockddi.o := SMOFF += index_overflow +$(OBJS_DIR)/spdsock.o := SMOFF += no_if_block + # # Default build targets. # diff --git a/usr/src/uts/intel/specfs/Makefile b/usr/src/uts/intel/specfs/Makefile index 8ff48afa63..ea18e2e9b7 100644 --- a/usr/src/uts/intel/specfs/Makefile +++ b/usr/src/uts/intel/specfs/Makefile @@ -24,6 +24,7 @@ # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # +# Copyright (c) 2018, Joyent, Inc. # # This makefile drives the production of the specfs file system @@ -75,6 +76,9 @@ LINTTAGS += -erroff=E_SUSPICIOUS_COMPARISON CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-uninitialized +# needs work +$(OBJS_DIR)/specvnops.o := SMOFF += signed + # # Default build targets. # diff --git a/usr/src/uts/intel/spppcomp/Makefile b/usr/src/uts/intel/spppcomp/Makefile index 31476b0589..1d3d2b3918 100644 --- a/usr/src/uts/intel/spppcomp/Makefile +++ b/usr/src/uts/intel/spppcomp/Makefile @@ -25,11 +25,7 @@ # Use is subject to license terms. # Copyright (c) 2011 Bayard G. Bell. All rights reserved. # -# This makefile drives the production of the spppcomp STREAMS -# kernel module. -# -# intel architecture dependent -# +# Copyright (c) 2018, Joyent, Inc. # # Path to the base of the uts directory tree (usually /usr/src/uts). @@ -78,6 +74,9 @@ LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-uninitialized +# needs work +SMOFF += indenting + # # Depends on sppp # diff --git a/usr/src/uts/intel/srpt/Makefile b/usr/src/uts/intel/srpt/Makefile index 424e85470e..e06aed2c91 100644 --- a/usr/src/uts/intel/srpt/Makefile +++ b/usr/src/uts/intel/srpt/Makefile @@ -21,8 +21,7 @@ # # Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. # -# This makefile drives the production of the srpt pseudo-driver for -# COMSTAR. +# Copyright (c) 2018, Joyent, Inc. # # Path to the base of the uts directory tree (usually /usr/src/uts). @@ -64,6 +63,9 @@ C99LMODE= -Xc99=%all CERRWARN += -_gcc=-Wno-unused-label +# needs work +$(OBJS_DIR)/srpt_stp.o := SMOFF += all_func_returns + # # Default build targets. # diff --git a/usr/src/uts/intel/st/Makefile b/usr/src/uts/intel/st/Makefile index 96ec74eb2f..7dbef2c9db 100644 --- a/usr/src/uts/intel/st/Makefile +++ b/usr/src/uts/intel/st/Makefile @@ -24,11 +24,7 @@ # Use is subject to license terms. # Copyright (c) 2011 Bayard G. Bell. All rights reserved. # -# This makefile drives the production of the st driver -# kernel module. -# -# intel implementation architecture independent -# +# Copyright (c) 2018, Joyent, Inc. # # Path to the base of the uts directory tree (usually /usr/src/uts). @@ -75,6 +71,9 @@ CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-switch CERRWARN += -_gcc=-Wno-uninitialized +# needs work +SMATCH=off + # # Depends on scsi # diff --git a/usr/src/uts/intel/stmf/Makefile b/usr/src/uts/intel/stmf/Makefile index 50ec544cbb..32eb938f7b 100644 --- a/usr/src/uts/intel/stmf/Makefile +++ b/usr/src/uts/intel/stmf/Makefile @@ -21,8 +21,7 @@ # # Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. # -# This makefile drives the production of the stmf driver for -# COMSTAR. +# Copyright (c) 2018, Joyent, Inc. # # Path to the base of the uts directory tree (usually /usr/src/uts). @@ -58,6 +57,9 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) $(ROOT_CONFFILE) MODSTUBS_DIR = $(OBJS_DIR) CERRWARN += -erroff=E_STATEMENT_NOT_REACHED +# needs work +SMATCH=off + C99LMODE= -Xc99=%all # diff --git a/usr/src/uts/intel/strategy/Makefile b/usr/src/uts/intel/strategy/Makefile index 80a819601d..68733ccbd5 100644 --- a/usr/src/uts/intel/strategy/Makefile +++ b/usr/src/uts/intel/strategy/Makefile @@ -25,6 +25,7 @@ # Copyright 2005 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # +# Copyright (c) 2018, Joyent, Inc. # # This makefile drives the production of the strategy "misc" @@ -53,6 +54,9 @@ include $(UTSBASE)/intel/Makefile.intel CERRWARN += -_gcc=-Wno-parentheses +# needs work +$(OBJS_DIR)/strategy.o := SMOFF += all_func_returns + # # Define targets # diff --git a/usr/src/uts/intel/tavor/Makefile b/usr/src/uts/intel/tavor/Makefile index fd0923b3c8..397e2c3f5f 100644 --- a/usr/src/uts/intel/tavor/Makefile +++ b/usr/src/uts/intel/tavor/Makefile @@ -23,12 +23,7 @@ # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -# This makefile drives the production of the tavor InfiniBand module -# -# intel architecture dependent -# -# uts/intel/tavor/Makefile -# +# Copyright (c) 2018, Joyent, Inc. # # Paths to the base of the uts directory trees @@ -86,6 +81,9 @@ CERRWARN += -_gcc=-Wno-unused-label CERRWARN += -_gcc=-Wno-uninitialized CERRWARN += -_gcc=-Wno-type-limits +# needs work +SMATCH=off + # # Default build targets. # diff --git a/usr/src/uts/intel/tcp/Makefile b/usr/src/uts/intel/tcp/Makefile index d083460646..f617552559 100644 --- a/usr/src/uts/intel/tcp/Makefile +++ b/usr/src/uts/intel/tcp/Makefile @@ -24,11 +24,7 @@ # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -# -# This makefile drives the production of the tcp driver kernel module. -# -# intel implementation architecture dependent -# +# Copyright (c) 2018, Joyent, Inc. # # Path to the base of the uts directory tree (usually /usr/src/uts). @@ -77,6 +73,9 @@ CFLAGS += $(CINLINES) # LDFLAGS += -dy -Ndrv/ip -Ncrypto/md5 -Nfs/sockfs +# needs work +$(OBJS_DIR)/tcpddi.o := SMOFF += index_overflow + # # Default build targets. # diff --git a/usr/src/uts/intel/tcp6/Makefile b/usr/src/uts/intel/tcp6/Makefile index 7612d1d551..386ddd9008 100644 --- a/usr/src/uts/intel/tcp6/Makefile +++ b/usr/src/uts/intel/tcp6/Makefile @@ -23,12 +23,7 @@ # Copyright 2004 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -# ident "%Z%%M% %I% %E% SMI" -# -# This makefile drives the production of the tcp6 driver kernel module. -# -# intel implementation architecture dependent -# +# Copyright (c) 2018, Joyent, Inc. # # Path to the base of the uts directory tree (usually /usr/src/uts). @@ -51,6 +46,9 @@ CONF_SRCDIR = $(UTSBASE)/common/inet/tcp IP_CHECK_OBJS = $(IP_OBJS:ipddi.o=ip.o) EXTRA_CHECK_OBJS = $(IP_CHECK_OBJS:%=../ip/$(OBJS_DIR)/%) +# needs work +SMOFF += index_overflow + # # Include common rules. # diff --git a/usr/src/uts/intel/timerfd/Makefile b/usr/src/uts/intel/timerfd/Makefile index 28cf8fd41e..ed7e847842 100644 --- a/usr/src/uts/intel/timerfd/Makefile +++ b/usr/src/uts/intel/timerfd/Makefile @@ -10,7 +10,7 @@ # # -# Copyright (c) 2015 Joyent, Inc. All rights reserved. +# Copyright (c) 2018, Joyent, Inc. # # @@ -34,6 +34,9 @@ include $(UTSBASE)/intel/Makefile.intel CERRWARN += -_gcc=-Wno-parentheses +# needs work +SMOFF += all_func_returns + # # Define targets # diff --git a/usr/src/uts/intel/timod/Makefile b/usr/src/uts/intel/timod/Makefile index 4dc824c8b6..1ffbfc0353 100644 --- a/usr/src/uts/intel/timod/Makefile +++ b/usr/src/uts/intel/timod/Makefile @@ -24,13 +24,7 @@ # Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -#ident "%Z%%M% %I% %E% SMI" -# -# This makefile drives the production of the timod streams kernel -# module. -# -# intel architecture dependent -# +# Copyright (c) 2018, Joyent, Inc. # # Path to the base of the uts directory tree (usually /usr/src/uts). @@ -65,6 +59,9 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN LINTTAGS += -erroff=E_PTRDIFF_OVERFLOW +# needs work +SMOFF += indenting + # # Default build targets. # diff --git a/usr/src/uts/intel/tl/Makefile b/usr/src/uts/intel/tl/Makefile index 83d7faeaad..c820c5b179 100644 --- a/usr/src/uts/intel/tl/Makefile +++ b/usr/src/uts/intel/tl/Makefile @@ -24,6 +24,7 @@ # Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # +# Copyright (c) 2018, Joyent, Inc. # # This makefile drives the production of the tl driver @@ -77,6 +78,9 @@ CERRWARN += -_gcc=-Wno-unused-function CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-uninitialized +# needs work +SMOFF += deref_check + # # Default build targets. # diff --git a/usr/src/uts/intel/tlimod/Makefile b/usr/src/uts/intel/tlimod/Makefile index 3e0f5f1fdd..73584a9145 100644 --- a/usr/src/uts/intel/tlimod/Makefile +++ b/usr/src/uts/intel/tlimod/Makefile @@ -24,13 +24,7 @@ # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -#ident "%Z%%M% %I% %E% SMI" -# -# This makefile drives the production of the tlimod -# kernel module. -# -# intel architecture dependent -# +# Copyright (c) 2018, Joyent, Inc. # # Path to the base of the uts directory tree (usually /usr/src/uts). @@ -57,6 +51,9 @@ ALL_TARGET = $(BINARY) LINT_TARGET = $(MODULE).lint INSTALL_TARGET = $(BINARY) $(ROOTMODULE) +# needs work +SMOFF += indenting + # # Default build targets. # diff --git a/usr/src/uts/intel/tmpfs/Makefile b/usr/src/uts/intel/tmpfs/Makefile index 7d94dba6e8..bfc9769c6d 100644 --- a/usr/src/uts/intel/tmpfs/Makefile +++ b/usr/src/uts/intel/tmpfs/Makefile @@ -24,6 +24,7 @@ # Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # +# Copyright (c) 2018, Joyent, Inc. # # This makefile drives the production of the tmpfs file system @@ -69,6 +70,9 @@ CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-uninitialized CERRWARN += -_gcc=-Wno-unused-value +# needs work +$(OBJS_DIR)/tmp_vnops.o := SMOFF += signed + # # Default build targets. # diff --git a/usr/src/uts/intel/tnf/Makefile b/usr/src/uts/intel/tnf/Makefile index 99ea51b39f..de264140d0 100644 --- a/usr/src/uts/intel/tnf/Makefile +++ b/usr/src/uts/intel/tnf/Makefile @@ -24,6 +24,7 @@ # Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # +# Copyright (c) 2018, Joyent, Inc. # # tnf (kernel trace driver) Makefile @@ -68,6 +69,10 @@ LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-uninitialized + +# needs work +$(OBJS_DIR)/tnf_writer.o := SMOFF += all_func_returns + # # Default build targets. # diff --git a/usr/src/uts/intel/tpm/Makefile b/usr/src/uts/intel/tpm/Makefile index c87048cceb..185ddd6c68 100644 --- a/usr/src/uts/intel/tpm/Makefile +++ b/usr/src/uts/intel/tpm/Makefile @@ -21,9 +21,7 @@ # Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -# This makefile drives the production of the TPM driver kernel -# module. -# +# Copyright (c) 2018, Joyent, Inc. UTSBASE = $(SRC)/uts @@ -65,6 +63,9 @@ CPPFLAGS += -I$(ADJUNCT_PROTO)/usr/include CERRWARN += -_gcc=-Wno-parentheses +# needs work +$(OBJS_DIR)/tpm.o := SMOFF += index_overflow + # # Default build targets. # diff --git a/usr/src/uts/intel/trill/Makefile b/usr/src/uts/intel/trill/Makefile index 4ef89d3a1d..bc9f9ed05f 100644 --- a/usr/src/uts/intel/trill/Makefile +++ b/usr/src/uts/intel/trill/Makefile @@ -24,11 +24,7 @@ # Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -# This makefile drives the production of the TRILL socket kernel -# module. -# -# intel architecture dependent -# +# Copyright (c) 2018, Joyent, Inc. # # Path to the base of the uts directory tree (usually /usr/src/uts). @@ -50,6 +46,9 @@ include $(UTSBASE)/intel/Makefile.intel CERRWARN += -_gcc=-Wno-uninitialized +# needs work +SMOFF += all_func_returns + # # Define targets # diff --git a/usr/src/uts/intel/udfs/Makefile b/usr/src/uts/intel/udfs/Makefile index a1d5d5daaa..244123e4f3 100644 --- a/usr/src/uts/intel/udfs/Makefile +++ b/usr/src/uts/intel/udfs/Makefile @@ -23,11 +23,7 @@ # Use is subject to license terms. # Copyright (c) 2011 Bayard G. Bell. All rights reserved. # -# This makefile drives the production of the udfs file system -# kernel module. -# -# intel implementation architecture dependent -# +# Copyright (c) 2018, Joyent, Inc. # # Path to the base of the uts directory tree (usually /usr/src/uts). @@ -83,6 +79,9 @@ CERRWARN += -_gcc=-Wno-unused-label CERRWARN += -_gcc=-Wno-uninitialized CERRWARN += -_gcc=-Wno-type-limits +# needs work +SMATCH=off + # # Default build targets. # diff --git a/usr/src/uts/intel/udmf/Makefile b/usr/src/uts/intel/udmf/Makefile index f43cb3268e..a4a5495d5e 100644 --- a/usr/src/uts/intel/udmf/Makefile +++ b/usr/src/uts/intel/udmf/Makefile @@ -10,7 +10,7 @@ # # -# Copyright (c) 2014 Joyent, Inc. All rights reserved. +# Copyright (c) 2018, Joyent, Inc. # # @@ -47,6 +47,9 @@ LINTTAGS += -erroff=E_STATIC_UNUSED LINTTAGS += -erroff=E_FUNC_RET_ALWAYS_IGNOR2 LINTTAGS += -erroff=E_FUNC_SET_NOT_USED +# needs work +$(OBJS_DIR)/udmf_usbgem.o := SMOFF += indenting + # # Define targets # diff --git a/usr/src/uts/intel/udp/Makefile b/usr/src/uts/intel/udp/Makefile index c6238ebd8c..5ae4cfe6e1 100644 --- a/usr/src/uts/intel/udp/Makefile +++ b/usr/src/uts/intel/udp/Makefile @@ -24,10 +24,7 @@ # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -# This makefile drives the production of the udp driver kernel module. -# -# intel implementation architecture dependent -# +# Copyright (c) 2018, Joyent, Inc. # # Path to the base of the uts directory tree (usually /usr/src/uts). @@ -68,6 +65,9 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) $(ROOTLINK) $(ROOT_CONFFILE) # LDFLAGS += -dy -Ndrv/ip -Nfs/sockfs +# needs work +$(OBJS_DIR)/udpddi.o := SMOFF += index_overflow + # # Default build targets. # diff --git a/usr/src/uts/intel/udp6/Makefile b/usr/src/uts/intel/udp6/Makefile index 8a6b71160a..28a6e8f978 100644 --- a/usr/src/uts/intel/udp6/Makefile +++ b/usr/src/uts/intel/udp6/Makefile @@ -23,12 +23,7 @@ # Copyright 2004 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -# ident "%Z%%M% %I% %E% SMI" -# -# This makefile drives the production of the udp6 driver kernel module. -# -# intel implementation architecture dependent -# +# Copyright (c) 2018, Joyent, Inc. # # Path to the base of the uts directory tree (usually /usr/src/uts). @@ -61,6 +56,9 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) $(ROOT_CONFFILE) # LDFLAGS += -dy -Ndrv/udp -Ndrv/ip -Ndrv/ip6 +# needs work +SMOFF += index_overflow + # # Default build targets. # diff --git a/usr/src/uts/intel/ufs/Makefile b/usr/src/uts/intel/ufs/Makefile index b7127a0e23..0264031fcd 100644 --- a/usr/src/uts/intel/ufs/Makefile +++ b/usr/src/uts/intel/ufs/Makefile @@ -24,6 +24,7 @@ # Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # +# Copyright (c) 2018, Joyent, Inc. # # This makefile drives the production of the ufs file system @@ -82,6 +83,9 @@ CERRWARN += -_gcc=-Wno-uninitialized CERRWARN += -_gcc=-Wno-type-limits CERRWARN += -_gcc=-Wno-unused-label +# needs work +SMATCH=off + # # Default build targets. # diff --git a/usr/src/uts/intel/upf/Makefile b/usr/src/uts/intel/upf/Makefile index 25f7e577db..c9b724ff24 100644 --- a/usr/src/uts/intel/upf/Makefile +++ b/usr/src/uts/intel/upf/Makefile @@ -10,7 +10,7 @@ # # -# Copyright (c) 2014 Joyent, Inc. All rights reserved. +# Copyright (c) 2018, Joyent, Inc. # # @@ -41,6 +41,9 @@ CERRWARN += -_gcc=-Wno-unused-function CERRWARN += -_gcc=-Wno-unused-variable CERRWARN += -_gcc=-Wno-unused-label +# needs work +$(OBJS_DIR)/upf_usbgem.o := SMOFF += all_func_returns + LINTTAGS += -erroff=E_FUNC_VAR_UNUSED LINTTAGS += -erroff=E_FUNC_ARG_UNUSED LINTTAGS += -erroff=E_STATIC_UNUSED diff --git a/usr/src/uts/intel/ural/Makefile b/usr/src/uts/intel/ural/Makefile index 33a44df7b7..de779ab288 100644 --- a/usr/src/uts/intel/ural/Makefile +++ b/usr/src/uts/intel/ural/Makefile @@ -22,13 +22,7 @@ # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # - -# ident "%Z%%M% %I% %E% SMI" -# -# This makefile drives the production of the ural driver kernel module. -# -# i86pc architecture dependent -# +# Copyright (c) 2018, Joyent, Inc. # # Path to the base of the uts directory tree (usually /usr/src/uts). @@ -60,6 +54,9 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) # LDFLAGS += -dy -Nmisc/mac -Nmisc/net80211 -Nmisc/usba +# needs work +SMOFF += deref_check + # # Default build targets. # diff --git a/usr/src/uts/intel/urtw/Makefile b/usr/src/uts/intel/urtw/Makefile index a7b03b6bb3..76d86130c7 100644 --- a/usr/src/uts/intel/urtw/Makefile +++ b/usr/src/uts/intel/urtw/Makefile @@ -22,6 +22,7 @@ # Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # +# Copyright (c) 2018, Joyent, Inc. # # This makefile drives the production of the urtw driver kernel module. @@ -64,6 +65,9 @@ CERRWARN += -_gcc=-Wno-switch CERRWARN += -_gcc=-Wno-char-subscripts CERRWARN += -_gcc=-Wno-uninitialized +# needs work +SMOFF += deref_check,no_if_block,all_func_returns + # # Default build targets. # diff --git a/usr/src/uts/intel/usb_ac/Makefile b/usr/src/uts/intel/usb_ac/Makefile index f2852a17c0..43e880c9ee 100644 --- a/usr/src/uts/intel/usb_ac/Makefile +++ b/usr/src/uts/intel/usb_ac/Makefile @@ -24,11 +24,7 @@ # # Copyright 2014 Garrett D'Amore <garrett@damore.org> # -# uts/intel/usb_ac/Makefile -# -# This makefile drives the production of the usb_ac driver -# kernel module. Intel architecture dependent -# +# Copyright (c) 2018, Joyent, Inc. # @@ -68,6 +64,9 @@ CERRWARN += -_gcc=-Wno-type-limits CERRWARN += -_gcc=-Wno-unused-label CERRWARN += -_gcc=-Wno-uninitialized +# needs work +$(OBJS_DIR)/usb_ac.o := SMOFF += deref_check,indenting,testing_index_after_use + # # depends on misc/usba # diff --git a/usr/src/uts/intel/usba/Makefile b/usr/src/uts/intel/usba/Makefile index fbd834917a..ae74e680d1 100644 --- a/usr/src/uts/intel/usba/Makefile +++ b/usr/src/uts/intel/usba/Makefile @@ -23,9 +23,7 @@ # Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -# -# This makefile drives the production of the usba kernel module. -# +# Copyright (c) 2018, Joyent, Inc. # # Path to the base of the uts directory tree (usually /usr/src/uts). @@ -52,6 +50,9 @@ CERRWARN += -_gcc=-Wno-unused-label CERRWARN += -_gcc=-Wno-unused-value CERRWARN += -_gcc=-Wno-unused-variable +# needs work +SMOFF += all_func_returns,deref_check + # # Define targets # diff --git a/usr/src/uts/intel/usbecm/Makefile b/usr/src/uts/intel/usbecm/Makefile index 3ee8f01ef6..b9687406f9 100644 --- a/usr/src/uts/intel/usbecm/Makefile +++ b/usr/src/uts/intel/usbecm/Makefile @@ -25,8 +25,8 @@ # # Copyright 2014 Garrett D'Amore <garrett@damore.org> # -# This makefile drives the production of Abstract Control Model of -# USB Communication Devices Class dirver. +# Copyright (c) 2018, Joyent, Inc. + # # Path to the base of the uts directory tree (usually /usr/src/uts). # @@ -54,6 +54,9 @@ ALL_TARGET = $(BINARY) LINT_TARGET = $(MODULE).lint INSTALL_TARGET = $(BINARY) $(ROOTMODULE) +# needs work +SMOFF += deref_check + .KEEP_STATE: all: $(ALL_DEPS) diff --git a/usr/src/uts/intel/usbgem/Makefile b/usr/src/uts/intel/usbgem/Makefile index 6ec0666264..3d9bfe6e6e 100644 --- a/usr/src/uts/intel/usbgem/Makefile +++ b/usr/src/uts/intel/usbgem/Makefile @@ -10,7 +10,7 @@ # # -# Copyright (c) 2014 Joyent, Inc. All rights reserved. +# Copyright (c) 2018, Joyent, Inc. # # @@ -49,6 +49,9 @@ CERRWARN += -_gcc=-Wno-unused-variable CERRWARN += -_gcc=-Wno-unused-label CERRWARN += -_gcc=-Wno-unused-function +# needs work +SMOFF += all_func_returns + LINTTAGS += -erroff=E_FUNC_VAR_UNUSED LINTTAGS += -erroff=E_FUNC_ARG_UNUSED LINTTAGS += -erroff=E_STATIC_UNUSED diff --git a/usr/src/uts/intel/usbms/Makefile b/usr/src/uts/intel/usbms/Makefile index 2cf550f26c..0a184975d0 100644 --- a/usr/src/uts/intel/usbms/Makefile +++ b/usr/src/uts/intel/usbms/Makefile @@ -23,9 +23,7 @@ # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -# -# This makefile drives the production of the usbms driver kernel module. -# +# Copyright (c) 2018, Joyent, Inc. # # Path to the base of the uts directory tree (usually /usr/src/uts). @@ -73,6 +71,9 @@ LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-uninitialized +# needs work +SMOFF += deref_check + # # Default build targets. # diff --git a/usr/src/uts/intel/usbsacm/Makefile b/usr/src/uts/intel/usbsacm/Makefile index 23da8c76d0..09cc016b1f 100644 --- a/usr/src/uts/intel/usbsacm/Makefile +++ b/usr/src/uts/intel/usbsacm/Makefile @@ -23,9 +23,8 @@ # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -# -# This makefile drives the production of Abstract Control Model of -# USB Communication Devices Class dirver. +# Copyright (c) 2018, Joyent, Inc. + # # Path to the base of the uts directory tree (usually /usr/src/uts). # @@ -48,6 +47,9 @@ LDFLAGS += -dy -Nmisc/usba -Nmisc/usbser CERRWARN += -_gcc=-Wno-uninitialized +# needs work +SMOFF += deref_check + # # Define targets # diff --git a/usr/src/uts/intel/usbser/Makefile b/usr/src/uts/intel/usbser/Makefile index 9022579ae6..7932c9894f 100644 --- a/usr/src/uts/intel/usbser/Makefile +++ b/usr/src/uts/intel/usbser/Makefile @@ -22,7 +22,7 @@ # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -# uts/intel/usbser/Makefile +# Copyright (c) 2018, Joyent, Inc. # @@ -65,6 +65,9 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) # LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN +# needs work +SMOFF += all_func_returns + .KEEP_STATE: all: $(ALL_DEPS) diff --git a/usr/src/uts/intel/usbvc/Makefile b/usr/src/uts/intel/usbvc/Makefile index 303a025e1e..364d5f3139 100644 --- a/usr/src/uts/intel/usbvc/Makefile +++ b/usr/src/uts/intel/usbvc/Makefile @@ -25,6 +25,7 @@ # # Copyright 2014 Garrett D'Amore <garrett@damore.org> # +# Copyright (c) 2018, Joyent, Inc. # # This makefile drives the production of the usbvc driver kernel module. @@ -74,6 +75,9 @@ LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN CERRWARN += -_gcc=-Wno-uninitialized +# needs work +SMOFF += deref_check + # # Default build targets. # diff --git a/usr/src/uts/intel/virtio/Makefile b/usr/src/uts/intel/virtio/Makefile index 10418db2cc..1f6548a135 100644 --- a/usr/src/uts/intel/virtio/Makefile +++ b/usr/src/uts/intel/virtio/Makefile @@ -21,6 +21,7 @@ # # Copyright (c) 2012 Nexenta Systems, Inc. All rights reserved. +# Copyright (c) 2018, Joyent, Inc. # # @@ -59,6 +60,9 @@ INC_PATH += -I$(UTSBASE)/common/io/virtio # CFLAGS += $(CCVERBOSE) +# needs work +SMOFF += all_func_returns + # # Default build targets. # diff --git a/usr/src/uts/intel/vnic/Makefile b/usr/src/uts/intel/vnic/Makefile index 15ee8a885c..357600fa72 100644 --- a/usr/src/uts/intel/vnic/Makefile +++ b/usr/src/uts/intel/vnic/Makefile @@ -22,6 +22,8 @@ # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # +# Copyright (c) 2018, Joyent, Inc. + # # Path to the base of the uts directory tree (usually /usr/src/uts). # @@ -57,6 +59,9 @@ LDFLAGS += -dy -Ndrv/dld -Nmisc/mac -Nmisc/dls CERRWARN += -_gcc=-Wno-switch CERRWARN += -_gcc=-Wno-uninitialized +# needs work +SMOFF += deref_check + # # Default build targets. # diff --git a/usr/src/uts/intel/vr/Makefile b/usr/src/uts/intel/vr/Makefile index 85e97f4f6b..05f33305b7 100644 --- a/usr/src/uts/intel/vr/Makefile +++ b/usr/src/uts/intel/vr/Makefile @@ -22,6 +22,7 @@ # Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # +# Copyright (c) 2018, Joyent, Inc. # This makefile drives the production of the VIA Rhine Ethernet # (vr) driver module in intel systems @@ -59,6 +60,9 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) CERRWARN += -_gcc=-Wno-unused-label CERRWARN += -_gcc=-Wno-uninitialized +# needs work +SMOFF += array_condition + # # Driver depends on GLD # diff --git a/usr/src/uts/intel/vuid2ps2/Makefile b/usr/src/uts/intel/vuid2ps2/Makefile index 207f0c1d45..47f7c4fcd7 100644 --- a/usr/src/uts/intel/vuid2ps2/Makefile +++ b/usr/src/uts/intel/vuid2ps2/Makefile @@ -24,6 +24,7 @@ # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # +# Copyright (c) 2018, Joyent, Inc. # # This makefile drives the production of the vuid2ps2 streams kernel @@ -53,6 +54,9 @@ include $(UTSBASE)/intel/Makefile.intel CERRWARN += -_gcc=-Wno-uninitialized CERRWARN += -_gcc=-Wno-parentheses +# needs work +SMOFF += deref_check + # # Define targets # diff --git a/usr/src/uts/intel/vuid3ps2/Makefile b/usr/src/uts/intel/vuid3ps2/Makefile index b6d28fc856..28664ccd9e 100644 --- a/usr/src/uts/intel/vuid3ps2/Makefile +++ b/usr/src/uts/intel/vuid3ps2/Makefile @@ -24,6 +24,7 @@ # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # +# Copyright (c) 2018, Joyent, Inc. # # This makefile drives the production of the vuid3ps2 streams kernel @@ -53,6 +54,9 @@ include $(UTSBASE)/intel/Makefile.intel CERRWARN += -_gcc=-Wno-uninitialized CERRWARN += -_gcc=-Wno-parentheses +# needs work +SMOFF += deref_check + # # Define targets # diff --git a/usr/src/uts/intel/vuidm3p/Makefile b/usr/src/uts/intel/vuidm3p/Makefile index 2d068a6e05..8084cbc35a 100644 --- a/usr/src/uts/intel/vuidm3p/Makefile +++ b/usr/src/uts/intel/vuidm3p/Makefile @@ -24,6 +24,7 @@ # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # +# Copyright (c) 2018, Joyent, Inc. # # This makefile drives the production of the vuidm3p streams kernel @@ -64,6 +65,9 @@ ALL_DEFS += -DVUIDM3P CERRWARN += -_gcc=-Wno-uninitialized +# needs work +SMOFF += deref_check + # # Default build targets. # diff --git a/usr/src/uts/intel/vuidm4p/Makefile b/usr/src/uts/intel/vuidm4p/Makefile index 0fe311ad2f..23f2265cdd 100644 --- a/usr/src/uts/intel/vuidm4p/Makefile +++ b/usr/src/uts/intel/vuidm4p/Makefile @@ -24,6 +24,7 @@ # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # +# Copyright (c) 2018, Joyent, Inc. # # This makefile drives the production of the vuidm4p streams kernel @@ -64,6 +65,9 @@ ALL_DEFS += -DVUIDM4P CERRWARN += -_gcc=-Wno-uninitialized +# needs work +SMOFF += deref_check + # # Default build targets. # diff --git a/usr/src/uts/intel/vuidm5p/Makefile b/usr/src/uts/intel/vuidm5p/Makefile index f127056424..4ddc855e60 100644 --- a/usr/src/uts/intel/vuidm5p/Makefile +++ b/usr/src/uts/intel/vuidm5p/Makefile @@ -24,6 +24,7 @@ # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # +# Copyright (c) 2018, Joyent, Inc. # # This makefile drives the production of the vuidm5p streams kernel @@ -61,6 +62,9 @@ ALL_DEFS += -DVUIDM5P CERRWARN += -_gcc=-Wno-uninitialized +# needs work +SMOFF += deref_check + # # Default build targets. # diff --git a/usr/src/uts/intel/wc/Makefile b/usr/src/uts/intel/wc/Makefile index d84d5a4faa..b855fa56bc 100644 --- a/usr/src/uts/intel/wc/Makefile +++ b/usr/src/uts/intel/wc/Makefile @@ -23,12 +23,7 @@ # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -# -# This makefile drives the production of the wc driver -# kernel module. -# -# intel implementation architecture independent -# +# Copyright (c) 2018, Joyent, Inc. # # Path to the base of the uts directory tree (usually /usr/src/uts). @@ -63,6 +58,9 @@ LDFLAGS += -dy -Nmisc/tem -Ndacf/consconfig_dacf CERRWARN += -_gcc=-Wno-uninitialized +# needs work +SMOFF += deref_check + # # Default build targets. # diff --git a/usr/src/uts/intel/xge/Makefile b/usr/src/uts/intel/xge/Makefile index 7df734d75d..1c9b0e2e2b 100644 --- a/usr/src/uts/intel/xge/Makefile +++ b/usr/src/uts/intel/xge/Makefile @@ -23,9 +23,7 @@ # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -# This makefile drives the production of the Neterion Xframe -# 10G Ethernet (XGE) driver module in x86 systems -# +# Copyright (c) 2018, Joyent, Inc. # # Paths to the base of the uts directory trees @@ -112,6 +110,9 @@ CERRWARN += -_gcc=-Wno-unused-label CERRWARN += -_gcc=-Wno-empty-body CERRWARN += -_gcc=-Wno-uninitialized +# needs work +SMOFF += indenting,all_func_returns,no_if_block + # # # Default build targets. diff --git a/usr/src/uts/intel/zfs/Makefile b/usr/src/uts/intel/zfs/Makefile index 07d4395c22..f1715120dd 100644 --- a/usr/src/uts/intel/zfs/Makefile +++ b/usr/src/uts/intel/zfs/Makefile @@ -29,7 +29,7 @@ # # Copyright (c) 2016 by Delphix. All rights reserved. # -# Copyright 2018 Joyent, Inc. +# Copyright (c) 2018, Joyent, Inc. # # Path to the base of the uts directory tree (usually /usr/src/uts). @@ -95,6 +95,18 @@ CERRWARN += -_gcc=-Wno-unused-variable CERRWARN += -_gcc=-Wno-unused-function CERRWARN += -_gcc=-Wno-unused-label +# needs work +SMOFF += all_func_returns,indenting +$(OBJS_DIR)/llex.o := SMOFF += index_overflow +$(OBJS_DIR)/metaslab.o := SMOFF += no_if_block +$(OBJS_DIR)/zfs_vnops.o := SMOFF += signed +# needs work +$(OBJS_DIR)/zvol.o := SMOFF += deref_check,signed + +# false positives +$(OBJS_DIR)/zfs_ctldir.o := SMOFF += strcpy_overflow +$(OBJS_DIR)/zfs_ioctl.o := SMOFF += strcpy_overflow + # # Default build targets. # |
