}
%}
+function __rqstp_uid:long(rqstp:long)
+{
+%( CONFIG_USER_NS == "y" %?
+ # Notice we're using the 'init_user_ns' here, not
+ # 'current_user_ns()'. This matches up with the use in
+ # net/sunrpc/auth_generic.c.
+ return %{ /* pure */
+ from_kuid_munged(&init_user_ns,
+ ((struct svc_rqst *)STAP_ARG_rqstp)->rq_cred.cr_uid) %}
+%:
+ return @cast(rqstp, "svc_rqst")->rq_cred->cr_uid
+%)
+}
+
+function __rqstp_gid:long(rqstp:long)
+{
+%( CONFIG_USER_NS == "y" %?
+ # Notice we're using the 'init_user_ns' here, not
+ # 'current_user_ns()'. This matches up with the use in
+ # net/sunrpc/auth_generic.c.
+ return %{ /* pure */
+ from_kgid_munged(&init_user_ns,
+ ((struct svc_rqst *)STAP_ARG_rqstp)->rq_cred.cr_gid) %}
+%:
+ return @cast(rqstp, "svc_rqst")->rq_cred->cr_gid
+%)
+}
+
/**
* probe nfsd.dispatch - NFS server receives an operation from client
*
filelen = $argp->len
filename = kernel_string_n($argp->name, $argp->len)
- uid = $rqstp->rq_cred->cr_uid
- gid = $rqstp->rq_cred->cr_gid
+ uid = __rqstp_uid($rqstp)
+ gid = __rqstp_gid($rqstp)
name = "nfsd.proc2.lookup"
argstr = sprintf("%s", kernel_string_n($argp->name, $argp->len))
filelen = $argp->len
filename = kernel_string_n($argp->name, $argp->len)
- uid = $rqstp->rq_cred->cr_uid
- gid = $rqstp->rq_cred->cr_gid
+ uid = __rqstp_uid($rqstp)
+ gid = __rqstp_gid($rqstp)
name = "nfsd.proc3.lookup"
argstr = sprintf("%s", kernel_string_n($argp->name, $argp->len))
filelen = $lookup->lo_len
filename = kernel_string_n($lookup->lo_name, $lookup->lo_len)
- uid = $rqstp->rq_cred->cr_uid
- gid = $rqstp->rq_cred->cr_gid
+ uid = __rqstp_uid($rqstp)
+ gid = __rqstp_gid($rqstp)
name = "nfsd.proc4.lookup"
argstr = sprintf("%s", kernel_string_n($lookup->lo_name, $lookup->lo_len))
vec = @choose_defined($rqstp->rq_vec, $argp->vec)
vlen = $argp->vlen
- uid = $rqstp->rq_cred->cr_uid
- gid = $rqstp->rq_cred->cr_gid
+ uid = __rqstp_uid($rqstp)
+ gid = __rqstp_gid($rqstp)
name = "nfsd.proc2.read"
argstr = sprintf("%d,%d",count,offset)
vec = @choose_defined($rqstp->rq_vec, $argp->vec)
vlen = $argp->vlen
- uid = $rqstp->rq_cred->cr_uid
- gid = $rqstp->rq_cred->cr_gid
+ uid = __rqstp_uid($rqstp)
+ gid = __rqstp_gid($rqstp)
name = "nfsd.proc3.read"
argstr = sprintf("%d,%d",count,offset)
vec = $rqstp->rq_vec
vlen = $read->rd_vlen
- uid = $rqstp->rq_cred->cr_uid
- gid = $rqstp->rq_cred->cr_gid
+ uid = __rqstp_uid($rqstp)
+ gid = __rqstp_gid($rqstp)
name = "nfsd.proc4.read"
argstr = sprintf("%d,%d",count,offset)
vlen = $argp->vlen
stable = 1 # hardcoded in nfsd_proc_write()
- uid = $rqstp->rq_cred->cr_uid
- gid = $rqstp->rq_cred->cr_gid
+ uid = __rqstp_uid($rqstp)
+ gid = __rqstp_gid($rqstp)
name = "nfsd.proc2.write"
argstr = sprintf("%d,%d",count,offset)
vlen = $argp->vlen
stable = $argp->stable
- uid = $rqstp->rq_cred->cr_uid
- gid = $rqstp->rq_cred->cr_gid
+ uid = __rqstp_uid($rqstp)
+ gid = __rqstp_gid($rqstp)
name = "nfsd.proc3.write"
argstr = sprintf("%d,%d",count,offset)
vlen = @choose_defined($write->wr_vlen, 0)
stable = $write->wr_stable_how
- uid = $rqstp->rq_cred->cr_uid
- gid = $rqstp->rq_cred->cr_gid
+ uid = __rqstp_uid($rqstp)
+ gid = __rqstp_gid($rqstp)
name = "nfsd.proc4.write"
argstr = sprintf("%d,%d",count,offset)
count = $argp->count
offset = $argp->offset
- uid = $rqstp->rq_cred->cr_uid
- gid = $rqstp->rq_cred->cr_gid
+ uid = __rqstp_uid($rqstp)
+ gid = __rqstp_gid($rqstp)
name = "nfsd.proc3.commit"
argstr = sprintf("%d,%d",count,offset)
count = $commit->co_count
offset = $commit->co_offset
- uid = $rqstp->rq_cred->cr_uid
- gid = $rqstp->rq_cred->cr_gid
+ uid = __rqstp_uid($rqstp)
+ gid = __rqstp_gid($rqstp)
name = "nfsd.proc4.commit"
argstr = sprintf("%d,%d",count,offset)
filename = kernel_string_n($argp->name, $argp->len)
createmode = 0 # gets computed by nfsd_proc_create
- uid = $rqstp->rq_cred->cr_uid
- gid = $rqstp->rq_cred->cr_gid
+ uid = __rqstp_uid($rqstp)
+ gid = __rqstp_gid($rqstp)
name = "nfsd.proc2.create"
argstr = sprintf("%s", kernel_string_n($argp->name, $argp->len))
filename = kernel_string_n($argp->name, $argp->len)
createmode = $argp->createmode
- uid = $rqstp->rq_cred->cr_uid
- gid = $rqstp->rq_cred->cr_gid
+ uid = __rqstp_uid($rqstp)
+ gid = __rqstp_gid($rqstp)
name = "nfsd.proc3.create"
argstr = sprintf("%s (mode=%s)",
filename = kernel_string_n($create->cr_name, $create->cr_namelen)
createmode = $create->cr_type
- uid = $rqstp->rq_cred->cr_uid
- gid = $rqstp->rq_cred->cr_gid
+ uid = __rqstp_uid($rqstp)
+ gid = __rqstp_gid($rqstp)
name = "nfsd.proc4.create"
argstr = sprintf("%s (type=%s)",
filelen = $argp->len
filename = kernel_string_n($argp->name, $argp->len)
- uid = $rqstp->rq_cred->cr_uid
- gid = $rqstp->rq_cred->cr_gid
+ uid = __rqstp_uid($rqstp)
+ gid = __rqstp_gid($rqstp)
name = "nfsd.proc2.remove"
argstr = sprintf("%s", kernel_string_n($argp->name, $argp->len))
filelen = $argp->len
filename = kernel_string_n($argp->name, $argp->len)
- uid = $rqstp->rq_cred->cr_uid
- gid = $rqstp->rq_cred->cr_gid
+ uid = __rqstp_uid($rqstp)
+ gid = __rqstp_gid($rqstp)
name = "nfsd.proc3.remove"
argstr = sprintf("%s", kernel_string_n($argp->name, $argp->len))
filelen = $remove->rm_namelen
filename = kernel_string_n($remove->rm_name, $remove->rm_namelen)
- uid = $rqstp->rq_cred->cr_uid
- gid = $rqstp->rq_cred->cr_gid
+ uid = __rqstp_uid($rqstp)
+ gid = __rqstp_gid($rqstp)
name = "nfsd.proc4.remove"
argstr = sprintf("%s",
tlen = $argp->tlen
tname = kernel_string_n($argp->tname, $argp->tlen)
- uid = $rqstp->rq_cred->cr_uid
- gid = $rqstp->rq_cred->cr_gid
+ uid = __rqstp_uid($rqstp)
+ gid = __rqstp_gid($rqstp)
name = "nfsd.proc2.rename"
argstr = sprintf("%s to %s",
tlen = $argp->tlen
tname = kernel_string_n($argp->tname, $argp->tlen)
- uid = $rqstp->rq_cred->cr_uid
- gid = $rqstp->rq_cred->cr_gid
+ uid = __rqstp_uid($rqstp)
+ gid = __rqstp_gid($rqstp)
name = "nfsd.proc3.rename"
argstr = sprintf("%s to %s",
tlen = $rename->rn_tnamelen
tname = kernel_string_n($rename->rn_tname, $rename->rn_tnamelen)
- uid = $rqstp->rq_cred->cr_uid
- gid = $rqstp->rq_cred->cr_gid
+ uid = __rqstp_uid($rqstp)
+ gid = __rqstp_gid($rqstp)
name = "nfsd.proc4.rename"
argstr = sprintf("%s to %s",
*
* @filename: file name
*/
-probe nfsd.close = kernel.function("nfsd_close") !,
- module("nfsd").function("nfsd_close") ?
+probe nfsd.close = __nfsd.call_close ?, __nfsd.inlined_close ?
{
client_ip ="N/A"
- filename = __file_filename($filp)
-
name = "nfsd.close"
argstr = sprintf("%s",filename)
}
+/*
+ * Why split nfsd.close up into '__nfsd.call_close' and
+ * '__nfds.inlined_close'? We need the '@choose_defined()' since
+ * SystemTap has trouble accessing the arguments of inlined functions
+ * (PR 1155). But, if we only used '@choose_defined()', we wouldn't
+ * automatically notice a change in the argument name.
+ */
+probe __nfsd.call_close = kernel.function("nfsd_close").call !,
+ module("nfsd").function("nfsd_close").call ?
+{
+ filename = __file_filename($filp)
+}
+probe __nfsd.inlined_close = kernel.function("nfsd_close").inline !,
+ module("nfsd").function("nfsd_close").inline ?
+{
+ filename = __file_filename(@choose_defined($filp, 0))
+}
probe nfsd.close.return = kernel.function("nfsd_close").return !,
module("nfsd").function("nfsd_close").return ?