summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRenato Botelho <renato@netgate.com>2018-05-18 14:53:44 -0300
committerRenato Botelho <renato@netgate.com>2018-05-18 14:53:44 -0300
commit64f021cd075bbcb3042539dcebc63e7d335ec2c0 (patch)
tree1a64375406a7b5976f98eaf4cf19f00cf2931dd1
parent8f29f1de284afe0ec8987780d5404a3e1a31712a (diff)
parenteb64daea863b1fe3320e10c6c72cbfe7e9ce967b (diff)
downloadFreeBSD-src-64f021cd075bbcb3042539dcebc63e7d335ec2c0.zip
FreeBSD-src-64f021cd075bbcb3042539dcebc63e7d335ec2c0.tar.gz
Merge remote-tracking branch 'origin/stable/11' into devel-11
-rw-r--r--contrib/elftoolchain/elfcopy/elfcopy.h1
-rw-r--r--contrib/elftoolchain/elfcopy/sections.c1
-rw-r--r--contrib/elftoolchain/elfcopy/segments.c2
-rw-r--r--contrib/elftoolchain/readelf/readelf.c19
-rw-r--r--etc/etc.aarch64/ttys18
-rw-r--r--etc/etc.amd64/ttys16
-rw-r--r--etc/etc.arm/ttys16
-rw-r--r--etc/etc.i386/ttys16
-rw-r--r--etc/etc.powerpc/ttys16
-rw-r--r--etc/etc.riscv/ttys18
-rw-r--r--etc/etc.sparc64/ttys16
-rw-r--r--include/ttyent.h3
-rw-r--r--lib/libc/gen/getttyent.36
-rw-r--r--lib/libc/gen/getttyent.c32
-rw-r--r--libexec/getty/ttys.58
-rw-r--r--release/arm/BEAGLEBONE.conf2
-rw-r--r--release/arm/GUMSTIX.conf2
-rw-r--r--release/arm/PANDABOARD.conf2
-rw-r--r--release/doc/en_US.ISO8859-1/hardware/article.xml1
-rw-r--r--release/doc/en_US.ISO8859-1/installation/article.xml2
-rw-r--r--release/doc/en_US.ISO8859-1/readme/article.xml1
-rw-r--r--release/doc/en_US.ISO8859-1/relnotes/article.xml112
-rw-r--r--sbin/init/init.c50
-rw-r--r--sbin/ipfw/ipfw2.c6
-rw-r--r--share/man/man4/vxge.46
-rw-r--r--stand/arm64/Makefile2
-rw-r--r--sys/amd64/amd64/elf_machdep.c29
-rw-r--r--sys/amd64/amd64/machdep.c19
-rw-r--r--sys/arm/include/atomic-v4.h44
-rw-r--r--sys/arm/include/atomic-v6.h46
-rw-r--r--sys/conf/newvers.sh2
-rw-r--r--sys/dev/mmc/mmcsd.c18
-rw-r--r--sys/dev/sdhci/sdhci_acpi.c10
-rw-r--r--sys/dev/sdhci/sdhci_pci.c4
-rw-r--r--sys/dev/vxge/vxge.c1
-rw-r--r--sys/i386/i386/elf_machdep.c30
-rw-r--r--sys/i386/i386/machdep.c4
-rw-r--r--sys/kern/link_elf.c80
-rw-r--r--sys/kern/link_elf_obj.c22
-rw-r--r--sys/net/if_ipsec.c2
-rw-r--r--sys/sys/linker.h9
-rw-r--r--sys/x86/include/ifunc.h58
42 files changed, 581 insertions, 171 deletions
diff --git a/contrib/elftoolchain/elfcopy/elfcopy.h b/contrib/elftoolchain/elfcopy/elfcopy.h
index 5593a9a..c152588 100644
--- a/contrib/elftoolchain/elfcopy/elfcopy.h
+++ b/contrib/elftoolchain/elfcopy/elfcopy.h
@@ -127,6 +127,7 @@ struct section {
uint64_t cap; /* section capacity */
uint64_t align; /* section alignment */
uint64_t type; /* section type */
+ uint64_t flags; /* section flags */
uint64_t vma; /* section virtual addr */
uint64_t lma; /* section load addr */
uint64_t pad_sz;/* section padding size */
diff --git a/contrib/elftoolchain/elfcopy/sections.c b/contrib/elftoolchain/elfcopy/sections.c
index 298fce4..b292d18 100644
--- a/contrib/elftoolchain/elfcopy/sections.c
+++ b/contrib/elftoolchain/elfcopy/sections.c
@@ -411,6 +411,7 @@ create_scn(struct elfcopy *ecp)
s->sz = ish.sh_size;
s->align = ish.sh_addralign;
s->type = ish.sh_type;
+ s->flags = ish.sh_flags;
s->vma = ish.sh_addr;
/*
diff --git a/contrib/elftoolchain/elfcopy/segments.c b/contrib/elftoolchain/elfcopy/segments.c
index 9a26bba..27d5e7a 100644
--- a/contrib/elftoolchain/elfcopy/segments.c
+++ b/contrib/elftoolchain/elfcopy/segments.c
@@ -79,6 +79,8 @@ add_to_inseg_list(struct elfcopy *ecp, struct section *s)
continue;
if (s->vma + s->sz > seg->vaddr + seg->msz)
continue;
+ if (seg->type == PT_TLS && ((s->flags & SHF_TLS) == 0))
+ continue;
insert_to_inseg_list(seg, s);
if (seg->type == PT_LOAD)
diff --git a/contrib/elftoolchain/readelf/readelf.c b/contrib/elftoolchain/readelf/readelf.c
index b4d0790..bed7919 100644
--- a/contrib/elftoolchain/readelf/readelf.c
+++ b/contrib/elftoolchain/readelf/readelf.c
@@ -2377,11 +2377,22 @@ dump_phdr(struct readelf *re)
}
printf(" %2.2d ", i);
/* skip NULL section. */
- for (j = 1; (size_t)j < re->shnum; j++)
- if (re->sl[j].addr >= phdr.p_vaddr &&
- re->sl[j].addr + re->sl[j].sz <=
+ for (j = 1; (size_t)j < re->shnum; j++) {
+ if (re->sl[j].off < phdr.p_offset)
+ continue;
+ if (re->sl[j].off + re->sl[j].sz >
+ phdr.p_offset + phdr.p_filesz &&
+ re->sl[j].type != SHT_NOBITS)
+ continue;
+ if (re->sl[j].addr < phdr.p_vaddr ||
+ re->sl[j].addr + re->sl[j].sz >
phdr.p_vaddr + phdr.p_memsz)
- printf("%s ", re->sl[j].name);
+ continue;
+ if (phdr.p_type == PT_TLS &&
+ (re->sl[j].flags & SHF_TLS) == 0)
+ continue;
+ printf("%s ", re->sl[j].name);
+ }
printf("\n");
}
#undef PH_HDR
diff --git a/etc/etc.aarch64/ttys b/etc/etc.aarch64/ttys
index f5f225e..7412f97 100644
--- a/etc/etc.aarch64/ttys
+++ b/etc/etc.aarch64/ttys
@@ -29,16 +29,16 @@
# when going to single-user mode.
console none unknown off secure
#
-ttyv0 "/usr/libexec/getty Pc" xterm onifconsole secure
+ttyv0 "/usr/libexec/getty Pc" xterm onifexists secure
# Virtual terminals
-ttyv1 "/usr/libexec/getty Pc" xterm off secure
-ttyv2 "/usr/libexec/getty Pc" xterm off secure
-ttyv3 "/usr/libexec/getty Pc" xterm off secure
-ttyv4 "/usr/libexec/getty Pc" xterm off secure
-ttyv5 "/usr/libexec/getty Pc" xterm off secure
-ttyv6 "/usr/libexec/getty Pc" xterm off secure
-ttyv7 "/usr/libexec/getty Pc" xterm off secure
-#ttyv8 "/usr/local/bin/xdm -nodaemon" xterm off secure
+ttyv1 "/usr/libexec/getty Pc" xterm onifexists secure
+ttyv2 "/usr/libexec/getty Pc" xterm onifexists secure
+ttyv3 "/usr/libexec/getty Pc" xterm onifexists secure
+ttyv4 "/usr/libexec/getty Pc" xterm onifexists secure
+ttyv5 "/usr/libexec/getty Pc" xterm onifexists secure
+ttyv6 "/usr/libexec/getty Pc" xterm onifexists secure
+ttyv7 "/usr/libexec/getty Pc" xterm onifexists secure
+#ttyv8 "/usr/local/bin/xdm -nodaemon" xterm onifexists secure
# Serial terminals
# The 'dialup' keyword identifies dialin lines to login, fingerd etc.
ttyu0 "/usr/libexec/getty 3wire" vt100 onifconsole secure
diff --git a/etc/etc.amd64/ttys b/etc/etc.amd64/ttys
index 15eb30d..b839278 100644
--- a/etc/etc.amd64/ttys
+++ b/etc/etc.amd64/ttys
@@ -29,15 +29,15 @@
# when going to single-user mode.
console none unknown off secure
#
-ttyv0 "/usr/libexec/getty Pc" xterm on secure
+ttyv0 "/usr/libexec/getty Pc" xterm onifexists secure
# Virtual terminals
-ttyv1 "/usr/libexec/getty Pc" xterm on secure
-ttyv2 "/usr/libexec/getty Pc" xterm on secure
-ttyv3 "/usr/libexec/getty Pc" xterm on secure
-ttyv4 "/usr/libexec/getty Pc" xterm on secure
-ttyv5 "/usr/libexec/getty Pc" xterm on secure
-ttyv6 "/usr/libexec/getty Pc" xterm on secure
-ttyv7 "/usr/libexec/getty Pc" xterm on secure
+ttyv1 "/usr/libexec/getty Pc" xterm onifexists secure
+ttyv2 "/usr/libexec/getty Pc" xterm onifexists secure
+ttyv3 "/usr/libexec/getty Pc" xterm onifexists secure
+ttyv4 "/usr/libexec/getty Pc" xterm onifexists secure
+ttyv5 "/usr/libexec/getty Pc" xterm onifexists secure
+ttyv6 "/usr/libexec/getty Pc" xterm onifexists secure
+ttyv7 "/usr/libexec/getty Pc" xterm onifexists secure
ttyv8 "/usr/local/bin/xdm -nodaemon" xterm off secure
# Serial terminals
# The 'dialup' keyword identifies dialin lines to login, fingerd etc.
diff --git a/etc/etc.arm/ttys b/etc/etc.arm/ttys
index f5f225e..8bbb488 100644
--- a/etc/etc.arm/ttys
+++ b/etc/etc.arm/ttys
@@ -29,15 +29,15 @@
# when going to single-user mode.
console none unknown off secure
#
-ttyv0 "/usr/libexec/getty Pc" xterm onifconsole secure
+ttyv0 "/usr/libexec/getty Pc" xterm onifexists secure
# Virtual terminals
-ttyv1 "/usr/libexec/getty Pc" xterm off secure
-ttyv2 "/usr/libexec/getty Pc" xterm off secure
-ttyv3 "/usr/libexec/getty Pc" xterm off secure
-ttyv4 "/usr/libexec/getty Pc" xterm off secure
-ttyv5 "/usr/libexec/getty Pc" xterm off secure
-ttyv6 "/usr/libexec/getty Pc" xterm off secure
-ttyv7 "/usr/libexec/getty Pc" xterm off secure
+ttyv1 "/usr/libexec/getty Pc" xterm onifexists secure
+ttyv2 "/usr/libexec/getty Pc" xterm onifexists secure
+ttyv3 "/usr/libexec/getty Pc" xterm onifexists secure
+ttyv4 "/usr/libexec/getty Pc" xterm onifexists secure
+ttyv5 "/usr/libexec/getty Pc" xterm onifexists secure
+ttyv6 "/usr/libexec/getty Pc" xterm onifexists secure
+ttyv7 "/usr/libexec/getty Pc" xterm onifexists secure
#ttyv8 "/usr/local/bin/xdm -nodaemon" xterm off secure
# Serial terminals
# The 'dialup' keyword identifies dialin lines to login, fingerd etc.
diff --git a/etc/etc.i386/ttys b/etc/etc.i386/ttys
index 15eb30d..b839278 100644
--- a/etc/etc.i386/ttys
+++ b/etc/etc.i386/ttys
@@ -29,15 +29,15 @@
# when going to single-user mode.
console none unknown off secure
#
-ttyv0 "/usr/libexec/getty Pc" xterm on secure
+ttyv0 "/usr/libexec/getty Pc" xterm onifexists secure
# Virtual terminals
-ttyv1 "/usr/libexec/getty Pc" xterm on secure
-ttyv2 "/usr/libexec/getty Pc" xterm on secure
-ttyv3 "/usr/libexec/getty Pc" xterm on secure
-ttyv4 "/usr/libexec/getty Pc" xterm on secure
-ttyv5 "/usr/libexec/getty Pc" xterm on secure
-ttyv6 "/usr/libexec/getty Pc" xterm on secure
-ttyv7 "/usr/libexec/getty Pc" xterm on secure
+ttyv1 "/usr/libexec/getty Pc" xterm onifexists secure
+ttyv2 "/usr/libexec/getty Pc" xterm onifexists secure
+ttyv3 "/usr/libexec/getty Pc" xterm onifexists secure
+ttyv4 "/usr/libexec/getty Pc" xterm onifexists secure
+ttyv5 "/usr/libexec/getty Pc" xterm onifexists secure
+ttyv6 "/usr/libexec/getty Pc" xterm onifexists secure
+ttyv7 "/usr/libexec/getty Pc" xterm onifexists secure
ttyv8 "/usr/local/bin/xdm -nodaemon" xterm off secure
# Serial terminals
# The 'dialup' keyword identifies dialin lines to login, fingerd etc.
diff --git a/etc/etc.powerpc/ttys b/etc/etc.powerpc/ttys
index 606e963..b0722e4 100644
--- a/etc/etc.powerpc/ttys
+++ b/etc/etc.powerpc/ttys
@@ -29,15 +29,15 @@
# when going to single-user mode.
console none unknown off secure
#
-ttyv0 "/usr/libexec/getty Pc" xterm on secure
+ttyv0 "/usr/libexec/getty Pc" xterm onifexists secure
# Virtual terminals
-ttyv1 "/usr/libexec/getty Pc" xterm on secure
-ttyv2 "/usr/libexec/getty Pc" xterm on secure
-ttyv3 "/usr/libexec/getty Pc" xterm on secure
-ttyv4 "/usr/libexec/getty Pc" xterm on secure
-ttyv5 "/usr/libexec/getty Pc" xterm on secure
-ttyv6 "/usr/libexec/getty Pc" xterm on secure
-ttyv7 "/usr/libexec/getty Pc" xterm on secure
+ttyv1 "/usr/libexec/getty Pc" xterm onifexists secure
+ttyv2 "/usr/libexec/getty Pc" xterm onifexists secure
+ttyv3 "/usr/libexec/getty Pc" xterm onifexists secure
+ttyv4 "/usr/libexec/getty Pc" xterm onifexists secure
+ttyv5 "/usr/libexec/getty Pc" xterm onifexists secure
+ttyv6 "/usr/libexec/getty Pc" xterm onifexists secure
+ttyv7 "/usr/libexec/getty Pc" xterm onifexists secure
#ttyv8 "/usr/local/bin/xdm -nodaemon" xterm off secure
# Serial terminals
# The 'dialup' keyword identifies dialin lines to login, fingerd etc.
diff --git a/etc/etc.riscv/ttys b/etc/etc.riscv/ttys
index ede1d79..f2c9122 100644
--- a/etc/etc.riscv/ttys
+++ b/etc/etc.riscv/ttys
@@ -29,16 +29,16 @@
# when going to single-user mode.
console none unknown off secure
#
-ttyv0 "/usr/libexec/getty Pc" xterm onifconsole secure
+ttyv0 "/usr/libexec/getty Pc" xterm onifexists secure
# Virtual terminals
-ttyv1 "/usr/libexec/getty Pc" xterm off secure
-ttyv2 "/usr/libexec/getty Pc" xterm off secure
-ttyv3 "/usr/libexec/getty Pc" xterm off secure
-ttyv4 "/usr/libexec/getty Pc" xterm off secure
-ttyv5 "/usr/libexec/getty Pc" xterm off secure
-ttyv6 "/usr/libexec/getty Pc" xterm off secure
-ttyv7 "/usr/libexec/getty Pc" xterm off secure
-#ttyv8 "/usr/local/bin/xdm -nodaemon" xterm off secure
+ttyv1 "/usr/libexec/getty Pc" xterm onifexists secure
+ttyv2 "/usr/libexec/getty Pc" xterm onifexists secure
+ttyv3 "/usr/libexec/getty Pc" xterm onifexists secure
+ttyv4 "/usr/libexec/getty Pc" xterm onifexists secure
+ttyv5 "/usr/libexec/getty Pc" xterm onifexists secure
+ttyv6 "/usr/libexec/getty Pc" xterm onifexists secure
+ttyv7 "/usr/libexec/getty Pc" xterm onifexists secure
+#ttyv8 "/usr/local/bin/xdm -nodaemon" xterm onifexists secure
# Serial terminals
# The 'dialup' keyword identifies dialin lines to login, fingerd etc.
ttyu0 "/usr/libexec/getty 3wire" vt100 onifconsole secure
diff --git a/etc/etc.sparc64/ttys b/etc/etc.sparc64/ttys
index afca321..5c7f3cf 100644
--- a/etc/etc.sparc64/ttys
+++ b/etc/etc.sparc64/ttys
@@ -33,15 +33,15 @@ screen "/usr/libexec/getty Pc" vt100 off secure
ttya "/usr/libexec/getty 3wire.9600" vt100 off secure
ttyb "/usr/libexec/getty 3wire.9600" vt100 off secure
# syscons(4)
-ttyv0 "/usr/libexec/getty Pc" xterm on secure
+ttyv0 "/usr/libexec/getty Pc" xterm onifexists secure
# Virtual terminals
-ttyv1 "/usr/libexec/getty Pc" xterm on secure
-ttyv2 "/usr/libexec/getty Pc" xterm on secure
-ttyv3 "/usr/libexec/getty Pc" xterm on secure
-ttyv4 "/usr/libexec/getty Pc" xterm on secure
-ttyv5 "/usr/libexec/getty Pc" xterm on secure
-ttyv6 "/usr/libexec/getty Pc" xterm on secure
-ttyv7 "/usr/libexec/getty Pc" xterm on secure
+ttyv1 "/usr/libexec/getty Pc" xterm onifexists secure
+ttyv2 "/usr/libexec/getty Pc" xterm onifexists secure
+ttyv3 "/usr/libexec/getty Pc" xterm onifexists secure
+ttyv4 "/usr/libexec/getty Pc" xterm onifexists secure
+ttyv5 "/usr/libexec/getty Pc" xterm onifexists secure
+ttyv6 "/usr/libexec/getty Pc" xterm onifexists secure
+ttyv7 "/usr/libexec/getty Pc" xterm onifexists secure
ttyv8 "/usr/local/bin/xdm -nodaemon" xterm off secure
# Serial terminals
# The 'dialup' keyword identifies dialin lines to login, fingerd etc.
diff --git a/include/ttyent.h b/include/ttyent.h
index f2220ad..928da81 100644
--- a/include/ttyent.h
+++ b/include/ttyent.h
@@ -38,6 +38,7 @@
#define _TTYS_OFF "off"
#define _TTYS_ON "on"
#define _TTYS_ONIFCONSOLE "onifconsole"
+#define _TTYS_ONIFEXISTS "onifexists"
#define _TTYS_SECURE "secure"
#define _TTYS_INSECURE "insecure"
#define _TTYS_WINDOW "window"
@@ -54,6 +55,8 @@ struct ttyent {
#define TTY_SECURE 0x02 /* allow uid of 0 to login */
#define TTY_DIALUP 0x04 /* is a dialup tty */
#define TTY_NETWORK 0x08 /* is a network tty */
+#define TTY_IFEXISTS 0x10 /* configured as "onifexists" */
+#define TTY_IFCONSOLE 0x20 /* configured as "onifconsole" */
int ty_status; /* status flags */
char *ty_window; /* command to start up window manager */
char *ty_comment; /* comment field */
diff --git a/lib/libc/gen/getttyent.3 b/lib/libc/gen/getttyent.3
index 18c3f07..43b2ace 100644
--- a/lib/libc/gen/getttyent.3
+++ b/lib/libc/gen/getttyent.3
@@ -75,6 +75,8 @@ struct ttyent {
#define TTY_SECURE 0x02 /* allow uid of 0 to login */
#define TTY_DIALUP 0x04 /* is a dialup tty */
#define TTY_NETWORK 0x08 /* is a network tty */
+#define TTY_IFEXISTS 0x10 /* configured as "onifexists" */
+#define TTY_IFCONSOLE 0x20 /* configured as "onifconsole" */
int ty_status; /* status flags */
char *ty_window; /* command to start up window manager */
char *ty_comment; /* comment field */
@@ -115,6 +117,10 @@ Identifies a tty used for network connections.
If this flag is set, then
.Fn isnettty
will return a non-zero value.
+.It Dv TTY_IFEXISTS
+Identifies a tty that does not neccessarily exist.
+.It Dv TTY_IFCONSOLE
+Identifies a tty that might be a system console.
.El
.It Fa ty_window
The command to execute for a window system associated with the line.
diff --git a/lib/libc/gen/getttyent.c b/lib/libc/gen/getttyent.c
index 266f631..e0b2698 100644
--- a/lib/libc/gen/getttyent.c
+++ b/lib/libc/gen/getttyent.c
@@ -34,6 +34,7 @@ static char sccsid[] = "@(#)getttyent.c 8.1 (Berkeley) 6/4/93";
__FBSDID("$FreeBSD$");
#include <sys/types.h>
+#include <sys/stat.h>
#include <sys/sysctl.h>
#include <ctype.h>
@@ -72,11 +73,14 @@ auto_tty_status(const char *ty_name)
{
size_t len;
char *buf, *cons, *nextcons;
+ int rv;
+
+ rv = TTY_IFCONSOLE;
/* Check if this is an enabled kernel console line */
buf = NULL;
if (sysctlbyname("kern.console", NULL, &len, NULL, 0) == -1)
- return (0); /* Errors mean don't enable */
+ return (rv); /* Errors mean don't enable */
buf = malloc(len);
if (sysctlbyname("kern.console", buf, &len, NULL, 0) == -1)
goto done;
@@ -87,14 +91,32 @@ auto_tty_status(const char *ty_name)
nextcons = buf;
while ((cons = strsep(&nextcons, ",")) != NULL && strlen(cons) != 0) {
if (strcmp(cons, ty_name) == 0) {
- free(buf);
- return (TTY_ON);
+ rv |= TTY_ON;
+ break;
}
}
done:
free(buf);
- return (0);
+ return (rv);
+}
+
+static int
+auto_exists_status(const char *ty_name)
+{
+ struct stat sb;
+ char *dev;
+ int rv;
+
+ rv = TTY_IFEXISTS;
+ if (*ty_name == '/')
+ asprintf(&dev, "%s", ty_name);
+ else
+ asprintf(&dev, "/dev/%s", ty_name);
+ if (dev != NULL && stat(dev, &sb) == 0)
+ rv |= TTY_ON;
+ free(dev);
+ return (rv);
}
struct ttyent *
@@ -161,6 +183,8 @@ getttyent(void)
tty.ty_status |= TTY_ON;
else if (scmp(_TTYS_ONIFCONSOLE))
tty.ty_status |= auto_tty_status(tty.ty_name);
+ else if (scmp(_TTYS_ONIFEXISTS))
+ tty.ty_status |= auto_exists_status(tty.ty_name);
else if (scmp(_TTYS_SECURE))
tty.ty_status |= TTY_SECURE;
else if (scmp(_TTYS_INSECURE))
diff --git a/libexec/getty/ttys.5 b/libexec/getty/ttys.5
index d4c7f1d..1150909 100644
--- a/libexec/getty/ttys.5
+++ b/libexec/getty/ttys.5
@@ -28,7 +28,7 @@
.\" from: @(#)ttys.5 8.1 (Berkeley) 6/4/93
.\" $FreeBSD$
.\" "
-.Dd March 9, 2014
+.Dd March 16, 2017
.Dt TTYS 5
.Os
.Sh NAME
@@ -105,6 +105,12 @@ should (should not) execute the command given in the second field.
``onifconsole'' will cause this line to be enabled if and only if it is
an active kernel console device (it is equivalent to ``on'' in this
case).
+The flag ``onifexists'' will cause this line to be enabled if and only
+if the name exists.
+If the name starts with a ``/'', it will be considered an absolute
+path.
+Otherwise, it is considered a path relative to
+.Pa /dev .
The flag ``secure'' (if the console is enabled) allows users with a
uid of 0 to login on
this line.
diff --git a/release/arm/BEAGLEBONE.conf b/release/arm/BEAGLEBONE.conf
index 2eb1dd3..d4a25fb 100644
--- a/release/arm/BEAGLEBONE.conf
+++ b/release/arm/BEAGLEBONE.conf
@@ -8,7 +8,7 @@ EMBEDDED_TARGET="arm"
EMBEDDEDBUILD=1
EMBEDDEDPORTS="sysutils/u-boot-beaglebone"
FAT_SIZE="41m"
-FAT_TYPE="12"
+FAT_TYPE="16"
IMAGE_SIZE="1G"
KERNEL="BEAGLEBONE"
MD_ARGS="-x 63 -y 255"
diff --git a/release/arm/GUMSTIX.conf b/release/arm/GUMSTIX.conf
index c1d21bb..7928da9 100644
--- a/release/arm/GUMSTIX.conf
+++ b/release/arm/GUMSTIX.conf
@@ -8,7 +8,7 @@ EMBEDDED_TARGET="arm"
EMBEDDEDBUILD=1
EMBEDDEDPORTS="sysutils/u-boot-duovero"
FAT_SIZE="41m"
-FAT_TYPE="12"
+FAT_TYPE="16"
IMAGE_SIZE="1G"
KERNEL="GUMSTIX"
MD_ARGS="-x 63 -y 255"
diff --git a/release/arm/PANDABOARD.conf b/release/arm/PANDABOARD.conf
index 096f7b0..db7f016 100644
--- a/release/arm/PANDABOARD.conf
+++ b/release/arm/PANDABOARD.conf
@@ -8,7 +8,7 @@ EMBEDDED_TARGET="arm"
EMBEDDEDBUILD=1
EMBEDDEDPORTS="sysutils/u-boot-pandaboard"
FAT_SIZE="41m"
-FAT_TYPE="12"
+FAT_TYPE="16"
IMAGE_SIZE="1G"
KERNEL="PANDABOARD"
MD_ARGS="-x 63 -y 255"
diff --git a/release/doc/en_US.ISO8859-1/hardware/article.xml b/release/doc/en_US.ISO8859-1/hardware/article.xml
index 780e7a8..88abca4 100644
--- a/release/doc/en_US.ISO8859-1/hardware/article.xml
+++ b/release/doc/en_US.ISO8859-1/hardware/article.xml
@@ -37,6 +37,7 @@
<year>2015</year>
<year>2016</year>
<year>2017</year>
+ <year>2018</year>
<holder role="mailto:doc@FreeBSD.org">The &os; Documentation
Project</holder>
</copyright>
diff --git a/release/doc/en_US.ISO8859-1/installation/article.xml b/release/doc/en_US.ISO8859-1/installation/article.xml
index e9bb888..23bc521 100644
--- a/release/doc/en_US.ISO8859-1/installation/article.xml
+++ b/release/doc/en_US.ISO8859-1/installation/article.xml
@@ -22,7 +22,7 @@
<pubdate>$FreeBSD$</pubdate>
<copyright>
- <year>2017</year>
+ <year>2018</year>
<holder role="mailto:doc@FreeBSD.org">The &os; Documentation
Project</holder>
</copyright>
diff --git a/release/doc/en_US.ISO8859-1/readme/article.xml b/release/doc/en_US.ISO8859-1/readme/article.xml
index f98b801..63f08f0 100644
--- a/release/doc/en_US.ISO8859-1/readme/article.xml
+++ b/release/doc/en_US.ISO8859-1/readme/article.xml
@@ -41,6 +41,7 @@
<year>2015</year>
<year>2016</year>
<year>2017</year>
+ <year>2018</year>
<holder role="mailto:doc@FreeBSD.org">The &os; Documentation
Project</holder>
</copyright>
diff --git a/release/doc/en_US.ISO8859-1/relnotes/article.xml b/release/doc/en_US.ISO8859-1/relnotes/article.xml
index 051a900..f20f6ee 100644
--- a/release/doc/en_US.ISO8859-1/relnotes/article.xml
+++ b/release/doc/en_US.ISO8859-1/relnotes/article.xml
@@ -25,7 +25,7 @@
<!-- Last rev: 288943 -->
<copyright>
- <year>2017</year>
+ <year>2018</year>
<holder role="mailto:doc@FreeBSD.org">The &os; Documentation
Project</holder>
</copyright>
@@ -195,6 +195,19 @@
been updated to include device model when the
<literal>-s</literal> flag is used.</para>
+ <para revision="322509">The &man.top.1; utility has been updated
+ to allow filtering on multiple user names when the
+ <literal>-U</literal> flag is used.</para>
+
+ <para revision="322525">The &man.bsdgrep.1; utility has been
+ updated to include a <literal>rgrep</literal> hard link to
+ &man.grep.1;, which when used is equivalent to
+ <literal>grep&nbsp;-r</literal>.</para>
+
+ <para revision="322555">The &man.bsdgrep.1; utility has been
+ updated to address various issues with pattern matching
+ behavior.</para>
+
<para revision="322910">The &man.umount.8; utility has been
updated to include a new flag, <literal>-N</literal>, which
is used to forcefully unmount an <acronym>NFS</acronym>
@@ -205,6 +218,13 @@
to the <literal>-G</literal> flag when using the
<literal>usermod</literal> subcommand.</para>
+ <para revision="324124" contrib="sponsor"
+ sponsor="&chelsio;">The &man.getconf.1; utility has been
+ updated to include a new flag, <literal>-a</literal>, which
+ prints the name and value of all system or path configuration
+ values to &man.stdout.4; or optionally a file as an argument
+ to <literal>-a</literal>.</para>
+
<para revision="324270">The &man.ps.1; utility has been updated
to reflect realtime and idle priorities in state flags.</para>
@@ -249,6 +269,11 @@
<para revision="327592">The &man.mdmfs.8; utility has been
updated to support &man.tmpfs.5;.</para>
+ <para revision="327837">The &man.lint.1; utility is not longer
+ built by default. The <literal>WITH_LINT</literal>
+ &man.src.conf.5; option has been added to enable building and
+ installing the utility.</para>
+
<para revision="327871">The &man.cpucontrol.8; utility has been
updated to include a new flag, <literal>-e</literal>, which is
used to re-evaluate reported <acronym>CPU</acronym> features
@@ -262,6 +287,15 @@
identical across the system.</para>
</note>
+ <para revision="328138">The &man.indent.1; utility has been
+ updated to respect the <literal>SIMPLE_BACKUP_SUFFIX</literal>
+ environment variable if set.</para>
+
+ <para revision="328139">The &man.du.1; utility has been updated
+ to include the <literal>--si</literal> long option, which is
+ used to display output in &quot;human-readable&quot; output in
+ powers of 1000.</para>
+
<para revision="328140">The &man.df.1; utility has been updated
to include the <literal>--si</literal> long option, which is
an alias to <literal>-H</literal>.</para>
@@ -329,6 +363,27 @@
sponsor="&netflix;">The &man.efibootmgr.8; utility has been
added, which is used to manipulate the <acronym>EFI</acronym>
boot manager.</para>
+
+ <para revision="332947">The &man.etdump.1; utility has been
+ added, which is used to view El Torito boot catalog
+ information.</para>
+
+ <para revision="322753">The &man.mount.8; utility has been
+ updated to allow fallback to mount media read-only if an
+ attempt to mount write-protected media read-write fails. This
+ behavior is disabled by default, and can be requested with the
+ new <literal>autoro</literal> option.</para>
+
+ <para revision="332460" contrib="sponsor" sponsor="&ff;">The
+ &man.makefs.8; utility has been updated to default the block
+ and fragment sizes to match that of &man.newfs.8;, 32K and 4K,
+ respectively.</para>
+
+ <para revision="332929" contrib="sponsor" sponsor="&ff;">The
+ &man.pwd.mkdb.8; utility has been updated to emit a notice
+ that legacy database support will be removed effective
+ &os;&nbsp;12 when the <literal>-l</literal> flag is
+ used.</para>
</sect2>
<sect2 xml:id="userland-contrib">
@@ -343,6 +398,9 @@
<para revision="322442"><application>Subversion</application>
has been updated to version 1.9.7.</para>
+ <para revision="328495">The &man.dtc.1; utility has been updated
+ to upstream commit 9ce35ff8.</para>
+
<para revision="328874">The &man.file.1; utility has been
updated to version 5.32.</para>
@@ -364,12 +422,15 @@
<para revision="331246">The <application>bmake</application>
utility has been updated to upstream version 20180222.</para>
+ <para revision="331465">The <acronym>BSD</acronym>-licensed
+ &man.diff.1; utility has been imported from OpenBSD, which is
+ installed if <literal>WITHOUT_GNU_DIFF</literal> is set in
+ &man.src.conf.5;, and otherwise not installed by
+ default.</para>
+
<para revision="331638"><application>OpenSSL</application> has
been updated to version 1.0.2o.</para>
- <para revision="331662">Timezone data files have been updated to
- version 2018d.</para>
-
<para revision="331838">The <application>clang</application>,
<application>llvm</application>,
<application>lld</application>,
@@ -377,6 +438,9 @@
<literal>compiler-rt</literal> utilities as well as
<literal>libc++</literal> have been updated to upstream
version 6.0.0.</para>
+
+ <para revision="333312">Timezone data files have been updated to
+ version 2018e.</para>
</sect2>
<sect2 xml:id="userland-installer">
@@ -506,6 +570,24 @@
<para revision="331500">Support for the TAIO
<acronym>USB</acronym> multi-protocol adapter
(<acronym>TUMPA</acronym>) has been added.</para>
+
+ <para revision="331882" contrib="sponsor"
+ sponsor="&darpa_afrl;">The &man.cm.4; and &man.fpa.4; drivers
+ have been marked as deprecated, and will be removed in
+ &os;&nbsp;12.</para>
+
+ <para revision="333171">The &man.ixgb.4; driver has been marked
+ as deprecated, and will be removed in &os;&nbsp;12.</para>
+
+ <para revision="333367">The &man.nxge.4; driver has been marked
+ as deprecated, and will be removed in &os;&nbsp;12.</para>
+
+ <para revision="333412" contrib="sponsor" sponsor="&ff;">The
+ &man.lmc.4; driver has been marked as deprecated, and will be
+ removed in &os;&nbsp;12.</para>
+
+ <para revision="333738">The &man.vxge.4; driver has been marked
+ as deprecated, and will be removed in &os;&nbsp;12.</para>
</sect2>
<sect2 xml:id="hardware-virtualization">
@@ -549,7 +631,13 @@
<sect2 xml:id="storage-geom">
<title><literal>geom(4)</literal></title>
- <para>&nbsp;</para>
+ <para revision="332519">The <literal>geom_aes</literal>,
+ <literal>geom_bsd</literal>, <literal>geom_mbr</literal>,
+ <literal>geom_sunlabel</literal> &man.geom.4; classes have
+ been marked as deprecated. They have been replaced by the
+ <literal>geom_part</literal> class in &os;&nbsp;7, and removed
+ from the <literal>GENERIC</literal> kernel configurations in
+ &os;&nbsp;8, and will be removed in &os;&nbsp;12.</para>
</sect2>
</sect1>
@@ -646,6 +734,20 @@
keep their clocks synchronized using the Amazon Time Sync
Service, the <acronym>NTP</acronym> service internal to the
EC2&trade; infrastructure.</para>
+
+ <para revision="333410" contrib="sponsor" sponsor="&ff;">The
+ &arch.i386; memory stick image installer have been changed
+ to use the <acronym>MBR</acronym> partitioning scheme, which
+ addresses a boot issue from a <acronym>GPT</acronym> partition
+ scheme in non-<acronym>UEFI</acronym> mode.</para>
+
+ <para revision="333006" contrib="sponsor" sponsor="&ix;">The
+ &os; installation <acronym>ISO</acronym> medium creation tools
+ have been updated to generate hybrid images for &arch.amd64;,
+ supporting both <acronym>BIOS</acronym> and
+ <acronym>EFI</acronym>. The <acronym>ISO</acronym> image can
+ now be written to a memory stick as well as being used as
+ a <acronym>CD</acronym> image.</para>
</sect2>
</sect1>
</article>
diff --git a/sbin/init/init.c b/sbin/init/init.c
index f4206c4..12cf9a7 100644
--- a/sbin/init/init.c
+++ b/sbin/init/init.c
@@ -154,6 +154,8 @@ typedef struct init_session {
int se_flags; /* status of session */
#define SE_SHUTDOWN 0x1 /* session won't be restarted */
#define SE_PRESENT 0x2 /* session is in /etc/ttys */
+#define SE_IFEXISTS 0x4 /* session defined as "onifexists" */
+#define SE_IFCONSOLE 0x8 /* session defined as "onifconsole" */
int se_nspace; /* spacing count */
char *se_device; /* filename of port */
char *se_getty; /* what to run on that port */
@@ -1260,7 +1262,6 @@ static session_t *
new_session(session_t *sprev, struct ttyent *typ)
{
session_t *sp;
- int fd;
if ((typ->ty_status & TTY_ON) == 0 ||
typ->ty_name == 0 ||
@@ -1271,21 +1272,15 @@ new_session(session_t *sprev, struct ttyent *typ)
sp->se_flags |= SE_PRESENT;
+ if ((typ->ty_status & TTY_IFEXISTS) != 0)
+ sp->se_flags |= SE_IFEXISTS;
+
+ if ((typ->ty_status & TTY_IFCONSOLE) != 0)
+ sp->se_flags |= SE_IFCONSOLE;
+
if (asprintf(&sp->se_device, "%s%s", _PATH_DEV, typ->ty_name) < 0)
err(1, "asprintf");
- /*
- * Attempt to open the device, if we get "device not configured"
- * then don't add the device to the session list.
- */
- if ((fd = open(sp->se_device, O_RDONLY | O_NONBLOCK, 0)) < 0) {
- if (errno == ENXIO) {
- free_session(sp);
- return (0);
- }
- } else
- close(fd);
-
if (setupargv(sp, typ) == 0) {
free_session(sp);
return (0);
@@ -1505,6 +1500,30 @@ start_getty(session_t *sp)
}
/*
+ * Return 1 if the session is defined as "onifexists"
+ * or "onifconsole" and the device node does not exist.
+ */
+static int
+session_has_no_tty(session_t *sp)
+{
+ int fd;
+
+ if ((sp->se_flags & SE_IFEXISTS) == 0 &&
+ (sp->se_flags & SE_IFCONSOLE) == 0)
+ return (0);
+
+ fd = open(sp->se_device, O_RDONLY | O_NONBLOCK, 0);
+ if (fd < 0) {
+ if (errno == ENOENT)
+ return (1);
+ return (0);
+ }
+
+ close(fd);
+ return (0);
+}
+
+/*
* Collect exit status for a child.
* If an exiting login, start a new login running.
*/
@@ -1522,7 +1541,8 @@ collect_child(pid_t pid)
del_session(sp);
sp->se_process = 0;
- if (sp->se_flags & SE_SHUTDOWN) {
+ if (sp->se_flags & SE_SHUTDOWN ||
+ session_has_no_tty(sp)) {
if ((sprev = sp->se_prev) != NULL)
sprev->se_next = sp->se_next;
else
@@ -1608,6 +1628,8 @@ multi_user(void)
for (sp = sessions; sp; sp = sp->se_next) {
if (sp->se_process)
continue;
+ if (session_has_no_tty(sp))
+ continue;
if ((pid = start_getty(sp)) == -1) {
/* serious trouble */
requested_transition = clean_ttys;
diff --git a/sbin/ipfw/ipfw2.c b/sbin/ipfw/ipfw2.c
index 4f4a925..0c51845 100644
--- a/sbin/ipfw/ipfw2.c
+++ b/sbin/ipfw/ipfw2.c
@@ -1724,7 +1724,7 @@ print_instruction(struct buf_pr *bp, const struct format_opts *fo,
static ipfw_insn *
print_opcode(struct buf_pr *bp, struct format_opts *fo,
- struct show_state *state, uint8_t opcode)
+ struct show_state *state, int opcode)
{
ipfw_insn *cmd;
int l;
@@ -1732,7 +1732,7 @@ print_opcode(struct buf_pr *bp, struct format_opts *fo,
for (l = state->rule->act_ofs, cmd = state->rule->cmd;
l > 0; l -= F_LEN(cmd), cmd += F_LEN(cmd)) {
/* We use zero opcode to print the rest of options */
- if (opcode != 0 && cmd->opcode != opcode)
+ if (opcode >= 0 && cmd->opcode != opcode)
continue;
/*
* Skip O_NOP, when we printing the rest
@@ -2208,7 +2208,7 @@ show_static_rule(struct cmdline_opts *co, struct format_opts *fo,
O_IP_DSTPORT, HAVE_DSTIP);
/* Print the rest of options */
- while (print_opcode(bp, fo, &state, 0))
+ while (print_opcode(bp, fo, &state, -1))
;
end:
/* Print comment at the end */
diff --git a/share/man/man4/vxge.4 b/share/man/man4/vxge.4
index b21c350..f875fc8 100644
--- a/share/man/man4/vxge.4
+++ b/share/man/man4/vxge.4
@@ -44,6 +44,12 @@ module at boot time, place the following line in
.Bd -literal -offset indent
if_vxge_load="YES"
.Ed
+.Sh DEPRECATION NOTICE
+The
+.Nm
+driver is not present in
+.Fx 12.0
+and later.
.Sh DESCRIPTION
The
.Nm
diff --git a/stand/arm64/Makefile b/stand/arm64/Makefile
index 3ecb582..d4c9667 100644
--- a/stand/arm64/Makefile
+++ b/stand/arm64/Makefile
@@ -1,3 +1,5 @@
# $FreeBSD$
+NO_OBJ=t
+
.include <bsd.subdir.mk>
diff --git a/sys/amd64/amd64/elf_machdep.c b/sys/amd64/amd64/elf_machdep.c
index f82c084..66aa3bd 100644
--- a/sys/amd64/amd64/elf_machdep.c
+++ b/sys/amd64/amd64/elf_machdep.c
@@ -173,10 +173,13 @@ elf64_dump_thread(struct thread *td, void *dst, size_t *off)
*off = len;
}
+#define ERI_LOCAL 0x0001
+#define ERI_ONLYIFUNC 0x0002
+
/* Process one elf relocation with addend. */
static int
elf_reloc_internal(linker_file_t lf, Elf_Addr relocbase, const void *data,
- int type, int local, elf_lookup_fn lookup)
+ int type, elf_lookup_fn lookup, int flags)
{
Elf64_Addr *where, val;
Elf32_Addr *where32, val32;
@@ -215,6 +218,9 @@ elf_reloc_internal(linker_file_t lf, Elf_Addr relocbase, const void *data,
panic("unknown reloc type %d\n", type);
}
+ if (((flags & ERI_ONLYIFUNC) == 0) ^ (rtype != R_X86_64_IRELATIVE))
+ return (0);
+
switch (rtype) {
case R_X86_64_NONE: /* none */
break;
@@ -273,6 +279,13 @@ elf_reloc_internal(linker_file_t lf, Elf_Addr relocbase, const void *data,
*where = val;
break;
+ case R_X86_64_IRELATIVE:
+ addr = relocbase + addend;
+ val = ((Elf64_Addr (*)(void))addr)();
+ if (*where != val)
+ *where = val;
+ break;
+
default:
printf("kldload: unexpected relocation type %ld\n",
rtype);
@@ -282,11 +295,20 @@ elf_reloc_internal(linker_file_t lf, Elf_Addr relocbase, const void *data,
}
int
+elf_reloc_ifunc(linker_file_t lf, Elf_Addr relocbase, const void *data,
+ int type, elf_lookup_fn lookup)
+{
+
+ return (elf_reloc_internal(lf, relocbase, data, type, lookup,
+ ERI_ONLYIFUNC));
+}
+
+int
elf_reloc(linker_file_t lf, Elf_Addr relocbase, const void *data, int type,
elf_lookup_fn lookup)
{
- return (elf_reloc_internal(lf, relocbase, data, type, 0, lookup));
+ return (elf_reloc_internal(lf, relocbase, data, type, lookup, 0));
}
int
@@ -294,7 +316,8 @@ elf_reloc_local(linker_file_t lf, Elf_Addr relocbase, const void *data,
int type, elf_lookup_fn lookup)
{
- return (elf_reloc_internal(lf, relocbase, data, type, 1, lookup));
+ return (elf_reloc_internal(lf, relocbase, data, type, lookup,
+ ERI_LOCAL));
}
int
diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c
index 4972173..07373c0 100644
--- a/sys/amd64/amd64/machdep.c
+++ b/sys/amd64/amd64/machdep.c
@@ -1564,16 +1564,23 @@ hammer_time(u_int64_t modulep, u_int64_t physfree)
size_t kstack0_sz;
int late_console;
- /*
- * This may be done better later if it gets more high level
- * components in it. If so just link td->td_proc here.
- */
- proc_linkup0(&proc0, &thread0);
-
kmdp = init_ops.parse_preload_data(modulep);
identify_cpu1();
identify_hypervisor();
+ /*
+ * hw.cpu_stdext_disable is ignored by the call, it will be
+ * re-evaluted by the below call to finishidentcpu().
+ */
+ identify_cpu2();
+
+ link_elf_ireloc(kmdp);
+
+ /*
+ * This may be done better later if it gets more high level
+ * components in it. If so just link td->td_proc here.
+ */
+ proc_linkup0(&proc0, &thread0);
/* Init basic tunables, hz etc */
init_param1();
diff --git a/sys/arm/include/atomic-v4.h b/sys/arm/include/atomic-v4.h
index 71587f4..cc7780f 100644
--- a/sys/arm/include/atomic-v4.h
+++ b/sys/arm/include/atomic-v4.h
@@ -115,7 +115,7 @@ atomic_clear_64(volatile uint64_t *address, uint64_t clearmask)
static __inline int
atomic_fcmpset_32(volatile u_int32_t *p, volatile u_int32_t *cmpval, volatile u_int32_t newval)
{
- u_int32_t ret;
+ int ret;
__with_interrupts_disabled(
{
@@ -134,7 +134,7 @@ atomic_fcmpset_32(volatile u_int32_t *p, volatile u_int32_t *cmpval, volatile u_
static __inline int
atomic_fcmpset_64(volatile u_int64_t *p, volatile u_int64_t *cmpval, volatile u_int64_t newval)
{
- u_int64_t ret;
+ int ret;
__with_interrupts_disabled(
{
@@ -149,7 +149,7 @@ atomic_fcmpset_64(volatile u_int64_t *p, volatile u_int64_t *cmpval, volatile u_
return (ret);
}
-static __inline u_int32_t
+static __inline int
atomic_cmpset_32(volatile u_int32_t *p, volatile u_int32_t cmpval, volatile u_int32_t newval)
{
int ret;
@@ -166,7 +166,7 @@ atomic_cmpset_32(volatile u_int32_t *p, volatile u_int32_t cmpval, volatile u_in
return (ret);
}
-static __inline u_int64_t
+static __inline int
atomic_cmpset_64(volatile u_int64_t *p, volatile u_int64_t cmpval, volatile u_int64_t newval)
{
int ret;
@@ -296,7 +296,7 @@ atomic_clear_32(volatile uint32_t *address, uint32_t clearmask)
}
-static __inline u_int32_t
+static __inline int
atomic_cmpset_32(volatile u_int32_t *p, volatile u_int32_t cmpval, volatile u_int32_t newval)
{
int done, ras_start = ARM_RAS_START;
@@ -321,6 +321,33 @@ atomic_cmpset_32(volatile u_int32_t *p, volatile u_int32_t cmpval, volatile u_in
return (done);
}
+static __inline int
+atomic_fcmpset_32(volatile u_int32_t *p, volatile u_int32_t *cmpval, volatile u_int32_t newval)
+{
+ int done, oldval, ras_start = ARM_RAS_START;
+
+ __asm __volatile("1:\n"
+ "adr %1, 1b\n"
+ "str %1, [%0]\n"
+ "adr %1, 2f\n"
+ "str %1, [%0, #4]\n"
+ "ldr %1, [%2]\n"
+ "ldr %5, [%3]\n"
+ "cmp %1, %5\n"
+ "streq %4, [%2]\n"
+ "2:\n"
+ "mov %5, #0\n"
+ "str %5, [%0]\n"
+ "mov %5, #0xffffffff\n"
+ "str %5, [%0, #4]\n"
+ "strne %1, [%3]\n"
+ "moveq %1, #1\n"
+ "movne %1, #0\n"
+ : "+r" (ras_start), "=r" (done) ,"+r" (p)
+ , "+r" (cmpval), "+r" (newval), "+r" (oldval) : : "cc", "memory");
+ return (done);
+}
+
static __inline uint32_t
atomic_fetchadd_32(volatile uint32_t *p, uint32_t v)
{
@@ -409,14 +436,18 @@ atomic_swap_32(volatile u_int32_t *p, u_int32_t v)
#define atomic_fcmpset_rel_32 atomic_fcmpset_32
#define atomic_fcmpset_acq_32 atomic_fcmpset_32
+#ifdef _KERNEL
#define atomic_fcmpset_rel_64 atomic_fcmpset_64
#define atomic_fcmpset_acq_64 atomic_fcmpset_64
+#endif
#define atomic_fcmpset_acq_long atomic_fcmpset_long
#define atomic_fcmpset_rel_long atomic_fcmpset_long
#define atomic_cmpset_rel_32 atomic_cmpset_32
#define atomic_cmpset_acq_32 atomic_cmpset_32
+#ifdef _KERNEL
#define atomic_cmpset_rel_64 atomic_cmpset_64
#define atomic_cmpset_acq_64 atomic_cmpset_64
+#endif
#define atomic_set_rel_32 atomic_set_32
#define atomic_set_acq_32 atomic_set_32
#define atomic_clear_rel_32 atomic_clear_32
@@ -463,8 +494,6 @@ atomic_cmpset_long(volatile u_long *dst, u_long old, u_long newe)
return (atomic_cmpset_32((volatile uint32_t *)dst, old, newe));
}
-#ifdef _KERNEL
-/* atomic_fcmpset_32 is only defined for the kernel */
static __inline u_long
atomic_fcmpset_long(volatile u_long *dst, u_long *old, u_long newe)
{
@@ -472,7 +501,6 @@ atomic_fcmpset_long(volatile u_long *dst, u_long *old, u_long newe)
return (atomic_fcmpset_32((volatile uint32_t *)dst,
(uint32_t *)old, newe));
}
-#endif
static __inline u_long
atomic_fetchadd_long(volatile u_long *p, u_long v)
diff --git a/sys/arm/include/atomic-v6.h b/sys/arm/include/atomic-v6.h
index 2a579db..b0cb408 100644
--- a/sys/arm/include/atomic-v6.h
+++ b/sys/arm/include/atomic-v6.h
@@ -209,7 +209,7 @@ atomic_fcmpset_32(volatile uint32_t *p, uint32_t *cmpval, uint32_t newval)
return (!ret);
}
-static __inline uint64_t
+static __inline int
atomic_fcmpset_64(volatile uint64_t *p, uint64_t *cmpval, uint64_t newval)
{
uint64_t tmp;
@@ -235,7 +235,7 @@ atomic_fcmpset_64(volatile uint64_t *p, uint64_t *cmpval, uint64_t newval)
return (!ret);
}
-static __inline u_long
+static __inline int
atomic_fcmpset_long(volatile u_long *p, u_long *cmpval, u_long newval)
{
@@ -243,38 +243,38 @@ atomic_fcmpset_long(volatile u_long *p, u_long *cmpval, u_long newval)
(uint32_t *)cmpval, newval));
}
-static __inline uint64_t
+static __inline int
atomic_fcmpset_acq_64(volatile uint64_t *p, uint64_t *cmpval, uint64_t newval)
{
- uint64_t ret;
+ int ret;
ret = atomic_fcmpset_64(p, cmpval, newval);
dmb();
return (ret);
}
-static __inline u_long
+static __inline int
atomic_fcmpset_acq_long(volatile u_long *p, u_long *cmpval, u_long newval)
{
- u_long ret;
+ int ret;
ret = atomic_fcmpset_long(p, cmpval, newval);
dmb();
return (ret);
}
-static __inline uint32_t
+static __inline int
atomic_fcmpset_acq_32(volatile uint32_t *p, uint32_t *cmpval, uint32_t newval)
{
- uint32_t ret;
+ int ret;
ret = atomic_fcmpset_32(p, cmpval, newval);
dmb();
return (ret);
}
-static __inline uint32_t
+static __inline int
atomic_fcmpset_rel_32(volatile uint32_t *p, uint32_t *cmpval, uint32_t newval)
{
@@ -282,7 +282,7 @@ atomic_fcmpset_rel_32(volatile uint32_t *p, uint32_t *cmpval, uint32_t newval)
return (atomic_fcmpset_32(p, cmpval, newval));
}
-static __inline uint64_t
+static __inline int
atomic_fcmpset_rel_64(volatile uint64_t *p, uint64_t *cmpval, uint64_t newval)
{
@@ -290,7 +290,7 @@ atomic_fcmpset_rel_64(volatile uint64_t *p, uint64_t *cmpval, uint64_t newval)
return (atomic_fcmpset_64(p, cmpval, newval));
}
-static __inline u_long
+static __inline int
atomic_fcmpset_rel_long(volatile u_long *p, u_long *cmpval, u_long newval)
{
@@ -298,10 +298,10 @@ atomic_fcmpset_rel_long(volatile u_long *p, u_long *cmpval, u_long newval)
return (atomic_fcmpset_long(p, cmpval, newval));
}
-static __inline uint32_t
+static __inline int
atomic_cmpset_32(volatile uint32_t *p, uint32_t cmpval, uint32_t newval)
{
- uint32_t ret;
+ int ret;
__asm __volatile(
"1: ldrex %0, [%1] \n"
@@ -349,44 +349,44 @@ atomic_cmpset_64(volatile uint64_t *p, uint64_t cmpval, uint64_t newval)
return (ret);
}
-static __inline u_long
+static __inline int
atomic_cmpset_long(volatile u_long *p, u_long cmpval, u_long newval)
{
return (atomic_cmpset_32((volatile uint32_t *)p, cmpval, newval));
}
-static __inline uint32_t
+static __inline int
atomic_cmpset_acq_32(volatile uint32_t *p, uint32_t cmpval, uint32_t newval)
{
- uint32_t ret;
+ int ret;
ret = atomic_cmpset_32(p, cmpval, newval);
dmb();
return (ret);
}
-static __inline uint64_t
+static __inline int
atomic_cmpset_acq_64(volatile uint64_t *p, uint64_t cmpval, uint64_t newval)
{
- uint64_t ret;
+ int ret;
ret = atomic_cmpset_64(p, cmpval, newval);
dmb();
return (ret);
}
-static __inline u_long
+static __inline int
atomic_cmpset_acq_long(volatile u_long *p, u_long cmpval, u_long newval)
{
- u_long ret;
+ int ret;
ret = atomic_cmpset_long(p, cmpval, newval);
dmb();
return (ret);
}
-static __inline uint32_t
+static __inline int
atomic_cmpset_rel_32(volatile uint32_t *p, uint32_t cmpval, uint32_t newval)
{
@@ -394,7 +394,7 @@ atomic_cmpset_rel_32(volatile uint32_t *p, uint32_t cmpval, uint32_t newval)
return (atomic_cmpset_32(p, cmpval, newval));
}
-static __inline uint64_t
+static __inline int
atomic_cmpset_rel_64(volatile uint64_t *p, uint64_t cmpval, uint64_t newval)
{
@@ -402,7 +402,7 @@ atomic_cmpset_rel_64(volatile uint64_t *p, uint64_t cmpval, uint64_t newval)
return (atomic_cmpset_64(p, cmpval, newval));
}
-static __inline u_long
+static __inline int
atomic_cmpset_rel_long(volatile u_long *p, u_long cmpval, u_long newval)
{
diff --git a/sys/conf/newvers.sh b/sys/conf/newvers.sh
index 17ec13d..3117f67 100644
--- a/sys/conf/newvers.sh
+++ b/sys/conf/newvers.sh
@@ -44,7 +44,7 @@
TYPE="FreeBSD"
REVISION="11.2"
-BRANCH="BETA1"
+BRANCH="BETA2"
if [ -n "${BRANCH_OVERRIDE}" ]; then
BRANCH=${BRANCH_OVERRIDE}
fi
diff --git a/sys/dev/mmc/mmcsd.c b/sys/dev/mmc/mmcsd.c
index 274f4d7..ca02dfd 100644
--- a/sys/dev/mmc/mmcsd.c
+++ b/sys/dev/mmc/mmcsd.c
@@ -67,6 +67,7 @@ __FBSDID("$FreeBSD$");
#include <sys/malloc.h>
#include <sys/module.h>
#include <sys/mutex.h>
+#include <sys/priv.h>
#include <sys/slicer.h>
#include <sys/time.h>
@@ -177,7 +178,7 @@ static int mmcsd_bus_bit_width(device_t dev);
static daddr_t mmcsd_delete(struct mmcsd_part *part, struct bio *bp);
static const char *mmcsd_errmsg(int e);
static int mmcsd_ioctl(struct mmcsd_part *part, u_long cmd, void *data,
- int fflag);
+ int fflag, struct thread *td);
static int mmcsd_ioctl_cmd(struct mmcsd_part *part, struct mmc_ioc_cmd *mic,
int fflag);
static uintmax_t mmcsd_pretty_size(off_t size, char *unit);
@@ -771,22 +772,23 @@ mmcsd_strategy(struct bio *bp)
static int
mmcsd_ioctl_rpmb(struct cdev *dev, u_long cmd, caddr_t data,
- int fflag, struct thread *td __unused)
+ int fflag, struct thread *td)
{
- return (mmcsd_ioctl(dev->si_drv1, cmd, data, fflag));
+ return (mmcsd_ioctl(dev->si_drv1, cmd, data, fflag, td));
}
static int
mmcsd_ioctl_disk(struct disk *disk, u_long cmd, void *data, int fflag,
- struct thread *td __unused)
+ struct thread *td)
{
- return (mmcsd_ioctl(disk->d_drv1, cmd, data, fflag));
+ return (mmcsd_ioctl(disk->d_drv1, cmd, data, fflag, td));
}
static int
-mmcsd_ioctl(struct mmcsd_part *part, u_long cmd, void *data, int fflag)
+mmcsd_ioctl(struct mmcsd_part *part, u_long cmd, void *data, int fflag,
+ struct thread *td)
{
struct mmc_ioc_cmd *mic;
struct mmc_ioc_multi_cmd *mimc;
@@ -796,6 +798,10 @@ mmcsd_ioctl(struct mmcsd_part *part, u_long cmd, void *data, int fflag)
if ((fflag & FREAD) == 0)
return (EBADF);
+ err = priv_check(td, PRIV_DRIVER);
+ if (err != 0)
+ return (err);
+
err = 0;
switch (cmd) {
case MMC_IOC_CMD:
diff --git a/sys/dev/sdhci/sdhci_acpi.c b/sys/dev/sdhci/sdhci_acpi.c
index 16e29f8..b7074c3 100644
--- a/sys/dev/sdhci/sdhci_acpi.c
+++ b/sys/dev/sdhci/sdhci_acpi.c
@@ -60,7 +60,6 @@ static const struct sdhci_acpi_device {
{ "80860F14", 1, "Intel Bay Trail/Braswell eMMC 4.5/4.5.1 Controller",
SDHCI_QUIRK_INTEL_POWER_UP_RESET |
SDHCI_QUIRK_WAIT_WHILE_BUSY |
- SDHCI_QUIRK_MMC_DDR52 |
SDHCI_QUIRK_CAPS_BIT63_FOR_MMC_HS400 |
SDHCI_QUIRK_PRESET_VALUE_BROKEN },
{ "80860F14", 3, "Intel Bay Trail/Braswell SDXC Controller",
@@ -261,11 +260,16 @@ sdhci_acpi_attach(device_t dev)
return (ENOMEM);
}
- /* Intel Braswell eMMC 4.5.1 controller quirk */
+ /*
+ * Intel Bay Trail and Braswell eMMC controllers share the same IDs,
+ * but while with these former DDR52 is affected by the VLI54 erratum,
+ * these latter require the timeout clock to be hardcoded to 1 MHz.
+ */
if (strcmp(acpi_dev->hid, "80860F14") == 0 && acpi_dev->uid == 1 &&
SDHCI_READ_4(dev, &sc->slot, SDHCI_CAPABILITIES) == 0x446cc8b2 &&
SDHCI_READ_4(dev, &sc->slot, SDHCI_CAPABILITIES2) == 0x00000807)
- sc->quirks |= SDHCI_QUIRK_DATA_TIMEOUT_1MHZ;
+ sc->quirks |= SDHCI_QUIRK_MMC_DDR52 |
+ SDHCI_QUIRK_DATA_TIMEOUT_1MHZ;
sc->quirks &= ~sdhci_quirk_clear;
sc->quirks |= sdhci_quirk_set;
sc->slot.quirks = sc->quirks;
diff --git a/sys/dev/sdhci/sdhci_pci.c b/sys/dev/sdhci/sdhci_pci.c
index 00a3b8b..030e7a8 100644
--- a/sys/dev/sdhci/sdhci_pci.c
+++ b/sys/dev/sdhci/sdhci_pci.c
@@ -104,18 +104,18 @@ static const struct sdhci_device {
{ 0x16bc14e4, 0xffff, "Broadcom BCM577xx SDXC/MMC Card Reader",
SDHCI_QUIRK_BCM577XX_400KHZ_CLKSRC },
{ 0x0f148086, 0xffff, "Intel Bay Trail eMMC 4.5 Controller",
+ /* DDR52 is supported but affected by the VLI54 erratum */
SDHCI_QUIRK_INTEL_POWER_UP_RESET |
SDHCI_QUIRK_WAIT_WHILE_BUSY |
- SDHCI_QUIRK_MMC_DDR52 |
SDHCI_QUIRK_CAPS_BIT63_FOR_MMC_HS400 |
SDHCI_QUIRK_PRESET_VALUE_BROKEN},
{ 0x0f158086, 0xffff, "Intel Bay Trail SDXC Controller",
SDHCI_QUIRK_WAIT_WHILE_BUSY |
SDHCI_QUIRK_PRESET_VALUE_BROKEN },
{ 0x0f508086, 0xffff, "Intel Bay Trail eMMC 4.5 Controller",
+ /* DDR52 is supported but affected by the VLI54 erratum */
SDHCI_QUIRK_INTEL_POWER_UP_RESET |
SDHCI_QUIRK_WAIT_WHILE_BUSY |
- SDHCI_QUIRK_MMC_DDR52 |
SDHCI_QUIRK_CAPS_BIT63_FOR_MMC_HS400 |
SDHCI_QUIRK_PRESET_VALUE_BROKEN },
{ 0x19db8086, 0xffff, "Intel Denverton eMMC 5.0 Controller",
diff --git a/sys/dev/vxge/vxge.c b/sys/dev/vxge/vxge.c
index b098460..b4fca5a 100644
--- a/sys/dev/vxge/vxge.c
+++ b/sys/dev/vxge/vxge.c
@@ -234,6 +234,7 @@ _exit0:
err = ENXIO;
}
+ gone_in_dev(ndev, 12, "vxge(4) driver");
return (err);
}
diff --git a/sys/i386/i386/elf_machdep.c b/sys/i386/i386/elf_machdep.c
index fcac38a..b05b5ef 100644
--- a/sys/i386/i386/elf_machdep.c
+++ b/sys/i386/i386/elf_machdep.c
@@ -158,10 +158,13 @@ elf32_dump_thread(struct thread *td, void *dst, size_t *off)
*off = len;
}
+#define ERI_LOCAL 0x0001
+#define ERI_ONLYIFUNC 0x0002
+
/* Process one elf relocation with addend. */
static int
elf_reloc_internal(linker_file_t lf, Elf_Addr relocbase, const void *data,
- int type, int local, elf_lookup_fn lookup)
+ int type, elf_lookup_fn lookup, int flags)
{
Elf_Addr *where;
Elf_Addr addr;
@@ -190,7 +193,10 @@ elf_reloc_internal(linker_file_t lf, Elf_Addr relocbase, const void *data,
panic("unknown reloc type %d\n", type);
}
- if (local) {
+ if (((flags & ERI_ONLYIFUNC) == 0) ^ (rtype != R_386_IRELATIVE))
+ return (0);
+
+ if ((flags & ERI_LOCAL) != 0) {
if (rtype == R_386_RELATIVE) { /* A + B */
addr = elf_relocaddr(lf, relocbase + addend);
if (*where != addr)
@@ -242,6 +248,12 @@ elf_reloc_internal(linker_file_t lf, Elf_Addr relocbase, const void *data,
case R_386_RELATIVE:
break;
+ case R_386_IRELATIVE:
+ addr = relocbase + addend;
+ addr = ((Elf_Addr (*)(void))addr)();
+ if (*where != addr)
+ *where = addr;
+ break;
default:
printf("kldload: unexpected relocation type %d\n",
rtype);
@@ -251,11 +263,20 @@ elf_reloc_internal(linker_file_t lf, Elf_Addr relocbase, const void *data,
}
int
+elf_reloc_ifunc(linker_file_t lf, Elf_Addr relocbase, const void *data,
+ int type, elf_lookup_fn lookup)
+{
+
+ return (elf_reloc_internal(lf, relocbase, data, type, lookup,
+ ERI_ONLYIFUNC));
+}
+
+int
elf_reloc(linker_file_t lf, Elf_Addr relocbase, const void *data, int type,
elf_lookup_fn lookup)
{
- return (elf_reloc_internal(lf, relocbase, data, type, 0, lookup));
+ return (elf_reloc_internal(lf, relocbase, data, type, lookup, 0));
}
int
@@ -263,7 +284,8 @@ elf_reloc_local(linker_file_t lf, Elf_Addr relocbase, const void *data,
int type, elf_lookup_fn lookup)
{
- return (elf_reloc_internal(lf, relocbase, data, type, 1, lookup));
+ return (elf_reloc_internal(lf, relocbase, data, type, lookup,
+ ERI_LOCAL));
}
int
diff --git a/sys/i386/i386/machdep.c b/sys/i386/i386/machdep.c
index cd41673..8fdccfb 100644
--- a/sys/i386/i386/machdep.c
+++ b/sys/i386/i386/machdep.c
@@ -2441,6 +2441,7 @@ init386(int first)
int gsel_tss, metadata_missing, x, pa;
struct pcpu *pc;
struct xstate_hdr *xhdr;
+ caddr_t kmdp;
int late_console;
thread0.td_kstack = proc0kstack;
@@ -2688,6 +2689,9 @@ init386(int first)
i386_kdb_init();
}
+ kmdp = preload_search_by_type("elf kernel");
+ link_elf_ireloc(kmdp);
+
vm86_initialize();
getmemsize(first);
init_param2(physmem);
diff --git a/sys/kern/link_elf.c b/sys/kern/link_elf.c
index 349a95e..213b50f 100644
--- a/sys/kern/link_elf.c
+++ b/sys/kern/link_elf.c
@@ -188,6 +188,9 @@ static struct linker_class link_elf_class = {
static int parse_dynamic(elf_file_t);
static int relocate_file(elf_file_t);
+static int relocate_file1(elf_file_t ef, int (*elf_reloc_func)(
+ linker_file_t lf, Elf_Addr relocbase, const void *data,
+ int type, elf_lookup_fn lookup));
static int link_elf_preload_parse_symbols(elf_file_t);
static struct elf_set_head set_pcpu_list;
@@ -1183,7 +1186,8 @@ symbol_name(elf_file_t ef, Elf_Size r_info)
}
static int
-relocate_file(elf_file_t ef)
+relocate_file1(elf_file_t ef, int (*elf_reloc_func)(linker_file_t lf,
+ Elf_Addr relocbase, const void *data, int type, elf_lookup_fn lookup))
{
const Elf_Rel *rellim;
const Elf_Rel *rel;
@@ -1197,7 +1201,7 @@ relocate_file(elf_file_t ef)
rellim = (const Elf_Rel *)
((const char *)ef->rel + ef->relsize);
while (rel < rellim) {
- if (elf_reloc(&ef->lf, (Elf_Addr)ef->address, rel,
+ if (elf_reloc_func(&ef->lf, (Elf_Addr)ef->address, rel,
ELF_RELOC_REL, elf_lookup)) {
symname = symbol_name(ef, rel->r_info);
printf("link_elf: symbol %s undefined\n", symname);
@@ -1213,7 +1217,7 @@ relocate_file(elf_file_t ef)
relalim = (const Elf_Rela *)
((const char *)ef->rela + ef->relasize);
while (rela < relalim) {
- if (elf_reloc(&ef->lf, (Elf_Addr)ef->address, rela,
+ if (elf_reloc_func(&ef->lf, (Elf_Addr)ef->address, rela,
ELF_RELOC_RELA, elf_lookup)) {
symname = symbol_name(ef, rela->r_info);
printf("link_elf: symbol %s undefined\n",
@@ -1230,7 +1234,7 @@ relocate_file(elf_file_t ef)
rellim = (const Elf_Rel *)
((const char *)ef->pltrel + ef->pltrelsize);
while (rel < rellim) {
- if (elf_reloc(&ef->lf, (Elf_Addr)ef->address, rel,
+ if (elf_reloc_func(&ef->lf, (Elf_Addr)ef->address, rel,
ELF_RELOC_REL, elf_lookup)) {
symname = symbol_name(ef, rel->r_info);
printf("link_elf: symbol %s undefined\n",
@@ -1247,7 +1251,7 @@ relocate_file(elf_file_t ef)
relalim = (const Elf_Rela *)
((const char *)ef->pltrela + ef->pltrelasize);
while (rela < relalim) {
- if (elf_reloc(&ef->lf, (Elf_Addr)ef->address, rela,
+ if (elf_reloc_func(&ef->lf, (Elf_Addr)ef->address, rela,
ELF_RELOC_RELA, elf_lookup)) {
symname = symbol_name(ef, rela->r_info);
printf("link_elf: symbol %s undefined\n",
@@ -1261,6 +1265,19 @@ relocate_file(elf_file_t ef)
return (0);
}
+static int
+relocate_file(elf_file_t ef)
+{
+ int e;
+
+ e = relocate_file1(ef, elf_reloc);
+#if defined(__i386__) || defined(__amd64__)
+ if (e == 0)
+ e = relocate_file1(ef, elf_reloc_ifunc);
+#endif
+ return (e);
+}
+
/*
* Hash function for symbol table lookup. Don't even think about changing
* this. It is specified by the System V ABI.
@@ -1318,7 +1335,8 @@ link_elf_lookup_symbol(linker_file_t lf, const char* name, c_linker_sym_t* sym)
if (strcmp(name, strp) == 0) {
if (symp->st_shndx != SHN_UNDEF ||
(symp->st_value != 0 &&
- ELF_ST_TYPE(symp->st_info) == STT_FUNC)) {
+ (ELF_ST_TYPE(symp->st_info) == STT_FUNC ||
+ ELF_ST_TYPE(symp->st_info) == STT_GNU_IFUNC))) {
*sym = (c_linker_sym_t) symp;
return (0);
}
@@ -1338,7 +1356,8 @@ link_elf_lookup_symbol(linker_file_t lf, const char* name, c_linker_sym_t* sym)
if (strcmp(name, strp) == 0) {
if (symp->st_shndx != SHN_UNDEF ||
(symp->st_value != 0 &&
- ELF_ST_TYPE(symp->st_info) == STT_FUNC)) {
+ (ELF_ST_TYPE(symp->st_info) == STT_FUNC ||
+ ELF_ST_TYPE(symp->st_info) == STT_GNU_IFUNC))) {
*sym = (c_linker_sym_t) symp;
return (0);
}
@@ -1353,12 +1372,18 @@ static int
link_elf_symbol_values(linker_file_t lf, c_linker_sym_t sym,
linker_symval_t *symval)
{
- elf_file_t ef = (elf_file_t) lf;
- const Elf_Sym* es = (const Elf_Sym*) sym;
+ elf_file_t ef;
+ const Elf_Sym *es;
+ caddr_t val;
+ ef = (elf_file_t)lf;
+ es = (const Elf_Sym *)sym;
if (es >= ef->symtab && es < (ef->symtab + ef->nchains)) {
symval->name = ef->strtab + es->st_name;
- symval->value = (caddr_t) ef->address + es->st_value;
+ val = (caddr_t)ef->address + es->st_value;
+ if (ELF_ST_TYPE(es->st_info) == STT_GNU_IFUNC)
+ val = ((caddr_t (*)(void))val)();
+ symval->value = val;
symval->size = es->st_size;
return (0);
}
@@ -1366,7 +1391,10 @@ link_elf_symbol_values(linker_file_t lf, c_linker_sym_t sym,
return (ENOENT);
if (es >= ef->ddbsymtab && es < (ef->ddbsymtab + ef->ddbsymcnt)) {
symval->name = ef->ddbstrtab + es->st_name;
- symval->value = (caddr_t) ef->address + es->st_value;
+ val = (caddr_t)ef->address + es->st_value;
+ if (ELF_ST_TYPE(es->st_info) == STT_GNU_IFUNC)
+ val = ((caddr_t (*)(void))val)();
+ symval->value = val;
symval->size = es->st_size;
return (0);
}
@@ -1476,7 +1504,8 @@ link_elf_each_function_name(linker_file_t file,
/* Exhaustive search */
for (i = 0, symp = ef->ddbsymtab; i < ef->ddbsymcnt; i++, symp++) {
if (symp->st_value != 0 &&
- ELF_ST_TYPE(symp->st_info) == STT_FUNC) {
+ (ELF_ST_TYPE(symp->st_info) == STT_FUNC ||
+ ELF_ST_TYPE(symp->st_info) == STT_GNU_IFUNC)) {
error = callback(ef->ddbstrtab + symp->st_name, opaque);
if (error != 0)
return (error);
@@ -1497,7 +1526,8 @@ link_elf_each_function_nameval(linker_file_t file,
/* Exhaustive search */
for (i = 0, symp = ef->ddbsymtab; i < ef->ddbsymcnt; i++, symp++) {
if (symp->st_value != 0 &&
- ELF_ST_TYPE(symp->st_info) == STT_FUNC) {
+ (ELF_ST_TYPE(symp->st_info) == STT_FUNC ||
+ ELF_ST_TYPE(symp->st_info) == STT_GNU_IFUNC)) {
error = link_elf_symbol_values(file,
(c_linker_sym_t) symp, &symval);
if (error != 0)
@@ -1656,3 +1686,27 @@ link_elf_strtab_get(linker_file_t lf, caddr_t *strtab)
return (ef->ddbstrcnt);
}
+
+#if defined(__i386__) || defined(__amd64__)
+void
+link_elf_ireloc(caddr_t kmdp)
+{
+ struct elf_file eff;
+ elf_file_t ef;
+ volatile char *c;
+ size_t i;
+
+ ef = &eff;
+
+ /* Do not use bzero/memset before ireloc is done. */
+ for (c = (char *)ef, i = 0; i < sizeof(*ef); i++)
+ c[i] = 0;
+
+ ef->modptr = kmdp;
+ ef->dynamic = (Elf_Dyn *)&_DYNAMIC;
+ parse_dynamic(ef);
+ ef->address = 0;
+ link_elf_preload_parse_symbols(ef);
+ relocate_file1(ef, elf_reloc_ifunc);
+}
+#endif
diff --git a/sys/kern/link_elf_obj.c b/sys/kern/link_elf_obj.c
index ad415ce..0953eb0 100644
--- a/sys/kern/link_elf_obj.c
+++ b/sys/kern/link_elf_obj.c
@@ -1194,12 +1194,19 @@ static int
link_elf_symbol_values(linker_file_t lf, c_linker_sym_t sym,
linker_symval_t *symval)
{
- elf_file_t ef = (elf_file_t) lf;
- const Elf_Sym *es = (const Elf_Sym*) sym;
+ elf_file_t ef;
+ const Elf_Sym *es;
+ caddr_t val;
+ ef = (elf_file_t) lf;
+ es = (const Elf_Sym*) sym;
+ val = (caddr_t)es->st_value;
if (es >= ef->ddbsymtab && es < (ef->ddbsymtab + ef->ddbsymcnt)) {
symval->name = ef->ddbstrtab + es->st_name;
- symval->value = (caddr_t)es->st_value;
+ val = (caddr_t)es->st_value;
+ if (ELF_ST_TYPE(es->st_info) == STT_GNU_IFUNC)
+ val = ((caddr_t (*)(void))val)();
+ symval->value = val;
symval->size = es->st_size;
return 0;
}
@@ -1284,7 +1291,8 @@ link_elf_each_function_name(linker_file_t file,
/* Exhaustive search */
for (i = 0, symp = ef->ddbsymtab; i < ef->ddbsymcnt; i++, symp++) {
if (symp->st_value != 0 &&
- ELF_ST_TYPE(symp->st_info) == STT_FUNC) {
+ (ELF_ST_TYPE(symp->st_info) == STT_FUNC ||
+ ELF_ST_TYPE(symp->st_info) == STT_GNU_IFUNC)) {
error = callback(ef->ddbstrtab + symp->st_name, opaque);
if (error)
return (error);
@@ -1305,8 +1313,10 @@ link_elf_each_function_nameval(linker_file_t file,
/* Exhaustive search */
for (i = 0, symp = ef->ddbsymtab; i < ef->ddbsymcnt; i++, symp++) {
if (symp->st_value != 0 &&
- ELF_ST_TYPE(symp->st_info) == STT_FUNC) {
- error = link_elf_symbol_values(file, (c_linker_sym_t) symp, &symval);
+ (ELF_ST_TYPE(symp->st_info) == STT_FUNC ||
+ ELF_ST_TYPE(symp->st_info) == STT_GNU_IFUNC)) {
+ error = link_elf_symbol_values(file,
+ (c_linker_sym_t)symp, &symval);
if (error)
return (error);
error = callback(file, i, &symval, opaque);
diff --git a/sys/net/if_ipsec.c b/sys/net/if_ipsec.c
index 7ae27a0..c9dcbc6 100644
--- a/sys/net/if_ipsec.c
+++ b/sys/net/if_ipsec.c
@@ -434,7 +434,7 @@ ipsec_if_input(struct mbuf *m, struct secasvar *sav, uint32_t af)
m->m_pkthdr.rcvif = ifp;
IPSEC_SC_RUNLOCK();
- /* m_clrprotoflags(m); */
+ m_clrprotoflags(m);
M_SETFIB(m, ifp->if_fib);
BPF_MTAP2(ifp, &af, sizeof(af), m);
if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1);
diff --git a/sys/sys/linker.h b/sys/sys/linker.h
index 349bfeb..de40b09 100644
--- a/sys/sys/linker.h
+++ b/sys/sys/linker.h
@@ -269,11 +269,16 @@ extern int kld_debug;
typedef int elf_lookup_fn(linker_file_t, Elf_Size, int, Elf_Addr *);
/* Support functions */
-int elf_reloc(linker_file_t _lf, Elf_Addr base, const void *_rel, int _type, elf_lookup_fn _lu);
-int elf_reloc_local(linker_file_t _lf, Elf_Addr base, const void *_rel, int _type, elf_lookup_fn _lu);
+int elf_reloc(linker_file_t _lf, Elf_Addr base, const void *_rel,
+ int _type, elf_lookup_fn _lu);
+int elf_reloc_ifunc(linker_file_t _lf, Elf_Addr base, const void *_rel,
+ int _type, elf_lookup_fn _lu);
+int elf_reloc_local(linker_file_t _lf, Elf_Addr base, const void *_rel,
+ int _type, elf_lookup_fn _lu);
Elf_Addr elf_relocaddr(linker_file_t _lf, Elf_Addr addr);
const Elf_Sym *elf_get_sym(linker_file_t _lf, Elf_Size _symidx);
const char *elf_get_symname(linker_file_t _lf, Elf_Size _symidx);
+void link_elf_ireloc(caddr_t kmdp);
typedef struct linker_ctf {
const uint8_t *ctftab; /* Decompressed CTF data. */
diff --git a/sys/x86/include/ifunc.h b/sys/x86/include/ifunc.h
new file mode 100644
index 0000000..13f4b88
--- /dev/null
+++ b/sys/x86/include/ifunc.h
@@ -0,0 +1,58 @@
+/*-
+ * Copyright (c) 2015, 2017 The FreeBSD Foundation
+ * All rights reserved.
+ *
+ * This software was developed by Konstantin Belousov <kib@FreeBSD.org>
+ * under sponsorship from the FreeBSD Foundation.
+ *
+ * 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.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef __X86_IFUNC_H
+#define __X86_IFUNC_H
+
+#define DECLARE_LIFUNC(ret_type, name, args) \
+ret_type name args
+
+#define DEFINE_LIFUNC(scope, selector_qual, ret_type, name, args) \
+__asm__ (scope "\t" #name "\n" \
+ "\t.type\t" #name ",@function\n" \
+ #name ":\n" \
+ "\tjmp *" #name "_selector\n" \
+ "\t.size\t" #name ",\t. - "#name); \
+selector_qual ret_type (*name##_selector)args __used; \
+DECLARE_LIFUNC(ret_type, name, args)
+
+#define DEFINE_STATIC_LIFUNC(ret_type, name, args) \
+ DEFINE_LIFUNC(".local", static, ret_type, name, args)
+
+#define DEFINE_GLOBAL_LIFUNC(ret_type, name, args) \
+ DEFINE_LIFUNC(".globl", , ret_type, name, args)
+
+#define DEFINE_IFUNC(qual, ret_type, name, args, resolver_qual) \
+ resolver_qual ret_type (*name##_resolver(void))args __used; \
+ qual ret_type name args __attribute__((ifunc(#name "_resolver"))); \
+ resolver_qual ret_type (*name##_resolver(void))args
+
+#endif
OpenPOWER on IntegriCloud