Commit graph

14874 commits

Author SHA1 Message Date
Konstantin Belousov
492a76bcd6 proccontrol(1): Add wxmap control
(cherry picked from commit ac8af19380)
2021-09-24 03:26:59 +03:00
Konstantin Belousov
9ebc7d49be Style
(cherry picked from commit 1349891a0e)
2021-09-24 03:26:59 +03:00
Edward Tomasz Napierala
4256412900 proccontrol(1): implement 'nonewprivs'
(cherry picked from commit acb1f1269c)
2021-09-24 03:26:59 +03:00
Mariusz Zaborski
c91cdb006e grep: fix combination of quiet and count flag
When the quiet (-q) flag is provided, we don't expect any output.
Currently, the behavior is broken:
$ grep -cq flag util.c
1

$ grep -cs flag util.c
55

First of all, we print a number to stdout. Secondly, it just returns
0 or 1 (which is unexpected). GNU grep with c and q flags doesn't
print anything.

Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D31108

(cherry picked from commit 24c681a7f6)
2021-09-22 10:05:39 -04:00
Baptiste Daroussin
1e5c3ce7a5 import nvi 2.2.0-3bbdfe4
(cherry picked from commit 6680e5a52f)
2021-09-22 12:07:48 +02:00
Kevin Bowling
d44b684e1a calendar.freebsd: Fix off-by-one error
(cherry picked from commit 007c2463d6)
2021-09-17 16:08:18 -07:00
John Grafton
3e3f48e6c4 top(1): indicate how to reset grep string
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/536/files

(cherry picked from commit 4ccbbe5f06)
2021-09-12 19:12:01 -06:00
John Grafton
72f20536ea top(1): support command name and argument grepping
Obtained from:  OpenBSD
Reviewed by:	imp@
Pull Request:	https://github.com/freebsd/freebsd-src/pull/479

(cherry picked from commit a00d703f2f)
2021-09-12 19:12:00 -06:00
Jessica Clarke
523f2486d5 clang: Support building with GCC and DEBUG_FILES disabled
If MK_DEBUG_FILES=no then the Clang link rule has clang as .TARGET,
rather than clang.full, causing the implicit ${CFLAGS.${.TARGET:T}} to
be CFLAGS.clang, and thus pull in flags intended for when your compiler
is Clang, not when linking Clang itself. This doesn't matter if your
compiler is in fact Clang, but it breaks using GCC as, for example,
bsd.sys.mk adds -Qunused-arguments to CFLAGS.clang. This is seen when
trying to build a bootstrap toolchain on Linux where GCC is the system
compiler.

Thus, introduce a new internal NO_TARGET_FLAGS variable that is set by
Clang to disable the addition of these implicit flags. This is a bigger
hammer than necessary, as flags for .o files would be safe, but that is
not needed for Clang.

Note that the same problem does not arise for LDFLAGS when building LLD
with BFD, since our build produces a program called ld.lld, not plain
lld (unlike upstream, where ld.lld is a symlink to lld so they can
support multiple different flavours in one binary).

Suggested by:	sjg
Fixes:		31ba4ce889 ("Allow bootstrapping llvm-tblgen on macOS and Linux")
MFC after:	1 week
Reviewed by:	dim, imp, emaste
Differential Revision:	https://reviews.freebsd.org/D31532

(cherry picked from commit c8edd05426)
2021-09-07 13:08:19 +01:00
Konstantin Belousov
d5d99c1c07 ldd: Remove non-functional -v option
(cherry picked from commit 17fc43bc01)
2021-09-03 04:08:35 +03:00
Gordon Bergling
dbb74dd891 Fix some common typos in source code comments
- s/priviledged/privileged/
- s/funtion/function/
- s/doens't/doesn't/
- s/sychronization/synchronization/

(cherry picked from commit 5bdf58e196)
2021-08-31 08:13:15 +02:00
Gordon Bergling
08fe2da3ce nfsstat(1): Fix a typo in an error message
- s/priviledged/privileged/

(cherry picked from commit 72a92f91f4)
2021-08-30 07:44:57 +02:00
Olivier Cochard
108633bb15 diff: Use unprivileged_user with report_identical test
Approved by:	bapt
Sponsored by:	Netflix
Differential Revision:	https://reviews.freebsd.org/D28466

(cherry picked from commit b67df8d7c2)
2021-08-22 18:48:55 +02:00
Mark Johnston
4c6246b76e tail: Add regression tests for -f and -F
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 58b1a126b9)
2021-08-21 12:18:21 -04:00
Mark Johnston
9bfe19ff82 tail: Fix -f with stdin
Based on a patch from swills@.

(cherry picked from commit 7e11889959)
2021-08-21 12:18:17 -04:00
Gordon Bergling
ac7cf0c636 Fix a few typos in source code comments
- s/procesing/processing/

(cherry picked from commit 288e553623)
2021-08-19 09:27:34 +02:00
Ed Maste
d1d9ee6f78 ar: remove invalid extra param in bsdar_warnc calls
A number of warnings passed an exit status code to bsdar_warnc, but it
does not take exit status (as a warning, it does not exit).

MFC after:	1 week
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 09319f7d3f)
2021-08-17 21:27:41 -04:00
Mateusz Piotrowski
5a1da25da2 grep: Fix an incorrect description of the -C flag
It seems that the number of lines is no longer an optional parameter to
the -C flag. Document it accordingly both in the manual page and the
usage message.

Reviewed by:	yuripv
Approved by:	yuripv
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D28509

(cherry picked from commit be6b8b7a3a)
2021-08-15 23:01:01 +02:00
Gordon Bergling
375a52cc3c mkimg(1): Correct a typo in the usage output
- s/partion/partition/

(cherry picked from commit 6bddade611)
2021-08-14 08:28:00 +02:00
Alex Richardson
c65dab7dd2 Allow bootstrapping llvm-tblgen on macOS and Linux
This is needed in order to build various LLVM binutils (e.g. addr2line)
as well as clang/lld/lldb.

Co-authored-by: Jessica Clarke <jrtc27@FreeBSD.org>
Test Plan:	Compiles on ubuntu 18.04 and macOS 11.4
Reviewed By:	dim
Differential Revision: https://reviews.freebsd.org/D31057

(cherry picked from commit 31ba4ce889)
2021-08-05 10:01:08 +01:00
Alex Richardson
1d7c196d11 Remove mkcsmapper_static and mkesdb_static from build-tools
Build them as part of the bootstrap-tools phase instead.

Reviewed by:	emaste (no objections)
Differential Revision: https://reviews.freebsd.org/D28181

(cherry picked from commit 2de949cf85)
2021-08-05 10:00:56 +01:00
Alex Richardson
7a7324d9ce usr.bin/diff: fix UBSan error in readhash
UBSan complains about the `sum = sum * 127 + chrtran(t);` line below since
that can overflow an `int`. Use `unsigned int` instead to ensure that
overflow is well-defined.

Reviewed By:	imp
MFC after:	1 week
Differential Revision: https://reviews.freebsd.org/D31075

(cherry picked from commit c78f449d85)
2021-08-05 09:59:26 +01:00
Alex Richardson
608cb96312 usr.bin/login: send errors to console if syslog isn't running
I was debugging why login(1) wasn't working as expected on a minimal
MFS_ROOT disk image. This image doesn't have syslogd running so the
warnings were lost and I had to use GDB to find out why login(1) was
failing (missing PAM libraries) instead of being able to see it in
the console output.

MFC after:	1 week
Reviewed By:	pfg
Differential Revision: https://reviews.freebsd.org/D30892

(cherry picked from commit 4d552825ec)
2021-08-05 09:57:54 +01:00
Alex Richardson
e4c2ffe932 usr.bin/sort: Avoid UBSan errors
UBSan complains about out-of-bounds accesses for zero-length arrays. To
avoid this we can use flexible array members. However, the C standard does
not allow for structures that only contain flexible array members, so we
move the length parameters into that structure too.

Split out from D28233.

Reviewed By:	markj
MFC after:	1 week
Differential Revision: https://reviews.freebsd.org/D31009

(cherry picked from commit d053fb22f6)
2021-08-05 09:57:45 +01:00
Alex Richardson
22548a3b80 Simplify and speed up the kyua build
Instead of having multiple kyua libraries, just include the files as part
of usr.bin/kyua. Previously, we would build each kyua source up to four
times: once as a .o file and once as a .pieo. Additionally, the kyua
libraries might be built again for compat32. As all the kyua libraries
amount to 102 C++ sources the build time is significant (especially when
using an assertions enabled compiler). This change ensures that we build
306 fewer .cpp source files as part of buildworld.

Reviewed By:	brooks
MFC after:	1 week
Differential Revision: https://reviews.freebsd.org/D30967

Remove lib/kyua from the build

I forgot to include this line in 2eb9ad4274.

Reported by:	Jenkins CI
MFC after:	1 week
Fixes:		2eb9ad427475190ei ("Simplify and speed up the kyua build")

Revert "Remove lib/kyua from the build"

Accidentally removed it from the wrong file...

This reverts commit 8ec4ba8a76.

Remove lib/kyua from the build

I forgot to include this line in 2eb9ad4274.

Reported by:    Jenkins CI
MFC after:      1 week
Fixes:          2eb9ad427475190ei ("Simplify and speed up the kyua build")

(cherry picked from commit 2eb9ad4274)
(cherry picked from commit 8ec4ba8a76)
(cherry picked from commit 89da04fcaa)
(cherry picked from commit c951566915)
2021-08-05 09:56:47 +01:00
Xin LI
f5536286db less: upgrade to v590.
(cherry picked from commit 30a1828c51)
(cherry picked from commit 4bcc6d14e2)
2021-08-02 01:28:42 -07:00
Dimitry Andric
af732203b8 Merge llvm-project 12.0.1 release and follow-up fixes
Merge llvm-project main llvmorg-12-init-17869-g8e464dd76bef

This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvmorg-12-init-17869-g8e464dd76bef, the last commit before the
upstream release/12.x branch was created.

PR:		255570

(cherry picked from commit e8d8bef961)

Merge llvm-project 12.0.0 release

This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvmorg-12.0.0-0-gd28af7c654d8, a.k.a. 12.0.0 release.

PR:		255570

(cherry picked from commit d409305fa3)

Disable strict-fp for powerpcspe, as it does not work properly yet

Merge commit 5c18d1136665 from llvm git (by Qiu Chaofan)

  [SPE] Disable strict-fp for SPE by default

  As discussed in PR50385, strict-fp on PowerPC SPE has not been
  handled well. This patch disables it by default for SPE.

  Reviewed By: nemanjai, vit9696, jhibbits

  Differential Revision: https://reviews.llvm.org/D103235

PR:		255570

(cherry picked from commit 715df83abc)

Apply upstream libc++ fix to allow building with devel/xxx-xtoolchain-gcc

Merge commit 52e9d80d5db2 from llvm git (by Jason Liu):

  [libc++] add `inline` for __open's definition in ifstream and ofstream

  Summary:

  When building with gcc on AIX, it seems that gcc does not like the
  `always_inline` without the `inline` keyword.
  So adding the inline keywords in for __open in ifstream and ofstream.
  That will also make it consistent with __open in basic_filebuf
  (it seems we added `inline` there before for gcc build as well).

  Differential Revision: https://reviews.llvm.org/D99422

PR:		255570

(cherry picked from commit d099db2546)

Undefine HAVE_(DE)REGISTER_FRAME in llvm's config.h on arm

Otherwise, the lli tool (enable by WITH_CLANG_EXTRAS) won't link on arm,
stating that __register_frame is undefined. This function is normally
provided by libunwind, but explicitly not for the ARM Exception ABI.

Reported by:	oh
PR:		255570

(cherry picked from commit f336b45e94)

Merge llvm-project 12.0.1 rc2

This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvmorg-12.0.1-rc2-0-ge7dac564cd0e, a.k.a. 12.0.1 rc2.

PR:		255570

(cherry picked from commit 23408297fb)

Revert libunwind change to fix backtrace segfault on aarch64

Revert commit 22b615a96593 from llvm git (by Daniel Kiss):

  [libunwind] Support for leaf function unwinding.

  Unwinding leaf function is useful in cases when the backtrace finds a
  leaf function for example when it caused a signal.
  This patch also add the support for the DW_CFA_undefined because it marks
  the end of the frames.

  Ryan Prichard provided code for the tests.

  Reviewed By: #libunwind, mstorsjo

  Differential Revision: https://reviews.llvm.org/D83573

  Reland with limit the test to the x86_64-linux target.

Bisection has shown that this particular upstream commit causes programs
using backtrace(3) on aarch64 to segfault. This affects the lang/rust
port, for instance. Until we can upstream to fix this problem, revert
the commit for now.

Reported by:	mikael
PR:		256864

(cherry picked from commit 5866c369e4)

Merge llvm-project 12.0.1 release

This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvmorg-12.0.1-0-gfed41342a82f, a.k.a. 12.0.1 release.

PR:		255570

(cherry picked from commit 4652422eb4)

compilert-rt: build out-of-line LSE atomics helpers for aarch64

Both clang >= 12 and gcc >= 10.1 now default to -moutline-atomics for
aarch64. This requires a bunch of helper functions in libcompiler_rt.a,
to avoid link errors like "undefined symbol: __aarch64_ldadd8_acq_rel".

(Note: of course you can use -mno-outline-atomics as a workaround too,
but this would negate the potential performance benefit of the faster
LSE instructions.)

Bump __FreeBSD_version so ports maintainers can easily detect this.

PR:		257392

(cherry picked from commit cc55ee8009)
2021-07-31 20:56:55 +02:00
Li-Wen Hsu
f4e3cb4b6b
freebsd-tips: Use a fetchable URL as example
MFC after:	3 days

(cherry picked from commit ffe6afc4f0)

freebsd-tips: Fix the description of fetch(1) to match the command

Reported by:	jrtc27
MFC with:	ffe6afc4f0

(cherry picked from commit 1678975109)
2021-07-28 03:24:51 +08:00
Warner Losh
666abb0888 one-true-awk: import 20210221 (1e4bc42c53a1) which fixes a number of bugs
Import the latest bsd-features branch of the one-true-awk upstream:

o Move to bison for $YACC
o Set close-on-exec flag for file and pipe redirects that aren't std*
o lots of little fixes to modernize ocde base
o free sval member before setting it
o fix a bug where a{0,3} could match aaaa
o pull in systime and strftime from NetBSD awk
o pull in fixes from {Net,Free,Open}BSD (normalized our code with them)
o add BSD extensions and, or, xor, compl, lsheift, rshift (mostly a nop)

Also revert a few of the trivial FreeBSD changes that were done slightly
differently in the upstreaming process. Also, our PR database may have
been mined by upstream for these fixes, and Mikolaj Golub may deserve
credit for some of the fixes in this update.

Suggested by:		Mikolaj Golub <to.my.trociny@gmail.com>
PR:			143363, 143365, 143368, 143369, 143373, 143375, 214783
Sponsored by:		Netflix

(cherry picked from commit f39dd6a978)
2021-07-10 11:07:26 -06:00
Alex Richardson
6e2b0498aa truss: minor cleanup and pedantic warning fixes
Noticed while porting the recent truss compat32 changes to CheriBSD.
This also fixes i386 tracing by zero-extending user addresses instead
of sign-extending them.

Reviewed By:	jhb
MFC after:	3 days
Differential Revision: https://reviews.freebsd.org/D30211

(cherry picked from commit 31dddc6a19)
2021-07-05 10:46:12 +01:00
Alex Richardson
ed1563aba9 truss: fix handling of 64-bit arguments/return values for compat32
Deciding whether to combine two values to a 64-bit one should be based on
the process ABI, and not dependent on whether truss is compiled for an
LP64 ABI. This is a follow-up cleanup for D27625. I found this while
looking for uses of the `__LP64__` macro (since using this is wrong for
CHERI systems).

Test Plan: truss still works. Since I tested on AMD64 and all syscalls
in the trace have their quad argument last there was no difference
in the output. Should fix output for compat32 on MIPS64 though.

Reviewed By:	jhb
MFC after:	3 days
Differential Revision: https://reviews.freebsd.org/D27637

(cherry picked from commit 8ba2e89e98)
2021-07-05 10:46:12 +01:00
Alex Richardson
5694f4af79 kdump: use VIS_NOLOCALE when printing output
Attempting to parse the output as UTF-8 exposed an out-of-bounds read
in vis(3) (see https://reviews.freebsd.org/D30771). However, I don't
think it makes much sense to decode this output at all. Additionally,
passing one byte at a time will almost certainly result in incorrect
output for multi-byte characters.

Reviewed By:	brooks
MFC after:	3 days
Differential Revision: https://reviews.freebsd.org/D30772

(cherry picked from commit 1a3a57d745)
2021-07-05 10:46:11 +01:00
Alan Somers
bc997ea6b8 id: sanitize arguments better
The -[AMc] flags ignore the user argument.  Better if id rejects
invocations that include a user argument along with any of those flags.

PR:		256554
Reviewed by:	trasz
Sponsored by:	Axcient
Differential Revision: https://reviews.freebsd.org/D30734

(cherry picked from commit 4a06e93773)
2021-07-03 17:29:41 -06:00
Emmanuel Vadot
624d52af5b pkgbase: Create a FreeBSD-nfs package
And move all the nfs related commands there.

Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D30754
Sponsored by:	Diablotin Systems
2021-06-30 09:24:32 +02:00
Jose Luis Duran
47722575d9 mkimg: Add fat32lba partition type
Syntactic sugar for a `gpart add -t '!12' ...` equivalent.

Reviewed by:	emaste
Pull Request:	https://github.com/freebsd/freebsd-src/pull/484

(cherry picked from commit d98a4eb807)
2021-06-29 10:02:11 -04:00
Andrew Turner
a0dd2317e8 Use if ... else when printing memory attributes
In vmstat there is a switch statement that converts these attributes to
a string. As some values can be duplicate we have to hide these from
userspace.

Replace this switch statement with an if ... else macro that lets us
repeat values without a compiler error.

Reviewed by:	kib
MFC after:	2 weeks
Sponsored by:	ABT Systems Ltd
Differential Revision:	https://reviews.freebsd.org/D29703

(cherry picked from commit 15221c552b)
2021-06-12 02:21:12 +01:00
Michael Tuexen
fa50e98328 mend 2021-06-07 11:01:28 +02:00
Ed Maste
5ceb90aa66 elfctl: avoid touching file if no change made
Suggested by:	brooks
Reviewed by:	brooks, markj
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D30452

(cherry picked from commit 3f2508b7f3)
2021-06-01 22:08:54 -04:00
Mark Johnston
b98b323813 sort: Hook NetBSD tests up to the build
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 186ba88a7c)
2021-05-20 09:15:49 -04:00
Cyril Zhang
df40dcbf7c sort: Cache value of MB_CUR_MAX
Every usage of MB_CUR_MAX results in a call to __mb_cur_max.  This is
inefficient and redundant.  Caching the value of MB_CUR_MAX in a global
variable removes these calls and speeds up the runtime of sort.  For
numeric sorting, runtime is almost halved in some tests.

PR:		255551
PR:		255840
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D30170

(cherry picked from commit 71ec05a212)
2021-05-20 09:15:43 -04:00
Cyril Zhang
f80d1c0035 sort: Stop "fixing" obsolete key syntax after -- flag
PR:		255798
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D30234

(cherry picked from commit fa43162c63)
2021-05-20 09:15:40 -04:00
Mark Johnston
8aed0580e4 truss: Decode FreeBSD 11 mknod(2) and mknodat(2)
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit cd497bd40b)
2021-05-19 09:32:40 -04:00
Kirk McKusick
daa020139f Clean up copyright messages.
(cherry picked from commit 9e16b9530a)
2021-05-16 23:09:42 -07:00
Ceri Davies
3f5f4078b3 find(1): Document the -f option
PR:	223127
Reported by:	Mathieu Arnold <mat at FreeBSD dot org>
Reviewed by:	bcr, gbe
Differential Revision:	https://reviews.freebsd.org/D30215

(cherry picked from commit 82483ea7ad)
2021-05-16 10:36:53 +02:00
Xin LI
5a485392c4 usr.bin/patch: remove unneeded header.
(cherry picked from commit 9769f6f808)
2021-05-15 21:40:41 -07:00
Xin LI
34dad5e914 usr.bin/netstat: use roundup2 when rounding up to power of 2.
(cherry picked from commit f6b6d216ca)
2021-05-15 21:40:23 -07:00
Alex Richardson
0d0eb707b4 truss: Add missing underscore to compat_prefix for FreeBSD32
I accidentally dropped this in the final version of D27625, so it didn't
actually work as intended. I found this while testing the MFC to stable/13.

MFC after:	immediately
Fixes:		7daca4e204 ("truss: improved support for decoding compat32 arguments")

(cherry picked from commit 3cbad8287a)
2021-05-11 10:54:06 +01:00
Alex Richardson
7736adb5e6 usr.bin/lex: regenerate bootstrap files after d37f81e35b
Reviewed by:	jkim

(cherry picked from commit c6e66cbfbb)
2021-05-11 09:39:30 +01:00
Alex Richardson
46c255b632 truss: improved support for decoding compat32 arguments
Currently running `truss -a -e` does not decode any
argument values for freebsd32_* syscalls (open/readlink/etc.)

This change checks whether a syscall starts with freebsd{32,64}_ and if
so strips that prefix when looking up the syscall information. To ensure
that the truss logs include the real syscall name we create a copy of
the syscall information struct with the updated.

The other problem is that when reading string array values, truss
naively iterates over an array of char* and fetches the pointer value.
This will result in arguments not being loaded if the pointer is not
aligned to sizeof(void*), which can happens in the compat32 case. If it
happens to be aligned, we would end up printing every other value.
To fix this problem, this changes adds a pointer_size member to the
procabi struct and uses that to correctly read indirect arguments
as 64/32 bit addresses in the the compat32 case (and also compat64 on
CheriBSD).

The motivating use-case for this change is using truss for 64-bit
programs on a CHERI system, but most of the diff also applies to 32-bit
compat on a 64-bit system, so I'm upstreaming this instead of keeping it
as a local CheriBSD patch.

Output of `truss -aef ldd32 /usr/bin/ldd32` before:
39113: freebsd32_mmap(0x0,0x1000,0x3,0x1002,0xffffffff,0x0,0x0) = 543440896 (0x20644000)
39113: freebsd32_ioctl(0x1,0x402c7413,0xffffd2a0) = 0 (0x0)
/usr/bin/ldd32:
39113: write(1,"/usr/bin/ldd32:\n",16)		 = 16 (0x10)
39113: fork()					 = 39114 (0x98ca)
39114: <new process>
39114: freebsd32_execve(0xffffd97e,0xffffd680,0x20634000) EJUSTRETURN
39114: freebsd32_mmap(0x0,0x20000,0x3,0x1002,0xffffffff,0x0,0x0) = 541237248 (0x2042a000)
39114: freebsd32_mprotect(0x20427000,0x1000,0x1) = 0 (0x0)
39114: issetugid()				 = 0 (0x0)
39114: openat(AT_FDCWD,"/etc/libmap32.conf",O_RDONLY|O_CLOEXEC,00) ERR#2 'No such file or directory'
39114: openat(AT_FDCWD,"/var/run/ld-elf32.so.hints",O_RDONLY|O_CLOEXEC,00) = 3 (0x3)
39114: read(3,"Ehnt\^A\0\0\0\M^@\0\0\0#\0\0\0\0"...,128) = 128 (0x80)
39114: freebsd32_fstat(0x3,0xffffbd98)		 = 0 (0x0)
39114: freebsd32_pread(0x3,0x2042f000,0x23,0x80,0x0) = 35 (0x23)
39114: close(3)					 = 0 (0x0)
39114: openat(AT_FDCWD,"/usr/lib32/libc.so.7",O_RDONLY|O_CLOEXEC|O_VERIFY,00) = 3 (0x3)
39114: freebsd32_fstat(0x3,0xffffc7d0)		 = 0 (0x0)
39114: freebsd32_mmap(0x0,0x1000,0x1,0x40002,0x3,0x0,0x0) = 541368320 (0x2044a000)

After:
  783: freebsd32_mmap(0x0,4096,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANON|MAP_ALIGNED(12),-1,0x0) = 543543296 (0x2065d000)
  783: freebsd32_ioctl(1,TIOCGETA,0xffffd7b0)    = 0 (0x0)
/usr/bin/ldd32:
  783: write(1,"/usr/bin/ldd32:\n",16)           = 16 (0x10)
  784: <new process>
  783: fork()                                    = 784 (0x310)
  784: freebsd32_execve("/usr/bin/ldd32",[ "(null)" ],[ "LD_32_TRACE_LOADED_OBJECTS_PROGNAME=/usr/bin/ldd32", "LD_TRACE_LOADED_OBJECTS_PROGNAME=/usr/bin/ldd32", "LD_32_TRACE_LOADED_OBJECTS=yes", "LD_TRACE_LOADED_OBJECTS=yes", "USER=root", "LOGNAME=root", "HOME=/root", "SHELL=/bin/csh", "BLOCKSIZE=K", "MAIL=/var/mail/root", "MM_CHARSET=UTF-8", "LANG=C.UTF-8", "PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/root/bin", "TERM=vt100", "HOSTTYPE=FreeBSD", "VENDOR=amd", "OSTYPE=FreeBSD", "MACHTYPE=x86_64", "SHLVL=1", "PWD=/root", "GROUP=wheel", "HOST=freebsd-amd64", "EDITOR=vi", "PAGER=less" ]) EJUSTRETURN
  784: freebsd32_mmap(0x0,135168,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANON,-1,0x0) = 541212672 (0x20424000)
  784: freebsd32_mprotect(0x20421000,4096,PROT_READ) = 0 (0x0)
  784: issetugid()                               = 0 (0x0)
  784: sigfastblock(0x1,0x204234fc)              = 0 (0x0)
  784: open("/etc/libmap32.conf",O_RDONLY|O_CLOEXEC,00) ERR#2 'No such file or directory'
  784: open("/var/run/ld-elf32.so.hints",O_RDONLY|O_CLOEXEC,00) = 3 (0x3)
  784: read(3,"Ehnt\^A\0\0\0\M^@\0\0\0\v\0\0\0"...,128) = 128 (0x80)
  784: freebsd32_fstat(3,{ mode=-r--r--r-- ,inode=18680,size=32768,blksize=0 }) = 0 (0x0)
  784: freebsd32_pread(3,"/usr/lib32\0",11,0x80) = 11 (0xb)

Reviewed By:	jhb
Differential Revision: https://reviews.freebsd.org/D27625

(cherry picked from commit 7daca4e204)
2021-05-11 09:39:24 +01:00
Alex Richardson
eec6f94ea5 truss: split counting of syscalls and syscall calling convention
This change is a refactoring cleanup to improve support for compat32
syscalls (and compat64 on CHERI systems). Each process ABI now has it's
own struct sycall instead of using one global list. The list of all
syscalls is replaced with a list of seen syscalls. Looking up the syscall
argument passing convention now interates over the fixed-size array instead
of using a link-list that's populated on startup so we no longer need the
init_syscall() function.
The actual functional changes are in D27625.

Reviewed By:	jhb
Differential Revision: https://reviews.freebsd.org/D27636

(cherry picked from commit 6019514b0b)
2021-05-11 09:39:23 +01:00