Commit Graph

288507 Commits

Author SHA1 Message Date
skrll 62c15f605f Revert previous. Apparently it's wrong. 2021-06-30 06:24:02 +00:00
rin c1d0bd11b7 Fix previous. For Thumb-1:
- sp cannot be manipulated directly
- {add,sub}s should be used instead of {add,sub}
2021-06-30 00:00:49 +00:00
rin 2251279c7d Align sp to 8-byte boundary as required by EABI.
IIUC, this change only affects libc compiled for ``Thumb-mode userland'',
which we've not officially supported yet.
2021-06-29 23:29:12 +00:00
rin 85e8b7f881 Align sp to 8-byte boundary as required by EABI.
This is especially important for non-leaf functions; GCC optimizes codes
based on assumption that sp is aligned properly.

Mostly fix broken earmv5 userland compiled by GCC10 due to alignment
faults in ld.elf_so, where {ld,st}rd are used for [sp, #8x].

No regression for ATF is observed for earmv[67]{,hf}{,eb}.
2021-06-29 23:26:00 +00:00
dholland 723d09ce8e Add containment for the cloning devices hack in vn_open.
Cloning devices (and also things like /dev/stderr) work by allocating
a struct file, stuffing it in the file table (which is a layer
violation), stuffing the file descriptor number for it in a magic
field of struct lwp (which is gross), and then "failing" with one of
two magic errnos, EDUPFD or EMOVEFD.

Before this commit, all callers of vn_open in the kernel (there are
quite a few) were expected to check for these errors and handle the
situation. Needless to say, none of them except for open() itself did,
resulting in internal negative errnos being returned to userspace.

This hack is fairly deeply rooted and cannot be eliminated all at
once. This commit adds logic to handle the magic errnos inside
vn_open; now on success vn_open returns either a vnode or an integer
file descriptor, along with a flag that says whether the underlying
code requested EDUPFD or EMOVEFD. Callers not prepared to cope with
file descriptors can pass NULL for the extra return values, in which
case if a file descriptor would be produced vn_open fails with
EOPNOTSUPP.

Since I'm rearranging vn_open's signature anyway, stop exposing struct
nameidata. Instead, take three arguments: an optional vnode to use as
the starting point (like openat()), the path, and additional namei
flags to use, restricted to NOCHROOT and TRYEMULROOT. (Other namei
behavior, e.g. NOFOLLOW, can be requested via the open flags.)

This change requires a kernel bump. Ride the one an hour ago.
(That was supposed to be coordinated; did not intend to let an hour
slip by. My fault.)
2021-06-29 22:40:53 +00:00
dholland a132dee94d Regen. 2021-06-29 22:40:06 +00:00
dholland d9be54cead Now remove cn_consume from struct componentname.
This change requires a kernel bump.

Note though that I'm not going to version the VOP_LOOKUP args
structure (or any other args structure) as code that doesn't touch
cn_consume doesn't need attention and code that does will fail on it
without further intervention.
2021-06-29 22:39:20 +00:00
dholland a52da473da Onionfs needs to know about parsepath too, in case it has one of the
other cases underneath it.

The solution here is not really very good (take the longer
path-to-consume if they're different) but it will serve for the cases
that exist.

(If we were to add a fs that really uses different naming semantics,
we'd have to take additional steps; probably it doesn't make sense to
allow unionfs to union such a thing with a normal fs and attempting it
should fail at mount time.)

Update fs/unionfs as well to avoid increasing the current set of
compile failures there. Though maybe it's time to just remove
fs/unionfs.
2021-06-29 22:38:46 +00:00
dholland 3fcd0dc6cc Add parsepath for rumpfs in place of using cn_consume. 2021-06-29 22:38:10 +00:00
dholland b7b49fc54d Implement VOP_PARSEPATH() for hfs.
This checks for a following "/rsrc" at the end of the pathname (to
indicate the resource fork of a file) and assimilates it into the
component name to be looked up. Then cn_namelen will already include
this text in lookup, and it's no longer necessary to muck with
cn_consume.

Invalid uses of "/rsrc" are ignored rather than rejected, which
appears to be the same as the old behavior. It is possible that the
parsepath logic should only consume the "/rsrc" if the name names a
file and not a directory, which would require looking it up in
parsepath and be a general nuisance; I hope not. It's also possible
that the whole thing doesn't work at all now, or it didn't before, as
I don't have any way to test it.
2021-06-29 22:37:50 +00:00
dholland 0c749716e7 Regen. 2021-06-29 22:37:11 +00:00
dholland c6c16cd073 - Add a new vnode op: VOP_PARSEPATH.
- Move namei_getcomponent to genfs_vnops.c and call it genfs_parsepath.
 - Add a parsepath entry to every vnode ops table.

VOP_PARSEPATH takes a directory vnode to be searched and a complete
following path and chooses how much of that path to consume. To begin
with, all parsepath calls are genfs_parsepath, which locates the first
'/' as always.

Note that the call doesn't take the whole struct componentname, only
the string. The other bits of struct componentname should not be
needed and there's no reason to cause potential complications by
exposing them.
2021-06-29 22:34:05 +00:00
dholland 71f852eb68 Adjust namei internals to be able to make an external call to parse
the pathname. (Basically, this means change the signature of
namei_getcomponent(), and thus lookup_parsepath(), to pass in the
directory vnode and to allow failures.)
2021-06-29 22:29:59 +00:00
rillig 95d33e8c9b lint: fix wrong warning about out-of-range value '\xff' for char
This only affects platforms where char has the same representation as
unsigned char.
2021-06-29 21:33:08 +00:00
riastradh 731d783606 Make if_stats_init, if_attach, if_initialize return void.
percpu_alloc can't fail.


Author: Maya Rashish <maya@NetBSD.org>
Committer: Taylor R Campbell <riastradh@NetBSD.org>
2021-06-29 21:19:58 +00:00
rillig f2ec522ec7 lint: rename xsign to convert_integer
The term sign-extend was too specific, the function actually does a
broader conversion.

No functional change.
2021-06-29 21:16:54 +00:00
rillig 1b367b1b6c lint: do not modify tnode_t->tn_type in check_init_expr
This is a very small step towards having all shared type_t objects only
referenced via const pointers.  Since the types may be shared, it is a
bad idea to try to modify them, so better let the compiler check this.
It's a long way to reach this goal, but this small step is already
possible.

No functional change.
2021-06-29 21:05:32 +00:00
pgoyette b6ad7b596e Regen for new sys/dev/devlist2h.awk 2021-06-29 21:04:02 +00:00
pgoyette 74007e33ee Rework the xxxVERBOSE option to share the common module-hook-based
verbose mechanism with MIIVERBOSE.  This reduces some duplicated code
and allows us to once again permit auto-unload of MIIVERBOSE.

Change details:
* Update dev/devlist2h.awk to accomodate miidevs, including generation
  of MII_STR_oui_model definitions and use of oui and model rather than
  vendor and product.  This also changes the compressed data in the
  xxxdevs_data.h files to uint32_t (since mii oui's are up to 6 hex
  digits long)
* Update a couple of phy drivers to use new calls to get verbose data
* Regen all of the xxxdevs{,_data}.h files (separate commit, coming
  very soon)
* Update mii/mii_verbose.[ch] and mii/mii_physubr.c to use the various
  DEV_VERBOSE_xxx macros
* Update the pci, usb, and hdaudio code as needed, to #include the
  xxxdevs.h files (in order to get the proper printf format strings)
* Since dev/dev_verbose.c now uses non-literal printf format strings,
  (to deal with the vendor/product vs oui/model issue), we need to
  make sure it gets compiled with -Wno-error=format-nonliteral, even
  in userland's libpci and librumpdev!
* Bump kernel version for the change in module interfaces

Welcome to 9.99.86!

XXX It might be useful in the future to extend the MII_STR_oui_model
XXX definitions to PCI as well (and perhaps USB and HDAUDIO).  This
XXX would allow for a single centralized location for the products'
XXX descriptions, rather than being dispersed among individual
XXX drivers' xxx_match tables.
2021-06-29 21:03:36 +00:00
rillig 465b0b6319 lint: do not sign-extend pointers
Sign extension only makes sense for integer types.

No idea why the code had tried to sign-extend pointers for the past 26
years.
2021-06-29 20:44:38 +00:00
rillig 1abf4d0075 lint: document where to fix the wrong warning for '\xff' 2021-06-29 14:19:51 +00:00
rillig b468abca3b tests/lint: add test that only runs where char == unsigned char
There a 4 regular NetBSD builds where lint is activated.  All these
builds run on platforms where char == signed char.

The official test runs from https://releng.netbsd.org/test-results.html
mostly have char == signed char as well.

However, lint behaves differently on platforms with char == unsigned
char.  On these platforms, a simple "char ch = '\xff'" leads to the
bogus warning that "conversion of 'int' to 'char' is out of range".
2021-06-29 13:58:13 +00:00
rillig 1ae8e740dd lint: clean up lex_character_constant
No functional change.
2021-06-29 13:48:24 +00:00
rin 49ff1b7115 KERNEL_BASE is 0xc0000000 for HDL_G.
With this change, HDL-G boots multiuser!
2021-06-29 11:35:28 +00:00
nia 9d462d16a8 doc: removed uscanner 2021-06-29 10:26:17 +00:00
wiz e58f3f6928 Remove unnecessary Pp, fix formatting, remove empty line. 2021-06-29 10:26:00 +00:00
wiz ee7020df38 Fix date. 2021-06-29 10:25:33 +00:00
nia 3b7d57661a mark urio/uscanner device majors obsolete 2021-06-29 10:24:41 +00:00
nia f3c68eb2b0 Remove uscanner(4) driver
This exists for compatibility with a Linux interface which was apparently
deprecated in Linux 2.6. There are various mailing list threads going
back to 2004 where the usefulness of this driver is discussed, but
the conclusion is that scanner software has all moved to using ugen(4)
instead, and enabling this driver will not help you scan things.
2021-06-29 10:22:33 +00:00
rillig 27cb0a7146 lint: fix typos in comment 2021-06-29 10:12:35 +00:00
cjep 47c30ebc16 Note OpenBSD cross-build progress 2021-06-29 10:02:34 +00:00
rillig 02832e2456 tests/lint: add 'make accept' to update the expected output 2021-06-29 09:44:25 +00:00
rillig b7cb676ee4 tests/lint: add tests for ILP32 platforms
Previously, all tests for lint had to produce the exact same output, no
matter which platform they ran on.  This differs from practical needs
since lint is intended to produce different results depending on whether
the platform is ILP32 or LP64.

Examples for these are type conversions and the widths of the integer
types during lexical analysis.
2021-06-29 09:19:17 +00:00
cjep 0c942b0abf PR toolchain/56180. Additional to yesterday's commit in gcc, also needed in
gcc.old. Add configuration so that gcc can find the LTO plugin when
cross-building NetBSD from OpenBSD hosts.
2021-06-29 08:51:03 +00:00
rillig 3df3cc9cd8 tests/lint: allow tests to be skipped depending on platform properties 2021-06-29 08:46:10 +00:00
cjep ae35b2c1fe 1. Rework the IFS handling when checking consistency of formatting in
sysinst messages. Closes PR toolchain/56181.
2. Whilst here, change some shell clauses to be more portable.

Patch developed by kre. Also reviewed by martin. Cross-builds tested
on NetBSD, OpenBSD, FreeBSD and Darwin.
2021-06-29 08:02:50 +00:00
rillig bd046308c8 tests/lint: do not modify t_integration on "make add-test"
The test names are no longer listed individually.
2021-06-29 07:37:34 +00:00
rillig aed8aa9f4e tests/lint: add test for character constant using backslash-newline 2021-06-29 07:28:01 +00:00
rillig 48c9c61aae lint: fix lexical analysis of character constants in traditional C
The code now follows the wording of the C Reference Manual from 1978.
2021-06-29 07:23:21 +00:00
rillig 0b52e712a6 tests/lint: add tests for the lexical analysis 2021-06-29 07:17:43 +00:00
skrll d1034f1a89 Whitespace 2021-06-29 06:28:07 +00:00
rillig 8c50963b0a lint: remove comment from grammar rule type_direct_decl
The 'identifier' in type_direct_decl is necessary, as demonstrated in
the test d_typename_as_var.  Replacing T_NAME with 'identifier' in
notype_direct_decl would increase the shift/reduce conflicts by 6.  To
keep this number low, keep everything as-is.
2021-06-29 05:41:45 +00:00
sjg 837626497a Allow BROKEN_TESTS to cause TESTS to be skipped.
Some tests simply do not work in some environments.
Eg. shell-ksh on macos/arm64
Allow local site to set BROKEN_TESTS to skip those they know
will not work.

Reviewed by: rillig
2021-06-29 00:35:23 +00:00
chs e3beb37645 VOP_BMAP() may be called via ioctl(FIOGETBMAP) on any vnode that applications
can open.  change various pseudo-fs *_bmap methods return an error instead of
panic.

Reported-by: syzbot+8289a3eaf2ba60958c87@syzkaller.appspotmail.com
2021-06-28 17:52:12 +00:00
rillig 61e921f9ea lint: in C99 mode, complain about implicitly declared functions
C99, foreword, p5, item 22 lists among the major changes from C90:
"remove implicit function declaration".
2021-06-28 11:27:00 +00:00
rillig d8a3f2eb44 lint: fix parse error for type 'void (*)[*]' 2021-06-28 11:09:35 +00:00
rillig 8b3bb5df80 lint: fix type name for prototype function without parameters 2021-06-28 10:29:05 +00:00
rillig 5953d76ca7 lint: add type information to message 155 (type mismatch) 2021-06-28 10:23:49 +00:00
rillig 3ce5ae23e6 lint: turn null pointer dereference into assertion failure
Originally I only needed a message that would output the type name from
an abstract-declarator (C99 6.7.6), to see whether lint interprets the
types correctly.

Message 155 looked like a good candidate, but it only revealed more
incomplete and untested code in lint.
2021-06-28 10:07:43 +00:00
rillig 72ed3a7a7b lint: rename grammar rules for abstract declarators
The previous name 'decl' was ambiguous, it could have meant declaration
as well as declarator.  The new names are aligned with C99.

No functional change.
2021-06-28 09:40:52 +00:00