aboutsummaryrefslogtreecommitdiff
path: root/libexec
diff options
context:
space:
mode:
Diffstat (limited to 'libexec')
-rw-r--r--libexec/getty/ttys.55
-rw-r--r--libexec/rtld-elf/malloc.c15
-rw-r--r--libexec/rtld-elf/paths.h8
-rw-r--r--libexec/rtld-elf/riscv/rtld_start.S46
-rw-r--r--libexec/rtld-elf/rtld.c30
-rw-r--r--libexec/rtld-elf/tests/ld_library_pathfds.c2
6 files changed, 58 insertions, 48 deletions
diff --git a/libexec/getty/ttys.5 b/libexec/getty/ttys.5
index 1c754890e5c4..7b730d8b7cee 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 2, 2018
+.Dd August 3, 2018
.Dt TTYS 5
.Os
.Sh NAME
@@ -167,9 +167,8 @@ ttyv0 "/usr/local/bin/xterm -display :0" xterm on window="/usr/local/bin/X :0"
.Xr termcap 5 ,
.Xr getty 8 ,
.Xr init 8 ,
+.Xr pam_securetty 8 ,
.Xr pstat 8
-.\".Xr init 8 ,
-.\".Xr ttyflags 8
.Sh HISTORY
A
.Nm
diff --git a/libexec/rtld-elf/malloc.c b/libexec/rtld-elf/malloc.c
index cfd541eabc9d..188916b69606 100644
--- a/libexec/rtld-elf/malloc.c
+++ b/libexec/rtld-elf/malloc.c
@@ -47,6 +47,7 @@ static char *rcsid = "$FreeBSD$";
#include <sys/types.h>
#include <sys/sysctl.h>
+#include <errno.h>
#include <stdarg.h>
#include <stddef.h>
#include <stdio.h>
@@ -55,7 +56,9 @@ static char *rcsid = "$FreeBSD$";
#include <unistd.h>
#include <sys/param.h>
#include <sys/mman.h>
+#include "rtld.h"
#include "rtld_printf.h"
+#include "paths.h"
static void morecore();
static int findbucket();
@@ -472,9 +475,11 @@ int n;
if (pagepool_end - pagepool_start > pagesz) {
caddr_t addr = (caddr_t)
(((long)pagepool_start + pagesz - 1) & ~(pagesz - 1));
- if (munmap(addr, pagepool_end - addr) != 0)
- rtld_fdprintf(STDERR_FILENO, "morepages: munmap %p",
- addr);
+ if (munmap(addr, pagepool_end - addr) != 0) {
+ rtld_fdprintf(STDERR_FILENO, _BASENAME_RTLD ": "
+ "morepages: cannot munmap %p: %s\n",
+ addr, rtld_strerror(errno));
+ }
}
offset = (long)pagepool_start - ((long)pagepool_start & ~(pagesz - 1));
@@ -482,7 +487,9 @@ int n;
if ((pagepool_start = mmap(0, n * pagesz,
PROT_READ|PROT_WRITE,
MAP_ANON|MAP_PRIVATE, fd, 0)) == (caddr_t)-1) {
- rtld_printf("Cannot map anonymous memory\n");
+ rtld_fdprintf(STDERR_FILENO, _BASENAME_RTLD ": morepages: "
+ "cannot mmap anonymous memory: %s\n",
+ rtld_strerror(errno));
return 0;
}
pagepool_end = pagepool_start + n * pagesz;
diff --git a/libexec/rtld-elf/paths.h b/libexec/rtld-elf/paths.h
index 69b1d03e1a8a..088800f30e6a 100644
--- a/libexec/rtld-elf/paths.h
+++ b/libexec/rtld-elf/paths.h
@@ -34,7 +34,7 @@
#ifdef COMPAT_32BIT
#define _PATH_ELF_HINTS "/var/run/ld-elf32.so.hints"
#define _PATH_LIBMAP_CONF "/etc/libmap32.conf"
-#define _PATH_RTLD "/libexec/ld-elf32.so.1"
+#define _BASENAME_RTLD "ld-elf32.so.1"
#define STANDARD_LIBRARY_PATH "/lib32:/usr/lib32"
#define LD_ "LD_32_"
#endif
@@ -47,8 +47,12 @@
#define _PATH_LIBMAP_CONF "/etc/libmap.conf"
#endif
+#ifndef _BASENAME_RTLD
+#define _BASENAME_RTLD "ld-elf.so.1"
+#endif
+
#ifndef _PATH_RTLD
-#define _PATH_RTLD "/libexec/ld-elf.so.1"
+#define _PATH_RTLD "/libexec/" _BASENAME_RTLD
#endif
#ifndef STANDARD_LIBRARY_PATH
diff --git a/libexec/rtld-elf/riscv/rtld_start.S b/libexec/rtld-elf/riscv/rtld_start.S
index 76b6dfcaf3bc..c37cd62e49ec 100644
--- a/libexec/rtld-elf/riscv/rtld_start.S
+++ b/libexec/rtld-elf/riscv/rtld_start.S
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2015 Ruslan Bukin <br@bsdpad.com>
+ * Copyright (c) 2015-2018 Ruslan Bukin <br@bsdpad.com>
* All rights reserved.
*
* This software was developed by SRI International and the University of
@@ -64,7 +64,7 @@ END(.rtld_start)
*/
ENTRY(_rtld_bind_start)
/* Save the arguments and ra */
- addi sp, sp, -(8 * 25)
+ addi sp, sp, -(8 * 17)
sd a0, (8 * 0)(sp)
sd a1, (8 * 1)(sp)
sd a2, (8 * 2)(sp)
@@ -74,17 +74,17 @@ ENTRY(_rtld_bind_start)
sd a6, (8 * 6)(sp)
sd a7, (8 * 7)(sp)
sd ra, (8 * 8)(sp)
-#if 0
- /* RISCVTODO VFP */
+
+#ifdef __riscv_float_abi_double
/* Save any floating-point arguments */
- fsq fa0, (8 * 9)(sp)
- fsq fa1, (8 * 11)(sp)
- fsq fa2, (8 * 13)(sp)
- fsq fa3, (8 * 15)(sp)
- fsq fa4, (8 * 17)(sp)
- fsq fa5, (8 * 19)(sp)
- fsq fa6, (8 * 21)(sp)
- fsq fa7, (8 * 23)(sp)
+ fsd fa0, (8 * 9)(sp)
+ fsd fa1, (8 * 10)(sp)
+ fsd fa2, (8 * 11)(sp)
+ fsd fa3, (8 * 12)(sp)
+ fsd fa4, (8 * 13)(sp)
+ fsd fa5, (8 * 14)(sp)
+ fsd fa6, (8 * 15)(sp)
+ fsd fa7, (8 * 16)(sp)
#endif
/* Reloc offset is 3x of the .got.plt offset */
@@ -110,19 +110,19 @@ ENTRY(_rtld_bind_start)
ld a6, (8 * 6)(sp)
ld a7, (8 * 7)(sp)
ld ra, (8 * 8)(sp)
-#if 0
- /* RISCVTODO VFP */
+
+#ifdef __riscv_float_abi_double
/* Restore floating-point arguments */
- flq fa0, (8 * 9)(sp)
- flq fa1, (8 * 11)(sp)
- flq fa2, (8 * 13)(sp)
- flq fa3, (8 * 15)(sp)
- flq fa4, (8 * 17)(sp)
- flq fa5, (8 * 19)(sp)
- flq fa6, (8 * 21)(sp)
- flq fa7, (8 * 23)(sp)
+ fld fa0, (8 * 9)(sp)
+ fld fa1, (8 * 10)(sp)
+ fld fa2, (8 * 11)(sp)
+ fld fa3, (8 * 12)(sp)
+ fld fa4, (8 * 13)(sp)
+ fld fa5, (8 * 14)(sp)
+ fld fa6, (8 * 15)(sp)
+ fld fa7, (8 * 16)(sp)
#endif
- addi sp, sp, (8 * 25)
+ addi sp, sp, (8 * 17)
/* Call into the correct function */
jr t0
diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c
index 75bb6ca8d53d..43240568b3e8 100644
--- a/libexec/rtld-elf/rtld.c
+++ b/libexec/rtld-elf/rtld.c
@@ -408,8 +408,8 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_proc, Obj_Entry **objp)
phdr = (const Elf_Phdr *)aux_info[AT_PHDR]->a_un.a_ptr;
if (phdr == obj_rtld.phdr) {
if (!trust) {
- rtld_printf("Tainted process refusing to run binary %s\n",
- argv0);
+ _rtld_error("Tainted process refusing to run binary %s",
+ argv0);
rtld_die();
}
dbg("opening main program in direct exec mode");
@@ -420,7 +420,7 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_proc, Obj_Entry **objp)
if (!explicit_fd)
fd = open_binary_fd(argv0, search_in_path);
if (fstat(fd, &st) == -1) {
- _rtld_error("failed to fstat FD %d (%s): %s", fd,
+ _rtld_error("Failed to fstat FD %d (%s): %s", fd,
explicit_fd ? "user-provided descriptor" : argv0,
rtld_strerror(errno));
rtld_die();
@@ -447,8 +447,8 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_proc, Obj_Entry **objp)
dir_enable = true;
}
if (!dir_enable) {
- rtld_printf("No execute permission for binary %s\n",
- argv0);
+ _rtld_error("No execute permission for binary %s",
+ argv0);
rtld_die();
}
@@ -477,7 +477,7 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_proc, Obj_Entry **objp)
break;
}
} else {
- rtld_printf("no binary\n");
+ _rtld_error("No binary");
rtld_die();
}
}
@@ -962,6 +962,7 @@ rtld_die(void)
if (msg == NULL)
msg = "Fatal error";
+ rtld_fdputstr(STDERR_FILENO, _BASENAME_RTLD ": ");
rtld_fdputstr(STDERR_FILENO, msg);
rtld_fdputchar(STDERR_FILENO, '\n');
_exit(1);
@@ -2441,7 +2442,7 @@ do_load_object(int fd, const char *name, char *path, struct stat *sbp,
return NULL;
}
if (fs.f_flags & MNT_NOEXEC) {
- _rtld_error("Cannot execute objects on %s\n", fs.f_mntonname);
+ _rtld_error("Cannot execute objects on %s", fs.f_mntonname);
return NULL;
}
}
@@ -5317,12 +5318,12 @@ open_binary_fd(const char *argv0, bool search_in_path)
if (search_in_path && strchr(argv0, '/') == NULL) {
pathenv = getenv("PATH");
if (pathenv == NULL) {
- rtld_printf("-p and no PATH environment variable\n");
+ _rtld_error("-p and no PATH environment variable");
rtld_die();
}
pathenv = strdup(pathenv);
if (pathenv == NULL) {
- rtld_printf("Cannot allocate memory\n");
+ _rtld_error("Cannot allocate memory");
rtld_die();
}
fd = -1;
@@ -5348,8 +5349,7 @@ open_binary_fd(const char *argv0, bool search_in_path)
}
if (fd == -1) {
- rtld_printf("Opening %s: %s\n", argv0,
- rtld_strerror(errno));
+ _rtld_error("Cannot open %s: %s", argv0, rtld_strerror(errno));
rtld_die();
}
return (fd);
@@ -5393,7 +5393,7 @@ parse_args(char* argv[], int argc, bool *use_pathp, int *fdp)
opt = arg[j];
if (opt == 'h') {
print_usage(argv[0]);
- rtld_die();
+ _exit(0);
} else if (opt == 'f') {
/*
* -f XX can be used to specify a descriptor for the
@@ -5403,13 +5403,13 @@ parse_args(char* argv[], int argc, bool *use_pathp, int *fdp)
*/
if (j != arglen - 1) {
/* -f must be the last option in, e.g., -abcf */
- _rtld_error("invalid options: %s", arg);
+ _rtld_error("Invalid options: %s", arg);
rtld_die();
}
i++;
fd = parse_integer(argv[i]);
if (fd == -1) {
- _rtld_error("invalid file descriptor: '%s'",
+ _rtld_error("Invalid file descriptor: '%s'",
argv[i]);
rtld_die();
}
@@ -5418,7 +5418,7 @@ parse_args(char* argv[], int argc, bool *use_pathp, int *fdp)
} else if (opt == 'p') {
*use_pathp = true;
} else {
- rtld_printf("invalid argument: '%s'\n", arg);
+ _rtld_error("Invalid argument: '%s'", arg);
print_usage(argv[0]);
rtld_die();
}
diff --git a/libexec/rtld-elf/tests/ld_library_pathfds.c b/libexec/rtld-elf/tests/ld_library_pathfds.c
index 11008945b7ed..5c6c2dabbcdb 100644
--- a/libexec/rtld-elf/tests/ld_library_pathfds.c
+++ b/libexec/rtld-elf/tests/ld_library_pathfds.c
@@ -186,7 +186,7 @@ expect_missing_library(int binary, char *pathfds)
{
char * const env[] = { pathfds, NULL };
try_to_run(binary, 1, env, "",
- "Shared object \"libpythagoras.so.0\" not found,"
+ "ld-elf.so.1: Shared object \"libpythagoras.so.0\" not found,"
" required by \"target\"\n");
}