Project

General

Profile

Actions

Bug #4394

closed

svc_create(3nsl) registers with garbage address

Added by Marcel Telka over 9 years ago. Updated over 8 years ago.

Status:
Rejected
Priority:
Normal
Assignee:
-
Category:
lib - userland libraries
Start date:
2013-12-12
Due date:
% Done:

0%

Estimated time:
Difficulty:
Medium
Tags:
needs-triage
Gerrit CR:
External Bug:

Description

The svc_create(3nsl) function registers with garbage address over ticlts, ticotsord, and ticots transports. It is easily reproducible:

$ cat svc_cr.c 
#include <rpc/rpc.h>

static void
fnc(struct svc_req *rqstp, SVCXPRT *transp)
{
}

int main(void)
{
    svc_create(fnc, 1, 1, NULL);
}
$ gcc -o svc_cr -lnsl svc_cr.c 
$ ./svc_cr 
$ rpcinfo | tail
    100003    4    tcp       0.0.0.0.8.1         nfs        1
    100227    2    tcp       0.0.0.0.8.1         nfs_acl    1
    100227    3    tcp       0.0.0.0.8.1         nfs_acl    1
         1    1    udp6      ::.202.132          -          101
         1    1    tcp6      ::.231.47           -          101
         1    1    udp       0.0.0.0.213.250     -          101
         1    1    tcp       0.0.0.0.188.39      -          101
         1    1    ticlts    \\251\\240\\000\\000    -          101
         1    1    ticotsord \\254\\240\\000\\000    -          101
         1    1    ticots    \\257\\240\\000\\000    -          101
$

Files

garbage.c (689 Bytes) garbage.c Marcel Telka, 2015-02-19 06:35 PM
Actions #1

Updated by Marcel Telka over 8 years ago

Actually, this is not a bug, it is a feature of the Local Transport Provider (tl kernel module). In a case there is no requested address used in the t_bind(3nsl) call (the req argument), the underlying transport (tl in our case) will assign its own address and return it in ret. This address is further used for registration with rpcbind(1m).

Since we do not specify any address in the svc_create() call (there is no way how to do that), internally the t_bind(3nsl) is called without the req address.

This could be well demonstrated using the attached garbage.c test:

# # gcc -Wall -lnsl -o garbage garbage.c
# ./garbage ticlts
uaddr: \\373\\003\\000\\000
# ./garbage tcp
uaddr: 0.0.0.0.147.50
#
Actions

Also available in: Atom PDF