Skip to contentSkip to conversation

librpcsecgss: FTBFS on GNU/kFreeBSD

DISCUSSION Aníbal Monsalve Salazar 8 participants 17 messages Nov 24, 2013 – Dec 10, 2013 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Quoted 11 lines · Cyril Brulebois

Package: librpcsecgss
Version: 0.18-1
Severity: important
Tags: patch pending
User: [email protected]
Usertags: kfreebsd

Hi,

please find attached a trivial patch to fix the FTBFS on GNU/kFreeBSD:
[...]

I've carried the patch below in Debian for a long time. Please consider merging it.

Quoted 1 line

From dc2b55a7f83d6c505ba79b83089f365bb0c24bf1 Mon Sep 17 00:00:00 2001

From: Cyril Brulebois <[email protected]>
Date: Fri, 3 Jul 2009 15:31:42 +0200
Subject: librpcsecgss: FTBFS on GNU/kFreeBSD

Fix FTBFS on GNU/kFreeBSD by using getpid() (rather than arc4random()) not only if __linux__ is defined, but also if __GLIBC__ is defined.

---
 src/clnt_tcp.c | 2 +-
 src/clnt_udp.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
src/clnt_tcp.c +1 -1
index 4da0d31..f2c3da0 100644
@@ -225,7 +225,7 @@ clnttcp_create(raddr, prog, vers, sockp, sendsz, recvsz)
 	 * Initialize call message
 	 */
 	(void)gettimeofday(&now, (struct timezone *)0);
-#ifdef __linux__
+#if defined (__linux__) || defined(__GLIBC__)
 	call_msg.rm_xid = getpid() ^ now.tv_sec ^ now.tv_usec;
 #else
 	call_msg.rm_xid = arc4random();
src/clnt_udp.c +1 -1
index fc803b2..fe95ed2 100644
@@ -153,7 +153,7 @@ clntudp_bufcreate(raddr, program, version, wait, sockp, sendsz, recvsz)
 	cu->cu_total.tv_usec = -1;
 	cu->cu_sendsz = sendsz;
 	cu->cu_recvsz = recvsz;
-#ifdef __linux__
+#if defined (__linux__) || defined(__GLIBC__)
 	call_msg.rm_xid = getpid() ^ now.tv_sec ^ now.tv_usec;
 #else
 	call_msg.rm_xid = arc4random();
Signature · 1 line
1.8.4.2
#2 lore raw

src/clnt_tcp.c clnttcp_create(raddr, prog, vers, sockp, sendsz, recvsz) · line 231

Quoted 6 lines · An?bal Monsalve Salazar
src/clnt_tcp.c +1 -1
 	(void)gettimeofday(&now, (struct timezone *)0);
-#ifdef __linux__
+#if defined (__linux__) || defined(__GLIBC__)
 	call_msg.rm_xid = getpid() ^ now.tv_sec ^ now.tv_usec;
 #else
 	call_msg.rm_xid = arc4random();

Using getpid() instead of a random generator seems fairly dangerous. Why don't we use a real RNG/PRNG here?

#3 lore raw

Christoph Hellwig wrote:

  On Sun, Nov 24, 2013 at 04:19:04PM +1100, An?bal Monsalve Salazar wrote:
  >  	(void)gettimeofday(&now, (struct timezone *)0);
  > -#ifdef __linux__
  > +#if defined (__linux__) || defined(__GLIBC__)
  >  	call_msg.rm_xid = getpid() ^ now.tv_sec ^ now.tv_usec;
  >  #else
  >  	call_msg.rm_xid = arc4random();

Using getpid() instead of a random generator seems fairly dangerous. Why don't we use a real RNG/PRNG here?

Maybe we're just trying to avoid collisions, and don't care if someone can guess xids? But either way, agreed. Also, shouldn't the existence of arc4random() be determined by configure? Isn't that why we use configure, so we don't need fragile ifdefs in the code?

Is anyone maintaining this library?

#4 lore raw
Quoted 6 lines · Jim Rees

Maybe we're just trying to avoid collisions, and don't care if someone can guess xids? But either way, agreed. Also, shouldn't the existence of arc4random() be determined by configure? Isn't that why we use configure, so we don't need fragile ifdefs in the code?

Is anyone maintaining this library?

No idea. But the easiest would be to just link against libbsd on Linux to get the BSDish arc4random symbol.

#5 lore raw
In reply to Jim Rees

Btw, looks like librpcsecgss is indeed pretty much unmaintained. The last upstream release is a tarball drop from CITI in 2009 and there doesn't appear to be a source repository of any kind.

I think the best idea would be to merge it into the libtirpc repo, as both the heritage and usage of the codebases is the same.

#6 lore raw
Quoted 6 lines · Christoph Hellwig

Btw, looks like librpcsecgss is indeed pretty much unmaintained. The last upstream release is a tarball drop from CITI in 2009 and there doesn't appear to be a source repository of any kind.

I think the best idea would be to merge it into the libtirpc repo, as both the heritage and usage of the codebases is the same.

Comparing what's packaged in nfs-utils-lib and what's in libtirpc: it appears libtirpc already has librpcsecgss.

I assume librpcsecgss is still required on systems that use glibc's RPC implementation. But for systems that have libtirpc, maybe librpcsecgss is unneeded?

Note: the GSS API provided here is not documented, AFAICT, and does not match the de facto standard provided by a modern Solaris libtirpc. I'd like to add the standard API to libtirpc and deprecate (but not remove) the current GSS API.

--
Chuck Lever
chuck[dot]lever[at]oracle[dot]com

#7 lore raw
Quoted 11 lines · Chuck Lever
Quoted 6 lines · Christoph Hellwig

Btw, looks like librpcsecgss is indeed pretty much unmaintained. The last upstream release is a tarball drop from CITI in 2009 and there doesn't appear to be a source repository of any kind.

I think the best idea would be to merge it into the libtirpc repo, as both the heritage and usage of the codebases is the same.

Comparing what's packaged in nfs-utils-lib and what's in libtirpc: it appears libtirpc already has librpcsecgss.

It does? AFAICS a freshly cloned copy of libtirpc only contains the prehistoric krb4/DES implementation. I see no GSS library.

I thought the reason why we deprecated librpcsecgss was that the MIT Kerberos libraries now have the equivalent hooks.

Cheers
Trond

#8 lore raw
Quoted 10 lines · Trond Myklebust
Quoted 7 lines · Chuck Lever
Quoted 4 lines · Christoph Hellwig

Btw, looks like librpcsecgss is indeed pretty much unmaintained. The last upstream release is a tarball drop from CITI in 2009 and there doesn't appear to be a source repository of any kind.

Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

I think the best idea would be to merge it into the libtirpc repo, as both the heritage and usage of the codebases is the same.

Comparing what's packaged in nfs-utils-lib and what's in libtirpc: it appears libtirpc already has librpcsecgss.

It does? AFAICS a freshly cloned copy of libtirpc only contains the prehistoric krb4/DES implementation. I see no GSS library.

I pulled from:

git://git.infradead.org/~steved/libtirpc.git

Yes, there's AUTH_DES support in libtirpc, and who knows if our implementation works.

But I'm looking at tirpc/rpc/auth_gss.h. Both libraries provide roughly the same API. And I'm able to build a working GSS-enabled version of rpc.fedfsd and clients. "git log" tells me src/auth_gss.c and tirpc/rpc/auth_gss.h have been in libtirpc since at least 0.1.7.

libtirpc applications currently have to link explicitly with libgssapi_krb5 (provided by MIT Kerberos), AFAICT, to get GSS support.

I'd like to add support in libtirpc for dynamically loading libgssapi_krb5 when it is needed. Then applications would need only invoke rpc_gss_*() (or the legacy authgss_*() equivalent) to get RPCSECGSS, if libgssapi_krb5 is already installed on their system.

Quoted 1 line

I thought the reason why we deprecated librpcsecgss was that the MIT Kerberos libraries now have the equivalent hooks.

My understanding:

MIT Kerberos provides libgssapi_krb5.

libtirpc provides the RPCSEC APIs based on the Kerberos v5 mechanism provided in libgssapi_krb5.

librpcsecgss provides RPCSEC APIs based on the GSSAPI Kerberos v5 mechanism provided in libgssglue, which is deprecated.

--
Chuck Lever
chuck[dot]lever[at]oracle[dot]com

#9 lore raw

[adding back Anibal, and adding Steinar as tirpc maintainer for Debian]

Quoted 9 lines · Chuck Lever

But I'm looking at tirpc/rpc/auth_gss.h. Both libraries provide roughly the same API. And I'm able to build a working GSS-enabled version of rpc.fedfsd and clients. "git log" tells me src/auth_gss.c and tirpc/rpc/auth_gss.h have been in libtirpc since at least 0.1.7.

libtirpc applications currently have to link explicitly with libgssapi_krb5 (provided by MIT Kerberos), AFAICT, to get GSS support.

Quoted 5 lines

MIT Kerberos provides libgssapi_krb5.

libtirpc provides the RPCSEC APIs based on the Kerberos v5 mechanism provided in libgssapi_krb5.

librpcsecgss provides RPCSEC APIs based on the GSSAPI Kerberos v5 mechanism provided in libgssglue, which is deprecated.

So what's actually still using librpcsecgss and libgssglue?

There is no rdepends for librpcsecgss on my Debian -stable system, and I couldn't find any obvious user for unstable either. For libgssglue1 -stable has a few consumers:

nfs-common
libtirpc1
librpcsecgss3
libgssglue-dev
libgssapi-krb5-2

libgssapi-krb5-2 seems to have dropped the libgssglue dependency in unstable, but the others still seem to be be around.

How does the situation look for Fedora and SuSE?

#10 lore raw
Quoted 24 lines · Christoph Hellwig

[adding back Anibal, and adding Steinar as tirpc maintainer for Debian]

Quoted 9 lines · Chuck Lever

But I'm looking at tirpc/rpc/auth_gss.h. Both libraries provide roughly the same API. And I'm able to build a working GSS-enabled version of rpc.fedfsd and clients. "git log" tells me src/auth_gss.c and tirpc/rpc/auth_gss.h have been in libtirpc since at least 0.1.7.

libtirpc applications currently have to link explicitly with libgssapi_krb5 (provided by MIT Kerberos), AFAICT, to get GSS support.

Quoted 5 lines

MIT Kerberos provides libgssapi_krb5.

libtirpc provides the RPCSEC APIs based on the Kerberos v5 mechanism provided in libgssapi_krb5.

librpcsecgss provides RPCSEC APIs based on the GSSAPI Kerberos v5 mechanism provided in libgssglue, which is deprecated.

So what's actually still using librpcsecgss and libgssglue?

There is no rdepends for librpcsecgss on my Debian -stable system, and I couldn't find any obvious user for unstable either. For libgssglue1 -stable has a few consumers:

Quoted 8 lines

nfs-common
libtirpc1
librpcsecgss3
libgssglue-dev
libgssapi-krb5-2

libgssapi-krb5-2 seems to have dropped the libgssglue dependency in unstable, but the others still seem to be be around.

I thought that Debian installs the Heimdal kerberos libraries by default. Does it have the gssapi hooks?

Quoted 1 line

How does the situation look for Fedora and SuSE?

Fedora’s nfs-utils RPM lists a dependency on ‘libgssapi_krb5.so.2()(64bit)' and 'libgssapi_krb5.so.2(gssapi_krb5_2_MIT)(64bit)', so it uses the gssapi from the MIT kerberos libraries.

Not sure about SuSE, but I believe they use MIT kerberos too. Neil Brown would know.

Cheers
Trond

#11 lore raw
Quoted 4 lines · Trond Myklebust
Quoted 2 lines

libgssapi-krb5-2 seems to have dropped the libgssglue dependency in unstable, but the others still seem to be be around.

I thought that Debian installs the Heimdal kerberos libraries by default. Does it have the gssapi hooks?

libgssapi-krb5-2 is described as "MIT Kerberos runtime libraries - krb5 GSS-API Mechanism" and depends on libkrb5-3 which is "MIT Kerberos runtime libraries". Nothing Heimdal related in this dependency chain.

#12 lore raw
Quoted 9 lines · Christoph Hellwig
Quoted 4 lines · Trond Myklebust
Quoted 2 lines

libgssapi-krb5-2 seems to have dropped the libgssglue dependency in unstable, but the others still seem to be be around.

I thought that Debian installs the Heimdal kerberos libraries by default. Does it have the gssapi hooks?

libgssapi-krb5-2 is described as "MIT Kerberos runtime libraries - krb5 GSS-API Mechanism" and depends on libkrb5-3 which is "MIT Kerberos runtime libraries". Nothing Heimdal related in this dependency chain.

Then it should be able to drop the CITI librpcsecgss and libgssglue.

Cheers
Trond

#13 lore raw
Quoted 7 lines · Trond Myklebust
Quoted 4 lines · Christoph Hellwig
Quoted 3 lines · Trond Myklebust
Quoted 2 lines

libgssapi-krb5-2 seems to have dropped the libgssglue dependency in unstable, but the others still seem to be be around.

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

I thought that Debian installs the Heimdal kerberos libraries by default. Does it have the gssapi hooks?

libgssapi-krb5-2 is described as "MIT Kerberos runtime libraries - krb5 GSS-API Mechanism" and depends on libkrb5-3 which is "MIT Kerberos runtime libraries". Nothing Heimdal related in this dependency chain.

Then it should be able to drop the CITI librpcsecgss and libgssglue.

I would think so....

librpcsecgss has already been remove from Fedora and I'll do the same for libgssglue once f18 is no longer supported...

steved.

Quoted 7 lines

Cheers
Trond--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#14 lore raw
In reply to Trond Myklebust
Quoted 36 lines · On Thu, 5 Dec 2013 08:41:27 -0500 Trond Myklebust <[email protected]> wrote:
Quoted 24 lines · Christoph Hellwig

[adding back Anibal, and adding Steinar as tirpc maintainer for Debian]

Quoted 9 lines · Chuck Lever

But I'm looking at tirpc/rpc/auth_gss.h. Both libraries provide roughly the same API. And I'm able to build a working GSS-enabled version of rpc.fedfsd and clients. "git log" tells me src/auth_gss.c and tirpc/rpc/auth_gss.h have been in libtirpc since at least 0.1.7.

libtirpc applications currently have to link explicitly with libgssapi_krb5 (provided by MIT Kerberos), AFAICT, to get GSS support.

Quoted 5 lines

MIT Kerberos provides libgssapi_krb5.

libtirpc provides the RPCSEC APIs based on the Kerberos v5 mechanism provided in libgssapi_krb5.

librpcsecgss provides RPCSEC APIs based on the GSSAPI Kerberos v5 mechanism provided in libgssglue, which is deprecated.

So what's actually still using librpcsecgss and libgssglue?

There is no rdepends for librpcsecgss on my Debian -stable system, and I couldn't find any obvious user for unstable either. For libgssglue1 -stable has a few consumers:

Quoted 8 lines

nfs-common
libtirpc1
librpcsecgss3
libgssglue-dev
libgssapi-krb5-2

libgssapi-krb5-2 seems to have dropped the libgssglue dependency in unstable, but the others still seem to be be around.

Quoted 7 lines

I thought that Debian installs the Heimdal kerberos libraries by default. Does it have the gssapi hooks?

Quoted 1 line

How does the situation look for Fedora and SuSE?

Fedora’s nfs-utils RPM lists a dependency on ‘libgssapi_krb5.so.2()(64bit)' and 'libgssapi_krb5.so.2(gssapi_krb5_2_MIT)(64bit)', so it uses the gssapi from the MIT kerberos libraries.

Not sure about SuSE, but I believe they use MIT kerberos too. Neil Brown would know.

openSUSE is actually a bit of a mess right now as we have libtirpc compiled with libgssglue support and that just doesn't work with a modern krb5. I'm glad to see that support is being removed!! (I'm working on getting this fixed, but there are "issues" ;-( ).

But while we still seem to package librpcsecgss, nfs-utils doesn't bind against it. It uses libgssapi_krb5 just like Fedora.

NeilBrown

#16 lore raw
In reply to Christoph Hellwig
Quoted 3 lines · Christoph Hellwig

Btw, looks like librpcsecgss is indeed pretty much unmaintained. The last upstream release is a tarball drop from CITI in 2009 and there doesn't appear to be a source repository of any kind.

Well, there is this:

git://git.linux-nfs.org/projects/kwc/librpcsecgss.git

which was probably the source of the tarball?

--b.

Quoted 8 lines

I think the best idea would be to merge it into the libtirpc repo, as both the heritage and usage of the codebases is the same.

--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#17 lore raw
Quoted 10 lines · J. Bruce Fields
Quoted 3 lines · Christoph Hellwig

Btw, looks like librpcsecgss is indeed pretty much unmaintained. The last upstream release is a tarball drop from CITI in 2009 and there doesn't appear to be a source repository of any kind.

Well, there is this:

git://git.linux-nfs.org/projects/kwc/librpcsecgss.git

which was probably the source of the tarball?

nfs-utils-lib.spec (Fedora) has this:

Source1: http://www.citi.umich.edu/projects/nfsv4/linux/librpcsecgss/%{librpcsecgss}-%{rpcsecgssvers}.tar.gz

Quoted 6 lines

--b.

Quoted 4 lines

I think the best idea would be to merge it into the libtirpc repo, as both the heritage and usage of the codebases is the same.

Quoted 8 lines
Quoted 4 lines

--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

--
Chuck Lever
chuck[dot]lever[at]oracle[dot]com