-
-
usr/src/uts/common/rpc/rpcb_prot.c (Diff revision 1) I'd write this as
&& buf_save == NULL
, otherwise there's a question if we are leaking the original buf - had to lookup xdr_bytes() source to make sure we don't.
8180 Invalid netbuf decoded by xdr_netbuf()
Review Request #477 — Created May 8, 2017 and submitted
Information | |
---|---|
marcel | |
illumos-gate | |
master | |
8180 | |
5ab9496... | |
Reviewers | |
general | |
This fixes the xdr_netbuf() function both in libnsl(3nsl) and in kernel to do not produce a netbuf structure that violates the netbuf semantics.
I ran the test attached to the bug report: $ ./test maxlen: 65536 len: 1 Segmentation Fault (core dumped) $ LD_PRELOAD=$CODEMGR_WS/proto/root_i386/usr/lib/libnsl.so.1 ./test maxlen: 1 len: 1 $
-
-
usr/src/lib/libnsl/rpc/rpcb_prot.c (Diff revision 1) If consider xdr_u_int() as opaque function, this xdr_bytes call is not fine because it looks like xdr_bytes is called with overwritten @maxlen before.
I would suggest to rewrite this function in this manner (i.e. don't encode/decode maxlen to/from xdr stream at all):
xdr_netbuf(XDR xdrs, netbuf objp)
{/ optimized free /
if (x_op == XDR_FREE) {
return xdr_bytes(..., &objp->maxlen, objp->maxlen);
}/ other cases /
if (!xdr_bytes(.., &objp->buf, &objp->len, ~0)) {
return FALSE;
}/ follow the netbuf semantics /
if (x_op == XDR_DECODE && objp->maxlen == 0)
objp->maxlen = len;
}
Change Summary:
Added fix for
rdc_xdr_netbuf()
.
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 2 (+81 -56) |
-
-
usr/src/lib/libnsl/rpc/rpcb_prot.c (Diff revision 2) Could you use buf_save != NULL ? Or something buf_prep != NULL.
As Yuri mentioned and I agree with him, "buf != buf_save" is not clear and this can mean "was not changed" whereas originally idea is "original passed buf is not NULL"
Status: Closed (submitted)
Change Summary:
commit cfa354e4631308e491ed50bfe99d3cf93cc69bd9 Author: Marcel Telka <marcel@telka.sk> AuthorDate: Thu May 11 09:36:01 2017 +0200 Commit: Gordon Ross <gwr@nexenta.com> CommitDate: Sat May 13 17:12:32 2017 -0400 8180 Invalid netbuf decoded by xdr_netbuf() Reviewed by: Arne Jansen <arne@die-jansens.de> Reviewed by: Yuri Pankov <yuri.pankov@gmail.com> Reviewed by: Vitaliy Gusev <gusev.vitaliy@icloud.com> Approved by: Gordon Ross <gordon.w.ross@gmail.com> :100644 100644 d81e7e1... 464ce69... M usr/src/lib/libnsl/rpc/rpcb_prot.c :100644 100644 3bd8bc8... cf9055c... M usr/src/uts/common/avs/ns/rdc/rdc_prot.x :100644 100644 109cad8... ea14250... M usr/src/uts/common/avs/ns/rdc/rdc_svc.c :100644 100644 fcc1e54... 90a711c... M usr/src/uts/common/rpc/rpcb_prot.c