Commit Graph

18401 Commits

Author SHA1 Message Date
Memallox 805ba09050 Add documentation for stdio 2018-09-19 17:39:10 +02:00
Memallox 25b53f80eb Add _console_read() implementation which is called by the read syscall (does not work yet!) 2018-09-19 14:37:29 +02:00
Memallox e780de19b4 Pseudo-implement syscalls: lseek, close, fstat, isatty, raise, read 2018-09-19 14:37:29 +02:00
Memallox c9845b3687 Remove legacy syscall definitions and changed syscall signatures 2018-09-19 14:37:29 +02:00
Memallox fc3d7418d9 Add errno information to some not implemented syscalls. See https://sourceware.org/newlib/libc.html#Syscalls 2018-09-19 14:37:29 +02:00
Memallox 481abf21ad Enable newlib_io_c99_format to provide support for the %zu format specifier 2018-09-19 14:37:29 +02:00
Memallox c4024e42ed Disable some newlib features by default to safe space 2018-09-19 14:37:29 +02:00
Memallox c40e651d90 Implement a console which is fed by the _write() syscall (and thus e.g. stdout) and redirect locate() to the console 2018-09-19 14:37:24 +02:00
Memallox c81076ab88 Add stdlib Casio syscall definitions 2018-09-19 14:23:11 +02:00
Memallox f0ae05e7c8 Add basic Casio syscalls (non-stdlib functionality) which are included into stdio.h 2018-09-19 14:23:11 +02:00
Memallox 9e1879908d Add target sh3eb to newlib/configure.host 2018-09-19 14:04:14 +02:00
Memallox 30e5cab3b5 Add floating point definitions for sh3eb in ieeefp.c 2018-09-19 14:04:14 +02:00
Memallox 5b11518570 Update the copied configure.ac files and run autoconf 2018-09-19 14:04:14 +02:00
Memallox ff76b3b326 Copy code from target sh to sh3eb 2018-09-19 14:04:14 +02:00
Memallox b64c66c8b6 Add IDE-specific paths to .gitignore 2018-09-19 14:03:51 +02:00
Memallox 12b246c01c Add README.md 2018-08-31 21:05:48 +02:00
Andy Koppe d8ccbcdacc Drop non-reserved parameter names from sys/signal.h
Standard headers shouldn't use non-reserved identifiers as parameter
names in function declarations, because programs could in theory
define macros with such names before including a header.
2018-08-29 17:46:27 +02:00
Keith Packard 82dfae9ab0 Use __inhibit_loop_to_libcall in all memset/memcpy implementations
This macro selects a compiler option that disables recognition of
common memset/memcpy patterns and converting those to direct
memset/memcpy calls.

Signed-off-by: Keith Packard <keithp@keithp.com>
2018-08-29 16:05:37 +02:00
Keith Packard 088a45cdf6 Remove unused variable 'one' from sf_cos.c
Defined, never mentioned.

Signed-off-by: Keith Packard <keithp@keithp.com>
2018-08-29 15:57:27 +02:00
Keith Packard 2c245028af Use nanf("") instead of nanf(NULL)
Newer GCC versions require a non-NULL argument to this function for
some reason.

Signed-off-by: Keith Packard <keithp@keithp.com>
2018-08-29 15:57:27 +02:00
Denis Ivanov 9e032fd939 RISC-V: Fix _sbrk, it's failed only when return value is -1.
Signed-off-by: Kito Cheng <kito.cheng@gmail.com>
2018-08-29 15:49:00 +02:00
Denis Ivanov 258996b696 RISC-V: Fixed return code in _times syscall.
Upon successful completion, times() shall return the elapsed real time,
in clock ticks, since an arbitrary point in the past (for example,
system start-up time).

Signed-off-by: Kito Cheng <kito.cheng@gmail.com>
2018-08-29 15:49:00 +02:00
Corinna Vinschen 03cd2c4efa Cygwin: Accommodate logon sessions on Windows 10
Starting with Windows 10, LookupAccountSid/Name return valid
info for the login session with new SID_NAME_USE value
SidTypeLogonSession.  To return the same info as on pre-Windows 10,
we have to handle this type.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-08-28 11:28:28 +02:00
Corinna Vinschen 3aba266aa9 Cygwin: drop workaround for missing USER_INFO_24 definition
Recent mingw64 provide USER_INFO_24

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-08-28 11:24:59 +02:00
Corinna Vinschen fc8aaa40fe Cygwin: add release note for previous ACL changes
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-08-27 18:30:59 +02:00
Corinna Vinschen 33b8c406dc Cygwin: Add name->SID conversion for self-constructed names
...as far as it makes sense.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-08-27 18:28:33 +02:00
Corinna Vinschen fcfcc288c4 Cygwin: don't return valid acl entry type for unknown SID
cygpsid::get_id neglects to set the type to 0 (ACL_UNDEFINED_TAG
in POSIX speak) if the SID can not be translated into a valid
uid or gid.  This in turn leads to incorrect handling of uid/gid -1
entries.

Fix this by setting type to 0 if the id is unknown.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-08-27 13:48:07 +02:00
Corinna Vinschen 6706b19a97 Cygwin: Remove union wait
This patch follows glibc.  Original commit message:

Author:	Florian Weimer <fweimer@redhat.com>
Date:   Thu, 14 Apr 2016 06:54:57 +0000

Remove union wait [BZ #19613]

The overloading approach in the W* macros was incompatible with
integer expressions of a type different from int.  Applications
using union wait and these macros will have to migrate to the
POSIX-specified int status type.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-08-24 20:57:47 +02:00
Sebastian Huber d13c84eb07 RTEMS: Add kvaddr_t and ksize_t
These types were introduced by FreeBSD commit:

"Make struct xinpcb and friends word-size independent.

Replace size_t members with ksize_t (uint64_t) and pointer members
(never used as pointers in userspace, but instead as unique
idenitifiers) with kvaddr_t (uint64_t). This makes the structs
identical between 32-bit and 64-bit ABIs.

On 64-bit bit systems, the ABI is maintained. On 32-bit systems,
this is an ABI breaking change. The ABI of most of these structs
was previously broken in r315662.  This also imposes a small API
change on userspace consumers who must handle kernel pointers
becoming virtual addresses.

PR:		228301 (exp-run by antoine)
Reviewed by:	jtl, kib, rwatson (various versions)
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D15386"

In RTEMS, there is no user/kernel space separation.  So, use the types
size_t and uintptr_t.

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2018-08-24 15:07:29 +02:00
Sebastian Huber d35971f392 RTEMS: Introduce <machine/_kernel_mman.h>
This helps to avoid Newlib updates due to FreeBSD kernel space changes.

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2018-08-24 15:04:43 +02:00
Sebastian Huber a2a8600f7d RTEMS: Introduce <machine/_kernel_socket.h>
This helps to avoid Newlib updates due to FreeBSD kernel space changes.

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2018-08-24 15:04:43 +02:00
Sebastian Huber 764d748c9c RTEMS: Introduce <machine/_kernel_if.h>
This helps to avoid Newlib updates due to FreeBSD kernel space changes.

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2018-08-24 15:04:43 +02:00
Sebastian Huber 0c0dd28596 RTEMS: Introduce <machine/_kernel_in.h>
This helps to avoid Newlib updates due to FreeBSD kernel space changes.

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2018-08-24 15:04:43 +02:00
Sebastian Huber 9ce55ee716 RTEMS: Introduce <machine/_kernel_in6.h>
This helps to avoid Newlib updates due to FreeBSD kernel space changes.

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2018-08-24 15:04:43 +02:00
Sebastian Huber c07fa084e0 RTEMS: Introduce <machine/_kernel_uio.h>
This helps to avoid Newlib updates due to FreeBSD kernel space changes.

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2018-08-24 15:04:43 +02:00
Sebastian Huber 9bbf89dd11 RTEMS: Add __BSD_VISIBLE in <sys/_termios.h>
The __XSI_VISIBLE is not enabled by default in Newlib.  This is an
incompatiblity between FreeBSD and glibc.

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2018-08-24 15:04:42 +02:00
Sebastian Huber 890c86d633 RTEMS: Update FreeBSD version tags
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2018-08-24 15:04:39 +02:00
tuexen fe3e8b90dc Add SOL_SOCKET level socket option
with name SO_DOMAIN to get the domain of a socket.

This is helpful when testing and Solaris and Linux have the same
socket option using the same name.

Reviewed by:		bcr@, rrs@
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D16791
2018-08-24 15:00:04 +02:00
jtl 823b096471 Implement a limit on on the number of IPv6 reassembly
queues per bucket.

There is a hashing algorithm which should distribute IPv6 reassembly
queues across the available buckets in a relatively even way. However,
if there is a flaw in the hashing algorithm which allows a large number
of IPv6 fragment reassembly queues to end up in a single bucket, a per-
bucket limit could help mitigate the performance impact of this flaw.

Implement such a limit, with a default of twice the maximum number of
reassembly queues divided by the number of buckets. Recalculate the
limit any time the maximum number of reassembly queues changes.
However, allow the user to override the value using a sysctl
(net.inet6.ip6.maxfragbucketsize).

Reviewed by:	jhb
Security:	FreeBSD-SA-18:10.ip
Security:	CVE-2018-6923
2018-08-24 15:00:04 +02:00
jtl 0e5c59050d Add a limit of the number of fragments per IPv6 packet.
The IPv4 fragment reassembly code supports a limit on the number of
fragments per packet. The default limit is currently 17 fragments.
Among other things, this limit serves to limit the number of fragments
the code must parse when trying to reassembly a packet.

Add a limit to the IPv6 reassembly code. By default, limit a packet
to 65 fragments (64 on the queue, plus one final fragment to complete
the packet). This allows an average fragment size of 1,008 bytes, which
should be sufficient to hold a fragment. (Recall that the IPv6 minimum
MTU is 1280 bytes. Therefore, this configuration allows a full-size
IPv6 packet to be fragmented on a link with the minimum MTU and still
carry approximately 272 bytes of headers before the fragmented portion
of the packet.)

Users can adjust this limit using the net.inet6.ip6.maxfragsperpacket
sysctl.

Reviewed by:	jhb
Security:	FreeBSD-SA-18:10.ip
Security:	CVE-2018-6923
2018-08-24 15:00:04 +02:00
rrs 215e33310b This commit brings in a new refactored TCP stack called Rack.
Rack includes the following features: - A different SACK processing
scheme (the old sack structures are not used). - RACK (Recent
acknowledgment) where counting dup-acks is no longer done instead time
is used to knwo when to retransmit. (see the I-D) - TLP (Tail Loss
Probe) where we will probe for tail-losses to attempt to try not to take
a retransmit time-out. (see the I-D) - Burst mitigation using TCPHTPS -
PRR (partial rate reduction) see the RFC.

Once built into your kernel, you can select this stack by either
socket option with the name of the stack is "rack" or by setting
the global sysctl so the default is rack.

Note that any connection that does not support SACK will be kicked
back to the "default" base  FreeBSD stack (currently known as "default").

To build this into your kernel you will need to enable in your
kernel:
   makeoptions WITH_EXTRA_TCP_STACKS=1
   options TCPHPTS

Sponsored by:	Netflix Inc.
Differential Revision:		https://reviews.freebsd.org/D15525
2018-08-24 15:00:04 +02:00
sbruno b40c48e057 Load balance sockets with new SO_REUSEPORT_LB option.
This patch adds a new socket option, SO_REUSEPORT_LB, which allow multiple
programs or threads to bind to the same port and incoming connections will be
load balanced using a hash function.

Most of the code was copied from a similar patch for DragonflyBSD.

However, in DragonflyBSD, load balancing is a global on/off setting and can not
be set per socket. This patch allows for simultaneous use of both the current
SO_REUSEPORT and the new SO_REUSEPORT_LB options on the same system.

Required changes to structures:
Globally change so_options from 16 to 32 bit value to allow for more options.
Add hashtable in pcbinfo to hold all SO_REUSEPORT_LB sockets.

Limitations:
As DragonflyBSD, a load balance group is limited to 256 pcbs (256 programs or
threads sharing the same socket).

This is a substantially different contribution as compared to its original
incarnation at svn r332894 and reverted at svn r332967.  Thanks to rwatson@
for the substantive feedback that is included in this commit.

Submitted by:	Johannes Lundberg <johalun0@gmail.com>
Obtained from:	DragonflyBSD
Relnotes:	Yes
Sponsored by:	Limelight Networks
Differential Revision:	https://reviews.freebsd.org/D11003
2018-08-24 15:00:04 +02:00
mmacy 44e0190a8c iflib(9): Add support for cloning pseudo interfaces
Part 3 of many ...
The VPC framework relies heavily on cloning pseudo interfaces
(vmnics, vpc switch, vcpswitch port, hostif, vxlan if, etc).

This pulls in that piece. Some ancillary changes get pulled
in as a side effect.

Reviewed by:	shurd@
Approved by:	sbruno@
Sponsored by:	Joyent, Inc.
Differential Revision:	https://reviews.freebsd.org/D15347
2018-08-24 15:00:04 +02:00
sbruno 6a98562b52 Revert r332894 at the request of the submitter.
Submitted by:	Johannes Lundberg <johalun0_gmail.com>
Sponsored by:	Limelight Networks
2018-08-24 15:00:04 +02:00
sbruno 5c636abe89 Load balance sockets with new SO_REUSEPORT_LB option
This patch adds a new socket option, SO_REUSEPORT_LB, which allow multiple
programs or threads to bind to the same port and incoming connections will be
load balanced using a hash function.

Most of the code was copied from a similar patch for DragonflyBSD.

However, in DragonflyBSD, load balancing is a global on/off setting and can not
be set per socket. This patch allows for simultaneous use of both the current
SO_REUSEPORT and the new SO_REUSEPORT_LB options on the same system.

Required changes to structures
Globally change so_options from 16 to 32 bit value to allow for more options.
Add hashtable in pcbinfo to hold all SO_REUSEPORT_LB sockets.

Limitations
As DragonflyBSD, a load balance group is limited to 256 pcbs
(256 programs or threads sharing the same socket).

Submitted by:	Johannes Lundberg <johanlun0@gmail.com>
Sponsored by:	Limelight Networks
Differential Revision:	https://reviews.freebsd.org/D11003
2018-08-24 15:00:04 +02:00
brooks 341e131f7f Add 32-bit compat for ioctls that take struct ifgroupreq.
Use an accessor to access ifgr_group and ifgr_groups.

Use an macro CASE_IOC_IFGROUPREQ(cmd) in place of case statements such
as "case SIOCAIFGROUP:". This avoids poluting the switch statements
with large numbers of #ifdefs.

Reviewed by:	kib
Obtained from:	CheriBSD
MFC after:	1 week
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D14960
2018-08-24 15:00:03 +02:00
brooks 79291d6123 Use an accessor function to access ifr_data.
This fixes 32-bit compat (no ioctl command defintions are required
as struct ifreq is the same size).  This is believed to be sufficent to
fully support ifconfig on 32-bit systems.

Reviewed by:	kib
Obtained from:	CheriBSD
MFC after:	1 week
Relnotes:	yes
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D14900
2018-08-24 15:00:03 +02:00
jeff c0f64943e7 Implement several enhancements to NUMA policies.
Add a new "interleave" allocation policy which stripes pages across
domains with a stride or width keeping contiguity within a multi-page
region.

Move the kernel to the dedicated numbered cpuset #2 making it possible
to assign kernel threads and memory policy separately from user.  This
also eliminates the need for the complicated interrupt binding code.

Add a sysctl API for viewing and manipulating domainsets.  Refactor some
of the cpuset_t manipulation code using the generic bitset type so that
it can be used for both.  This probably belongs in a dedicated subr file.

Attempt to improve the include situation.

Reviewed by:	kib
Discussed with:	jhb (cpuset parts)
Tested by:	pho (before review feedback)
Sponsored by:	Netflix, Dell/EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D14839
2018-08-24 15:00:03 +02:00
brooks f967e60cab Fix access to ifru_buffer on freebsd32.
Make all kernel accesses to ifru_buffer go via access functions
which take the process ABI into account and use an appropriate union
to access members in the correct place in struct ifreq.

Reviewed by:	kib
Obtained from:	CheriBSD
MFC after:	1 week
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D14846
2018-08-24 15:00:03 +02:00
kib b0250c7356 Allow to specify PCP on packets not belonging to any VLAN.
According to 802.1Q-2014, VLAN tagged packets with VLAN id 0 should be
considered as untagged, and only PCP and DEI values from the VLAN tag
are meaningful.  See for instance
https://www.cisco.com/c/en/us/td/docs/switches/connectedgrid/cg-switch-sw-master/software/configuration/guide/vlan0/b_vlan_0.html.

Make it possible to specify PCP value for outgoing packets on an
ethernet interface.  When PCP is supplied, the tag is appended, VLAN
id set to 0, and PCP is filled by the supplied value.  The code to do
VLAN tag encapsulation is refactored from the if_vlan.c and moved into
if_ethersubr.c.

Drivers might have issues with filtering VID 0 packets on
receive.  This bug should be fixed for each driver.

Reviewed by:	ae (previous version), hselasky, melifaro
Sponsored by:	Mellanox Technologies
MFC after:	2 weeks
Differential revision:	https://reviews.freebsd.org/D14702
2018-08-24 15:00:03 +02:00