<feed xmlns='http://www.w3.org/2005/Atom'>
<title>src/sys/libkern, branch stable/10</title>
<subtitle>FreeBSD source tree</subtitle>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/'/>
<entry>
<title>MFC r330027</title>
<updated>2018-03-05T16:00:05+00:00</updated>
<author>
<name>David Bright</name>
<email>dab@FreeBSD.org</email>
</author>
<published>2018-03-05T16:00:05+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=9dc4844cc8ab66c09a5fb7dbf88bd8fdbd644322'/>
<id>9dc4844cc8ab66c09a5fb7dbf88bd8fdbd644322</id>
<content type='text'>
iconv uses strlen directly on user supplied memory

`iconv_sysctl_add` from `sys/libkern/iconv.c` incorrectly limits the
size of user strings, such that several out of bounds reads could have
been possible.

static int
iconv_sysctl_add(SYSCTL_HANDLER_ARGS)
{
	struct iconv_converter_class *dcp;
	struct iconv_cspair *csp;
	struct iconv_add_in din;
	struct iconv_add_out dout;
	int error;

	error = SYSCTL_IN(req, &amp;din, sizeof(din));
	if (error)
		return error;
	if (din.ia_version != ICONV_ADD_VER)
		return EINVAL;
	if (din.ia_datalen &gt; ICONV_CSMAXDATALEN)
		return EINVAL;
	if (strlen(din.ia_from) &gt;= ICONV_CSNMAXLEN)
		return EINVAL;
	if (strlen(din.ia_to) &gt;= ICONV_CSNMAXLEN)
		return EINVAL;
	if (strlen(din.ia_converter) &gt;= ICONV_CNVNMAXLEN)
		return EINVAL;
...

Since the `din` struct is directly copied from userland, there is no
guarantee that the strings supplied will be NULL terminated. The
`strlen` calls could continue reading past the designated buffer
sizes.

Declaration of `struct iconv_add_in` is found in `sys/sys/iconv.h`:

struct iconv_add_in {
	int	ia_version;
	char	ia_converter[ICONV_CNVNMAXLEN];
	char	ia_to[ICONV_CSNMAXLEN];
	char	ia_from[ICONV_CSNMAXLEN];
	int	ia_datalen;
	const void *ia_data;
};

Our strings are followed by the `ia_datalen` member, which is checked
before the `strlen` calls:

if (din.ia_datalen &gt; ICONV_CSMAXDATALEN)

Since `ICONV_CSMAXDATALEN` has value `0x41000` (and is `unsigned`),
this ensures that `din.ia_datalen` contains at least 1 byte of 0, so
it is not possible to trigger a read out of bounds of the `struct`
however, this code is fragile and could introduce subtle bugs in the
future if the `struct` is ever modified.

PR:		207302
Submitted by:	CTurt &lt;cturt@hardenedbsd.org&gt;
Reported by:	CTurt &lt;cturt@hardenedbsd.org&gt;
Sponsored by:	Dell EMC
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
iconv uses strlen directly on user supplied memory

`iconv_sysctl_add` from `sys/libkern/iconv.c` incorrectly limits the
size of user strings, such that several out of bounds reads could have
been possible.

static int
iconv_sysctl_add(SYSCTL_HANDLER_ARGS)
{
	struct iconv_converter_class *dcp;
	struct iconv_cspair *csp;
	struct iconv_add_in din;
	struct iconv_add_out dout;
	int error;

	error = SYSCTL_IN(req, &amp;din, sizeof(din));
	if (error)
		return error;
	if (din.ia_version != ICONV_ADD_VER)
		return EINVAL;
	if (din.ia_datalen &gt; ICONV_CSMAXDATALEN)
		return EINVAL;
	if (strlen(din.ia_from) &gt;= ICONV_CSNMAXLEN)
		return EINVAL;
	if (strlen(din.ia_to) &gt;= ICONV_CSNMAXLEN)
		return EINVAL;
	if (strlen(din.ia_converter) &gt;= ICONV_CNVNMAXLEN)
		return EINVAL;
...

Since the `din` struct is directly copied from userland, there is no
guarantee that the strings supplied will be NULL terminated. The
`strlen` calls could continue reading past the designated buffer
sizes.

Declaration of `struct iconv_add_in` is found in `sys/sys/iconv.h`:

struct iconv_add_in {
	int	ia_version;
	char	ia_converter[ICONV_CNVNMAXLEN];
	char	ia_to[ICONV_CSNMAXLEN];
	char	ia_from[ICONV_CSNMAXLEN];
	int	ia_datalen;
	const void *ia_data;
};

Our strings are followed by the `ia_datalen` member, which is checked
before the `strlen` calls:

if (din.ia_datalen &gt; ICONV_CSMAXDATALEN)

Since `ICONV_CSMAXDATALEN` has value `0x41000` (and is `unsigned`),
this ensures that `din.ia_datalen` contains at least 1 byte of 0, so
it is not possible to trigger a read out of bounds of the `struct`
however, this code is fragile and could introduce subtle bugs in the
future if the `struct` is ever modified.

PR:		207302
Submitted by:	CTurt &lt;cturt@hardenedbsd.org&gt;
Reported by:	CTurt &lt;cturt@hardenedbsd.org&gt;
Sponsored by:	Dell EMC
</pre>
</div>
</content>
</entry>
<entry>
<title>MFC r318514-r318515, r318517, r318917</title>
<updated>2017-05-31T06:26:37+00:00</updated>
<author>
<name>Xin LI</name>
<email>delphij@FreeBSD.org</email>
</author>
<published>2017-05-31T06:26:37+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=fd75e387fccd185a8970f8cc3306a39983c01a5f'/>
<id>fd75e387fccd185a8970f8cc3306a39983c01a5f</id>
<content type='text'>
r318514:
Use size_t.

Inspired by:	OpenBSD src/lib/libc/stdlib/qsort.c,v 1.11

r318515:
The current qsort(3) implementation ignores the sizes of partitions, and
always perform recursion on the left partition, then use a tail call to
handle the right partition.  In the worst case this could require O(N)
levels of recursions.

Reduce the possible recursion level to log2(N) by always recursing on the
smaller partition instead.

Obtained from:	PostgreSQL 9d6077abf9d6efd992a59f05ef5aba981ea32096

r318517:
Sync qsort.c with userland r318515.

(Note that MIN macro is removed in favor of sys/param.h's version).

PR:		213922

r318917:
Disconnect heimdal version of qsort.c from build because we are already
using libc's version of qsort.

PR:		bin/213922
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
r318514:
Use size_t.

Inspired by:	OpenBSD src/lib/libc/stdlib/qsort.c,v 1.11

r318515:
The current qsort(3) implementation ignores the sizes of partitions, and
always perform recursion on the left partition, then use a tail call to
handle the right partition.  In the worst case this could require O(N)
levels of recursions.

Reduce the possible recursion level to log2(N) by always recursing on the
smaller partition instead.

Obtained from:	PostgreSQL 9d6077abf9d6efd992a59f05ef5aba981ea32096

r318517:
Sync qsort.c with userland r318515.

(Note that MIN macro is removed in favor of sys/param.h's version).

PR:		213922

r318917:
Disconnect heimdal version of qsort.c from build because we are already
using libc's version of qsort.

PR:		bin/213922
</pre>
</div>
</content>
</entry>
<entry>
<title>MFC r311989 (cem):</title>
<updated>2017-05-31T06:00:14+00:00</updated>
<author>
<name>Xin LI</name>
<email>delphij@FreeBSD.org</email>
</author>
<published>2017-05-31T06:00:14+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=b0f071be5b68d4c017d8b8c995675f659b9f62c7'/>
<id>b0f071be5b68d4c017d8b8c995675f659b9f62c7</id>
<content type='text'>
libkern: Remove obsolete 'register' keyword
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
libkern: Remove obsolete 'register' keyword
</pre>
</div>
</content>
</entry>
<entry>
<title>MFC r315225:</title>
<updated>2017-03-14T06:12:51+00:00</updated>
<author>
<name>Xin LI</name>
<email>delphij@FreeBSD.org</email>
</author>
<published>2017-03-14T06:12:51+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=c80e2a01fc1a42d76c26c1eb0cd7676b6fc58c11'/>
<id>c80e2a01fc1a42d76c26c1eb0cd7676b6fc58c11</id>
<content type='text'>
Discard first 3072 bytes of RC4 keystream, this is a bandaid
that allows us to work on switching to a more modern PRNG.

Submitted by:	Steven Chamberlain &lt;steven pyro eu org&gt;
Approved by:	so
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Discard first 3072 bytes of RC4 keystream, this is a bandaid
that allows us to work on switching to a more modern PRNG.

Submitted by:	Steven Chamberlain &lt;steven pyro eu org&gt;
Approved by:	so
</pre>
</div>
</content>
</entry>
<entry>
<title>MFC:	r284583, r285797, r285799, r287168, r298714, r298720, r298838,</title>
<updated>2016-09-30T22:40:58+00:00</updated>
<author>
<name>Jung-uk Kim</name>
<email>jkim@FreeBSD.org</email>
</author>
<published>2016-09-30T22:40:58+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=f07e355068ffb2917440d261bb5a72dfab0e4cd4'/>
<id>f07e355068ffb2917440d261bb5a72dfab0e4cd4</id>
<content type='text'>
	r300879

Merge ACPICA up to 20160527.

Requested by:	mav
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
	r300879

Merge ACPICA up to 20160527.

Requested by:	mav
</pre>
</div>
</content>
</entry>
<entry>
<title>MFC r279433 (by rstone): Implement asprintf in libkern</title>
<updated>2015-10-05T09:46:23+00:00</updated>
<author>
<name>Alexander Motin</name>
<email>mav@FreeBSD.org</email>
</author>
<published>2015-10-05T09:46:23+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=6d1d40dcd430acb058736c72404e65b613842905'/>
<id>6d1d40dcd430acb058736c72404e65b613842905</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>MFC r277901:</title>
<updated>2015-02-02T08:05:11+00:00</updated>
<author>
<name>Dimitry Andric</name>
<email>dim@FreeBSD.org</email>
</author>
<published>2015-02-02T08:05:11+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=c938b1dc0984b50f98b94d5d127c3a1eac16ee7f'/>
<id>c938b1dc0984b50f98b94d5d127c3a1eac16ee7f</id>
<content type='text'>
Fix a -Wcast-qual warning in libkern's strtol(), by using __DECONST.  No
functional change.

MFC r277903:

Similar to r277901, fix more -Wcast-qual warnings in libkern's strtoq(),
strtoul() and strtouq(), by using __DECONST.  No functional change.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Fix a -Wcast-qual warning in libkern's strtol(), by using __DECONST.  No
functional change.

MFC r277903:

Similar to r277901, fix more -Wcast-qual warnings in libkern's strtoq(),
strtoul() and strtouq(), by using __DECONST.  No functional change.
</pre>
</div>
</content>
</entry>
<entry>
<title>Clean up our ARM assembly:</title>
<updated>2014-12-14T16:28:53+00:00</updated>
<author>
<name>Andrew Turner</name>
<email>andrew@FreeBSD.org</email>
</author>
<published>2014-12-14T16:28:53+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=2fd373a78b3eb587a63bcd6e87dba64b4ceb2683'/>
<id>2fd373a78b3eb587a63bcd6e87dba64b4ceb2683</id>
<content type='text'>
MFC 275256:

Switch to the ARM unified assembly language as the clang integrated as only
supports it. Binutils supports it when the ".syntax unified" directive
is set.

Sponsored by:   ABT Systems Ltd

MFC 275264:

Update _ENTRY to use _EENTRY to reduce the common code.

MFC 275321:

Remove extra labels, ENTRY_NP already provides them.

Sponsored by:   ABT Systems Ltd

MFC 275322:

Correctly a few incorrect uses of ENTRY/EENTRY and END/EEND

Sponsored by:   ABT Systems Ltd

MFC 275416:

Fix the name of the coprocessor to include the "p" prefix, the clang
integrated assembler expects this.

Sponsored by:   ABT Systems Ltd

MFC 275418:

Switch to unified syntax so these can be built with clang 3.5.

Sponsored by:   ABT Systems Ltd

MFC 275519:

Add missing END macros to some of the xscale functions.

Sponsored by:   ABT Systems Ltd

MFC 275520:

Use the unified syntax in a few more assembly files

Sponsored by:   ABT Systems Ltd

MFC 275521:

Set the alignment to 4-bytes after a string as clang 3.5 can switch to
thumb mode if this is incorrect.

Sponsored by:   ABT Systems Ltd

MFC 275522:

Place the literal pool after a RET otherwise clang 3.5 tries to put it too
far away from a ldr psuedo instruction. With this clang will place the
literal value here where it's close enough to be loaded.

Sponsored by:   ABT Systems Ltd

MFC 275523:

Switch to an armv6k cpu, without this clang 3.5 complains "bx lr" is
unsupported as it needs a newer cpu.

Sponsored by:   ABT Systems Ltd

MFC 275524:

Switch to a .cpu directive. These will work when clang 3.5 is imported
where the .arch directive is a nop.

Sponsored by:   ABT Systems Ltd
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
MFC 275256:

Switch to the ARM unified assembly language as the clang integrated as only
supports it. Binutils supports it when the ".syntax unified" directive
is set.

Sponsored by:   ABT Systems Ltd

MFC 275264:

Update _ENTRY to use _EENTRY to reduce the common code.

MFC 275321:

Remove extra labels, ENTRY_NP already provides them.

Sponsored by:   ABT Systems Ltd

MFC 275322:

Correctly a few incorrect uses of ENTRY/EENTRY and END/EEND

Sponsored by:   ABT Systems Ltd

MFC 275416:

Fix the name of the coprocessor to include the "p" prefix, the clang
integrated assembler expects this.

Sponsored by:   ABT Systems Ltd

MFC 275418:

Switch to unified syntax so these can be built with clang 3.5.

Sponsored by:   ABT Systems Ltd

MFC 275519:

Add missing END macros to some of the xscale functions.

Sponsored by:   ABT Systems Ltd

MFC 275520:

Use the unified syntax in a few more assembly files

Sponsored by:   ABT Systems Ltd

MFC 275521:

Set the alignment to 4-bytes after a string as clang 3.5 can switch to
thumb mode if this is incorrect.

Sponsored by:   ABT Systems Ltd

MFC 275522:

Place the literal pool after a RET otherwise clang 3.5 tries to put it too
far away from a ldr psuedo instruction. With this clang will place the
literal value here where it's close enough to be loaded.

Sponsored by:   ABT Systems Ltd

MFC 275523:

Switch to an armv6k cpu, without this clang 3.5 complains "bx lr" is
unsupported as it needs a newer cpu.

Sponsored by:   ABT Systems Ltd

MFC 275524:

Switch to a .cpu directive. These will work when clang 3.5 is imported
where the .arch directive is a nop.

Sponsored by:   ABT Systems Ltd
</pre>
</div>
</content>
</entry>
<entry>
<title>MFC r274636:</title>
<updated>2014-12-04T23:21:42+00:00</updated>
<author>
<name>Xin LI</name>
<email>delphij@FreeBSD.org</email>
</author>
<published>2014-12-04T23:21:42+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=80ef7e621df3f82a3572750f7416ba210e8ba3b7'/>
<id>80ef7e621df3f82a3572750f7416ba210e8ba3b7</id>
<content type='text'>
Sync with userland variant.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Sync with userland variant.
</pre>
</div>
</content>
</entry>
<entry>
<title>MFC: 272906</title>
<updated>2014-11-13T21:58:42+00:00</updated>
<author>
<name>George V. Neville-Neil</name>
<email>gnn@FreeBSD.org</email>
</author>
<published>2014-11-13T21:58:42+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=07f3a62914482712678980aeff99d026faf1a655'/>
<id>07f3a62914482712678980aeff99d026faf1a655</id>
<content type='text'>
Change the PF hash from Jenkins to Murmur3.  In forwarding tests
this showed a conservative 3% incrase in PPS.

Original Differential Revision:	https://reviews.freebsd.org/D461
Submitted by:	des
Reviewed by:	emaste
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Change the PF hash from Jenkins to Murmur3.  In forwarding tests
this showed a conservative 3% incrase in PPS.

Original Differential Revision:	https://reviews.freebsd.org/D461
Submitted by:	des
Reviewed by:	emaste
</pre>
</div>
</content>
</entry>
</feed>
