<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/net/sunrpc/auth_gss, branch linux-4.5.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-4.5.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-4.5.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2016-06-08T01:18:51Z</updated>
<entry>
<title>sunrpc: fix stripping of padded MIC tokens</title>
<updated>2016-06-08T01:18:51Z</updated>
<author>
<name>Tomáš Trnka</name>
</author>
<published>2016-05-20T14:41:10Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=2b777480ae68dbd348d67a7a4ad5cab6c7967f60'/>
<id>urn:sha1:2b777480ae68dbd348d67a7a4ad5cab6c7967f60</id>
<content type='text'>
commit c0cb8bf3a8e4bd82e640862cdd8891400405cb89 upstream.

The length of the GSS MIC token need not be a multiple of four bytes.
It is then padded by XDR to a multiple of 4 B, but unwrap_integ_data()
would previously only trim mic.len + 4 B. The remaining up to three
bytes would then trigger a check in nfs4svc_decode_compoundargs(),
leading to a "garbage args" error and mount failure:

nfs4svc_decode_compoundargs: compound not properly padded!
nfsd: failed to decode arguments!

This would prevent older clients using the pre-RFC 4121 MIC format
(37-byte MIC including a 9-byte OID) from mounting exports from v3.9+
servers using krb5i.

The trimming was introduced by commit 4c190e2f913f ("sunrpc: trim off
trailing checksum before returning decrypted or integrity authenticated
buffer").

Fixes: 4c190e2f913f "unrpc: trim off trailing checksum..."
Signed-off-by: Tomáš Trnka &lt;ttrnka@mail.muni.cz&gt;
Acked-by: Jeff Layton &lt;jlayton@poochiereds.net&gt;
Signed-off-by: J. Bruce Fields &lt;bfields@redhat.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>auth_gss: fix panic in gss_pipe_downcall() in fips mode</title>
<updated>2016-02-17T16:50:10Z</updated>
<author>
<name>Scott Mayhew</name>
</author>
<published>2016-02-16T21:20:25Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=437b300c6b28040ad87e4caf042e05f2c5f13c6d'/>
<id>urn:sha1:437b300c6b28040ad87e4caf042e05f2c5f13c6d</id>
<content type='text'>
On Mon, 15 Feb 2016, Trond Myklebust wrote:

&gt; Hi Scott,
&gt;
&gt; On Mon, Feb 15, 2016 at 2:28 PM, Scott Mayhew &lt;smayhew@redhat.com&gt; wrote:
&gt; &gt; md5 is disabled in fips mode, and attempting to import a gss context
&gt; &gt; using md5 while in fips mode will result in crypto_alg_mod_lookup()
&gt; &gt; returning -ENOENT, which will make its way back up to
&gt; &gt; gss_pipe_downcall(), where the BUG() is triggered.  Handling the -ENOENT
&gt; &gt; allows for a more graceful failure.
&gt; &gt;
&gt; &gt; Signed-off-by: Scott Mayhew &lt;smayhew@redhat.com&gt;
&gt; &gt; ---
&gt; &gt;  net/sunrpc/auth_gss/auth_gss.c | 3 +++
&gt; &gt;  1 file changed, 3 insertions(+)
&gt; &gt;
&gt; &gt; diff --git a/net/sunrpc/auth_gss/auth_gss.c b/net/sunrpc/auth_gss/auth_gss.c
&gt; &gt; index 799e65b..c30fc3b 100644
&gt; &gt; --- a/net/sunrpc/auth_gss/auth_gss.c
&gt; &gt; +++ b/net/sunrpc/auth_gss/auth_gss.c
&gt; &gt; @@ -737,6 +737,9 @@ gss_pipe_downcall(struct file *filp, const char __user *src, size_t mlen)
&gt; &gt;                 case -ENOSYS:
&gt; &gt;                         gss_msg-&gt;msg.errno = -EAGAIN;
&gt; &gt;                         break;
&gt; &gt; +               case -ENOENT:
&gt; &gt; +                       gss_msg-&gt;msg.errno = -EPROTONOSUPPORT;
&gt; &gt; +                       break;
&gt; &gt;                 default:
&gt; &gt;                         printk(KERN_CRIT "%s: bad return from "
&gt; &gt;                                 "gss_fill_context: %zd\n", __func__, err);
&gt; &gt; --
&gt; &gt; 2.4.3
&gt; &gt;
&gt;
&gt; Well debugged, but I unfortunately do have to ask if this patch is
&gt; sufficient? In addition to -ENOENT, and -ENOMEM, it looks to me as if
&gt; crypto_alg_mod_lookup() can also fail with -EINTR, -ETIMEDOUT, and
&gt; -EAGAIN. Don't we also want to handle those?

You're right, I was focusing on the panic that I could easily reproduce.
I'm still not sure how I could trigger those other conditions.

&gt;
&gt; In fact, peering into the rats nest that is
&gt; gss_import_sec_context_kerberos(), it looks as if that is just a tiny
&gt; subset of all the errors that we might run into. Perhaps the right
&gt; thing to do here is to get rid of the BUG() (but keep the above
&gt; printk) and just return a generic error?

That sounds fine to me -- updated patch attached.

-Scott

&gt;From d54c6b64a107a90a38cab97577de05f9a4625052 Mon Sep 17 00:00:00 2001
From: Scott Mayhew &lt;smayhew@redhat.com&gt;
Date: Mon, 15 Feb 2016 15:12:19 -0500
Subject: [PATCH] auth_gss: remove the BUG() from gss_pipe_downcall()

Instead return a generic error via gss_msg-&gt;msg.errno.  None of the
errors returned by gss_fill_context() should necessarily trigger a
kernel panic.

Signed-off-by: Scott Mayhew &lt;smayhew@redhat.com&gt;
Signed-off-by: Trond Myklebust &lt;trond.myklebust@primarydata.com&gt;
</content>
</entry>
<entry>
<title>nfsd4: fix gss-proxy 4.1 mounts for some AD principals</title>
<updated>2015-11-24T18:36:31Z</updated>
<author>
<name>J. Bruce Fields</name>
</author>
<published>2015-11-20T15:48:02Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=414ca017a54d26c3a58ed1504884e51448d22ae1'/>
<id>urn:sha1:414ca017a54d26c3a58ed1504884e51448d22ae1</id>
<content type='text'>
The principal name on a gss cred is used to setup the NFSv4.0 callback,
which has to have a client principal name to authenticate to.

That code wants the name to be in the form servicetype@hostname.
rpc.svcgssd passes down such names (and passes down no principal name at
all in the case the principal isn't a service principal).

gss-proxy always passes down the principal name, and passes it down in
the form servicetype/hostname@REALM.  So we've been munging the name
gss-proxy passes down into the format the NFSv4.0 callback code expects,
or throwing away the name if we can't.

Since the introduction of the MACH_CRED enforcement in NFSv4.1, we've
also been using the principal name to verify that certain operations are
done as the same principal as was used on the original EXCHANGE_ID call.

For that application, the original name passed down by gss-proxy is also
useful.

Lack of that name in some cases was causing some kerberized NFSv4.1
mount failures in an Active Directory environment.

This fix only works in the gss-proxy case.  The fix for legacy
rpc.svcgssd would be more involved, and rpc.svcgssd already has other
problems in the AD case.

Reported-and-tested-by: James Ralston &lt;ralston@pobox.com&gt;
Acked-by: Simo Sorce &lt;simo@redhat.com&gt;
Signed-off-by: J. Bruce Fields &lt;bfields@redhat.com&gt;
</content>
</entry>
<entry>
<title>sunrpc: avoid warning in gss_key_timeout</title>
<updated>2015-10-23T19:57:28Z</updated>
<author>
<name>Arnd Bergmann</name>
</author>
<published>2015-10-09T14:13:45Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=cc6a7aab5570beef884ff95f7cade6634bf815a1'/>
<id>urn:sha1:cc6a7aab5570beef884ff95f7cade6634bf815a1</id>
<content type='text'>
The gss_key_timeout() function causes a harmless warning in some
configurations, e.g. ARM imx_v6_v7_defconfig with gcc-5.2, if the
compiler cannot figure out the state of the 'expire' variable across
an rcu_read_unlock():

net/sunrpc/auth_gss/auth_gss.c: In function 'gss_key_timeout':
net/sunrpc/auth_gss/auth_gss.c:1422:211: warning: 'expire' may be used uninitialized in this function [-Wmaybe-uninitialized]

To avoid this warning without adding a bogus initialization, this
rewrites the function so the comparison is done inside of the
critical section. As a side-effect, it also becomes slightly
easier to understand because the implementation now more closely
resembles the comment above it.

Signed-off-by: Arnd Bergmann &lt;arnd@arndb.de&gt;
Fixes: c5e6aecd034e7 ("sunrpc: fix RCU handling of gc_ctx field")
Signed-off-by: J. Bruce Fields &lt;bfields@redhat.com&gt;
</content>
</entry>
<entry>
<title>sunrpc: use sg_init_one() in krb5_rc4_setup_enc/seq_key()</title>
<updated>2015-06-22T18:15:06Z</updated>
<author>
<name>Fabian Frederick</name>
</author>
<published>2015-06-16T19:57:52Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=901f1379f6c9dc2d73b51971d129a6f7d5b9b20a'/>
<id>urn:sha1:901f1379f6c9dc2d73b51971d129a6f7d5b9b20a</id>
<content type='text'>
Don't opencode sg_init_one()

Signed-off-by: Fabian Frederick &lt;fabf@skynet.be&gt;
Signed-off-by: J. Bruce Fields &lt;bfields@redhat.com&gt;
</content>
</entry>
<entry>
<title>svcrpc: fix potential GSSX_ACCEPT_SEC_CONTEXT decoding failures</title>
<updated>2015-05-04T16:02:40Z</updated>
<author>
<name>Scott Mayhew</name>
</author>
<published>2015-04-28T20:29:53Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=9507271d960a1911a51683888837d75c171cd91f'/>
<id>urn:sha1:9507271d960a1911a51683888837d75c171cd91f</id>
<content type='text'>
In an environment where the KDC is running Active Directory, the
exported composite name field returned in the context could be large
enough to span a page boundary.  Attaching a scratch buffer to the
decoding xdr_stream helps deal with those cases.

The case where we saw this was actually due to behavior that's been
fixed in newer gss-proxy versions, but we're fixing it here too.

Signed-off-by: Scott Mayhew &lt;smayhew@redhat.com&gt;
Cc: stable@vger.kernel.org
Reviewed-by: Simo Sorce &lt;simo@redhat.com&gt;
Signed-off-by: J. Bruce Fields &lt;bfields@redhat.com&gt;
</content>
</entry>
<entry>
<title>sunrpc: integer underflow in rsc_parse()</title>
<updated>2015-02-26T20:40:16Z</updated>
<author>
<name>Dan Carpenter</name>
</author>
<published>2015-02-24T15:34:01Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=76cb4be993c03bf9ec65a58b13f12c679bb041e4'/>
<id>urn:sha1:76cb4be993c03bf9ec65a58b13f12c679bb041e4</id>
<content type='text'>
If we call groups_alloc() with invalid values then it's might lead to
memory corruption.  For example, with a negative value then we might not
allocate enough for sizeof(struct group_info).

(We're doing this in the caller for consistency with other callers of
groups_alloc().  The other alternative might be to move the check out of
all the callers into groups_alloc().)

Signed-off-by: Dan Carpenter &lt;dan.carpenter@oracle.com&gt;
Reviewed-by: Simo Sorce &lt;simo@redhat.com&gt;
Signed-off-by: J. Bruce Fields &lt;bfields@redhat.com&gt;
</content>
</entry>
<entry>
<title>svcrpc: fix memory leak in gssp_accept_sec_context_upcall</title>
<updated>2015-02-17T23:09:02Z</updated>
<author>
<name>David Ramos</name>
</author>
<published>2015-02-13T21:11:51Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=a1d1e9be5a1dafe0ddc2181a9201c2ae29c71eff'/>
<id>urn:sha1:a1d1e9be5a1dafe0ddc2181a9201c2ae29c71eff</id>
<content type='text'>
Our UC-KLEE tool found a kernel memory leak of 512 bytes (on x86_64) for
each call to gssp_accept_sec_context_upcall()
(net/sunrpc/auth_gss/gss_rpc_upcall.c). Since it appears that this call
can be triggered by remote connections (at least, from a cursory a
glance at the call chain), it may be exploitable to cause kernel memory
exhaustion. We found the bug in kernel 3.16.3, but it appears to date
back to commit 9dfd87da1aeb0fd364167ad199f40fe96a6a87be (2013-08-20).

The gssp_accept_sec_context_upcall() function performs a pair of calls
to gssp_alloc_receive_pages() and gssp_free_receive_pages().  The first
allocates memory for arg-&gt;pages.  The second then frees the pages
pointed to by the arg-&gt;pages array, but not the array itself.

Reported-by: David A. Ramos &lt;daramos@stanford.edu&gt;
Fixes: 9dfd87da1aeb ("rpc: fix huge kmalloc's in gss-proxy”)
Signed-off-by: David A. Ramos &lt;daramos@stanford.edu&gt;
Signed-off-by: J. Bruce Fields &lt;bfields@redhat.com&gt;
</content>
</entry>
<entry>
<title>sunrpc: move rq_splice_ok flag into rq_flags</title>
<updated>2014-12-09T16:22:21Z</updated>
<author>
<name>Jeff Layton</name>
</author>
<published>2014-11-19T12:51:18Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=779fb0f3af3089daa2e88cf8ef0ef0c5d2fecb40'/>
<id>urn:sha1:779fb0f3af3089daa2e88cf8ef0ef0c5d2fecb40</id>
<content type='text'>
Signed-off-by: Jeff Layton &lt;jlayton@primarydata.com&gt;
Signed-off-by: J. Bruce Fields &lt;bfields@redhat.com&gt;
</content>
</entry>
<entry>
<title>sunrpc: eliminate RPC_DEBUG</title>
<updated>2014-11-24T22:31:46Z</updated>
<author>
<name>Jeff Layton</name>
</author>
<published>2014-11-17T21:58:04Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=f895b252d4edf66b2895fb5a7b17a638665f3e1f'/>
<id>urn:sha1:f895b252d4edf66b2895fb5a7b17a638665f3e1f</id>
<content type='text'>
It's always set to whatever CONFIG_SUNRPC_DEBUG is, so just use that.

Signed-off-by: Jeff Layton &lt;jlayton@primarydata.com&gt;
Signed-off-by: Trond Myklebust &lt;trond.myklebust@primarydata.com&gt;
</content>
</entry>
</feed>
