Skip to contentSkip to conversation

rpc: change BUG to WARN in gss_encode_v1_msg

PATCH In review J. Bruce Fields 3 participants 4 messages Oct 2, 2013 – Oct 16, 2013

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 rpc: change BUG to WARN in gss_encode_v1_msg

From: "J. Bruce Fields" <[email protected]>

Failure of this assertion would indeed be serious, but as we've seen a BUG() in a worker thread (this can run from rpciod context) can screw up the system so badly that the oops doesn't even get to the logs; better to WARN() and soldier on.

---
 net/sunrpc/auth_gss/auth_gss.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/sunrpc/auth_gss/auth_gss.c +1 -1
index 0846566..254a9f0 100644
@@ -454,7 +454,7 @@ static void gss_encode_v1_msg(struct gss_upcall_msg *gss_msg,
 	gss_msg->msg.len += len;
 
 	gss_msg->msg.data = gss_msg->databuf;
-	BUG_ON(gss_msg->msg.len > UPCALL_BUF_LEN);
+	WARN_ON_ONCE(gss_msg->msg.len > UPCALL_BUF_LEN);
 }
 
 static struct gss_upcall_msg *
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 2/2 sunrpc: comment typo fix

From: "J. Bruce Fields" <[email protected]>

---
 net/sunrpc/xprtsock.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
net/sunrpc/xprtsock.c +2 -2
index ee03d35..940d723 100644
@@ -2859,8 +2859,8 @@ static struct rpc_xprt *xs_setup_bc_tcp(struct xprt_create *args)
 	if (args->bc_xprt->xpt_bc_xprt) {
 		/*
 		 * This server connection already has a backchannel
-		 * export; we can't create a new one, as we wouldn't be
-		 * able to match replies based on xid any more.  So,
+		 * transport; we can't create a new one, as we wouldn't
+		 * be able to match replies based on xid any more.  So,
 		 * reuse the already-existing one:
 		 */
 		 return args->bc_xprt->xpt_bc_xprt;
Signature · 1 line
1.7.9.5
#2 lore raw
In reply to J. Bruce Fields
Quoted 17 lines · J. Bruce Fields

From: "J. Bruce Fields" <[email protected]>

Failure of this assertion would indeed be serious, but as we've seen a BUG() in a worker thread (this can run from rpciod context) can screw up the system so badly that the oops doesn't even get to the logs; better to WARN() and soldier on.

---
 net/sunrpc/auth_gss/auth_gss.c |    2 +--
 1 file changed, 1 insertion(+-), 1 deletion(-)
net/sunrpc/auth_gss/auth_gss.c +1 -1
index 0846566..254a9f0 100644
--- a/net/sunrpc/auth_gss/auth_gss.c
+-+-+- b/net/sunrpc/auth_gss/auth_gss.c

@@ -454,7 +-454,7 @@ static void gss_encode_v1_msg(struct gss_upcall_msg *gss_msg,

net/sunrpc/auth_gss/auth_gss.c static void gss_encode_v1_msg(struct gss_upcall_msg *gss_msg, · line 460

Quoted 8 lines
net/sunrpc/auth_gss/auth_gss.c +1 -1
 	gss_msg->msg.len +-= len;
 
 	gss_msg->msg.data = gss_msg->databuf;
-	BUG_ON(gss_msg->msg.len > UPCALL_BUF_LEN);
+-	WARN_ON_ONCE(gss_msg->msg.len > UPCALL_BUF_LEN);
 }
 
 static struct gss_upcall_msg *

Umm.... Why aren't we using scnprintf() in order to prevent string buffer overflows before they happen?

Signature · 6 lines
Trond Myklebust
Linux NFS client maintainer

NetApp
[email protected]
www.netapp.com
#3 lore raw
Quoted 25 lines · Trond
Quoted 24 lines · J. Bruce Fields

From: "J. Bruce Fields" <[email protected]>

Failure of this assertion would indeed be serious, but as we've seen a BUG() in a worker thread (this can run from rpciod context) can screw up the system so badly that the oops doesn't even get to the logs; better to WARN() and soldier on.

---
 net/sunrpc/auth_gss/auth_gss.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/sunrpc/auth_gss/auth_gss.c +1 -1
index 0846566..254a9f0 100644
@@ -454,7 +454,7 @@ static void gss_encode_v1_msg(struct gss_upcall_msg *gss_msg,
 	gss_msg->msg.len += len;
 
 	gss_msg->msg.data = gss_msg->databuf;
-	BUG_ON(gss_msg->msg.len > UPCALL_BUF_LEN);
+	WARN_ON_ONCE(gss_msg->msg.len > UPCALL_BUF_LEN);
 }
 
Quoted 4 lines

net/sunrpc/auth_gss/auth_gss.c static void gss_encode_v1_msg(struct gss_upcall_msg *gss_msg, · line 460

Quoted 1 line
net/sunrpc/auth_gss/auth_gss.c +0 -0
 static struct gss_upcall_msg *

Umm.... Why aren't we using scnprintf() in order to prevent string buffer overflows before they happen?

Yeah, this should really be caught earlier.

And we want to actually fail, not give gssd a truncated request.

--b.