Commit Graph

16889 Commits

Author SHA1 Message Date
rillig 449d1217ca tests/lint: add test for prototype conversions in C90
The purpose of warning 259 is to find function calls that differ in the
ABI.  The warning's original purpose was not to warn about lossy
conversions, that's just a side effect.

Warning 259 had been implemented before C99 was published, which is more
than 20 years ago.  In the meantime, almost all code has migrated to
using function prototypes.  With the default lint flags from NetBSD's
<sys.mk>, it would rather make sense to focus on lossy conversions now.

To prepare for potentially upcoming differences in lint's C90 and C99
modes, clone the test now as far as possible.  The test for C90 mode is
smaller than for C99 mode, since 'long long' was not available back
then.
2021-08-31 18:59:26 +00:00
rillig 16fe11c78d tests/make: explain where "${var}" in .for loops comes from 2021-08-30 17:08:13 +00:00
christos 2557380693 Inetd enhancements by James Browning, Gabe Coffland, Alex Gavin, Solomon Ritzow
Described in:
    https://www.mail-archive.com/tech-userlevel@netbsd.org/msg03114.html
And developed in:
    https://github.com/ritzow/src/pull/1

From their notes:

All new functionality should be explained by the updated manpage.

The manpage has been refactored a bit: A new section "Directives"
has been added and the information about default hostnames and
IPsec directives has been moved there, and the new file include
directive information is also there.

getconfigent has the most major changes. A newline is no longer
read immediately, but is called only by a "goto more" (inside an
if(false) block). This allows multiple definitions or directives
to exist on a single line for anything that doesn't terminate using
a newline. This means a key-values service definition can be followed
by another key-values service definition, a positional definition,
or an ipsec, hostname, or .include directive on the same line.

memset is no longer used explicitly to clear the servtab structure,
a function init_servtab() is used instead, which uses a C struct
initializer.

The servtab se_group field is its own allocation now, and not just
a pointer into the user:group string.

Refactored some stuff out of getconfigent to separate functions
for use by parse_v2.c. These functions in inetd.c are named with
the form parse_*()

parse_v2.c only has code for parsing a key-values service definition
into a provided servtab. It should not have anything that affects
global state other than line and line_number.

Some function prototypes, structures, and #defines have been moved
from inetd.c to inetd.h.

The function config_root replaces config as the function called on
a config file load/reload. The code removed from the end of
config(void) is now called in config_root, so it is not run on each
recursive config call.

setconfig(void) was removed and its code added into config_root
because that is the only place it is called, and redundant checks
for non-null globals were removed because they are always freed by
endconfig. The fseek code was also removed because the config files
are always closed by endconfig.

Rate limiting code was updated to add a per-service per-IP rate
limiting form. Some of that code was refactored out of other places
into functions with names in the form rl_*()

We have not added any of the license or version information to the
new files parse_v2.c, parse_v2.h, and inetd.h and we have not
updated the license or version info for inetd.c.

Security related:

The behavior when reading invalid IPsec strings has changed. Inetd
no longer exits, it quits reading the current config file instead.
Could this impact program security?

We have not checked for memory leaks. Solomon tried to use dmalloc
without success. getconfigent seemed to have a memory leak at each
"goto more". It seems like inetd has never free'd allocated strings
when throwing away erroneous service definitions during parsing
(i.e. when "goto more" is called when parsing fields). OpenBSD's
version calls freeconfig on "goto more"
(c5eae130d6/usr.sbin/inetd/inetd.c (L1049))
but NetBSD only calls it when service definitions are no longer
needed. This has been fixed. freeconfig is called immediately before
any "goto more". There shouldn't be any time when a servtab is in
an invalid state where freeconfig would break.
2021-08-29 09:54:18 +00:00
rillig 250e4c656b tests/lint: demonstrate hashcode sorting of the lint2 output
The hashcodes modulo 1009 are:

 48 func7000
637 func0000
646 no_prototype
697 func1000
757 func2000
817 func3000
877 func4000
937 func5000
997 func6000
2021-08-28 19:45:18 +00:00
rillig 92de156f15 tests/lint: test conversion from long long to intptr_t on ilp32
Seen in usr.bin/make/var.c:1608.
2021-08-25 22:04:51 +00:00
rillig 72e092a39a lint: allow libraries to use 128-bit integer types 2021-08-24 21:30:52 +00:00
rillig 3238e49756 tests/lint2: reduce indentation for mi files 2021-08-24 20:23:38 +00:00
mrg a9e928488d glu_mangle.h is obsolete now. 2021-08-24 00:12:32 +00:00
mrg 1572c22b0c amdgpu_drv.so got bumped. 2021-08-23 23:08:50 +00:00
rillig 3065c1c35d tests/lint: demonstrate wrong constant folding in strict bool mode
Found while investigating wrong constant folding in default mode.
2021-08-22 20:56:51 +00:00
rillig 59e08a43b7 tests/lint: test folding of constant expressions
Since November 2001, there is a comment above the function 'fold' that
suggests there are a few bugs concerning overflow detection.  Add some
first 'proper regression tests' to prove these bugs.
2021-08-19 20:32:33 +00:00
christos 304373e615 bump bind libraries for bind 9.16.20 2021-08-19 11:53:02 +00:00
mrg e92fa7ec4e install amdgpu.ids. 2021-08-19 09:05:22 +00:00
christos 9399dd9e94 don't mark sodium as solaris 2021-08-19 05:09:24 +00:00
christos 86ec36b1ea modules for if_wg, blake2s, libsodium 2021-08-17 17:31:58 +00:00
rillig 653c9ff116 tests/lint: test arithmetic promotions and enums 2021-08-16 20:11:03 +00:00
mrg 22cfb1f2ea install experimental/* and ext/opt_random.h. they're expected to
be there (and the latter was removed by accident.)

regen for everyone (also picks up missing tgmath.h for many ports.)

fixes build of pkgsrc/databases/mongodb for me.
2021-08-16 06:56:20 +00:00
christos c6390902f2 bump ldap libraries 2021-08-14 16:18:32 +00:00
martin 395ca384d5 add directory for debug data for mkdep tests 2021-08-12 15:06:39 +00:00
martin dcbf5445d1 h_findcc.debug is not obsolete 2021-08-12 13:27:42 +00:00
martin e7d4773f7a oops, fix h_findcc entry 2021-08-12 12:51:25 +00:00
martin 462143732b Add new mkdep test helper h_findcc 2021-08-12 11:57:07 +00:00
rillig e91fe367ea tests/mkdep: test findcc
This function is used by both mkdep and lint.
2021-08-11 20:42:26 +00:00
rillig 9cea3ffa32 lint: warn about 'char * = strchr(const char *, int)'
Found in findcc.c, there are about 25 other instances of this
incongruency in the whole source tree.

For more examples of functions from the C Standard Library that
implicitly remove the 'const' qualifier from an argument, see the C++
include file 'cstring'.
2021-08-09 20:07:23 +00:00
andvar 32a556f954 fix various typos in comments and messages. 2021-08-09 19:24:32 +00:00
rillig 00782fec55 tests/lint: make list of tests simpler
Since the file /usr/tests/usr.bin/xlint/lint2/tests has only been in the
file set for a few minutes, it is not marked as obsolete but simply
removed.
2021-08-08 00:02:02 +00:00
rillig 0d9d928d83 tests/lint: test reading of 128-bit integer types and printf 2021-08-07 23:52:32 +00:00
rillig 9a9312cf60 tests/lint: add test for reading the lint1 output 2021-08-07 21:24:13 +00:00
martin fb69eb3d0e Fix copy+pasto (wrong dir for t_lint2) 2021-08-06 08:44:31 +00:00
rillig 2e1c5b53fe tests/lint: add test skeletons for messages from lint2 2021-08-05 22:36:07 +00:00
rillig 827aba3693 tests/lint: test emitting 128-bit integer types for lint2 2021-08-05 06:34:42 +00:00
rillig a88eea7df9 tests/lint: test GCC extension for casting to union type 2021-08-03 20:34:23 +00:00
rillig e4a7be9ba1 tests/lint: test casting a struct to another struct 2021-08-03 18:03:54 +00:00
andvar cba4208ca7 add pcib(4), pceb(4), pcmb(4).
pcmb is a separate man page for i386 only, pceb and pcib are references to pci(4) only and mentioned in its bridges section.
ok riastradh
2021-08-01 21:56:26 +00:00
rillig c8782a7cbc tests/lint: test the usual arithmetic conversions in traditional C 2021-08-01 16:29:28 +00:00
rillig 5489342aeb tests/lint: test the usual arithmetic conversions
The function 'balance' does not mention __uint128_t and nevertheless
works as expected.  Need to investigate further.
2021-08-01 13:31:48 +00:00
rillig c790f31b75 tests/make: split tests for the variable modifier ':O'
The tests for parse errors are now in varmod-order, which lets the other
tests focus on the desired behavior of the modifiers.
2021-07-31 20:55:45 +00:00
rillig d7db1322e4 tests/make: register test varmod-order-numeric 2021-07-30 21:29:00 +00:00
rillig a3535e9c45 tests/lint: cover every code line in the grammar 2021-07-25 22:03:42 +00:00
rillig b51ebfa06f tests/lint: test declarators with attributes 2021-07-25 17:27:07 +00:00
rillig 8c0cb28db5 tests/lint: demonstrate missing support for GCC typeof 2021-07-25 10:57:38 +00:00
rillig f450420d6f tests/lint: test parse errors in statements
These errors are really unrealistic.  Most parse errors that occur in
statements are already handled elsewhere and continue with the next
semicolon.

The tests had to be split into two separate files because lint assumes
that after the 5th parse error, it does not make sense to continue this
translation unit.
2021-07-25 09:29:20 +00:00
rillig 6201c2aa16 tests/lint: test parsing of type_name 2021-07-25 08:42:28 +00:00
nia 92e19c2b10 Add a man page for amdccp(4) 2021-07-25 07:35:55 +00:00
jmcneill dd061977e6 amd64: liveimage: use RC_CONF_EXTRA instead of rc.conf.d 2021-07-24 16:13:44 +00:00
jmcneill 9764bcee56 evbarm: liveimage: use RC_CONF_EXTRA instead of rc.conf.d 2021-07-24 14:00:08 +00:00
jmcneill e5de8b183d bootimage: allow appending additional rc.conf options
If RC_CONF_EXTRA is defined, append the contents of this file to the
target file-system's rc.conf
2021-07-24 13:59:28 +00:00
jmcneill bbc876812d evbarm: Add build.sh live-image support for armv7/aarch64 2021-07-23 21:53:33 +00:00
mrg 5bb478fc82 fix typo in unused obsolete set name. noted by tnn. 2021-07-22 21:49:44 +00:00
rhialto ad4e58736d Extract just the random bits to feed to /dev/urandom.
This makes no difference in the randomness of the pool, but it improves
on the estimation (if any) of how many random bits were obtained.
Also make the ftp -q time out a bit longer since I got some time outs.
2021-07-20 19:31:23 +00:00