OpenAFS Master Repository branch, openafs-stable-1_6_x, updated. openafs-stable-1_6_24-92-g304a589

Gerrit Code Review gerrit@openafs.org
Tue, 22 Oct 2019 19:24:23 -0400


The following commit has been merged in the openafs-stable-1_6_x branch:
commit 2a7b4b891bec730a6c4f58e3b5976383e4c179c1
Author: Andrew Deason <adeason@sinenomine.net>
Date:   Wed Aug 7 21:19:47 2019 -0500

    OPENAFS-SA-2019-002: Zero all server RPC args
    
    Currently, our server-side RPC argument-handling code generated from
    rxgen initializes complex arguments like so (for example, in
    _RXAFS_BulkStatus):
    
        AFSCBFids FidsArray;
        AFSBulkStats StatArray;
        AFSCBs CBArray;
        AFSVolSync Sync;
    
        FidsArray.AFSCBFids_val = 0;
        FidsArray.AFSCBFids_len = 0;
        CBArray.AFSCBs_val = 0;
        CBArray.AFSCBs_len = 0;
        StatArray.AFSBulkStats_val = 0;
        StatArray.AFSBulkStats_len = 0;
    
    This is done for any input or output arguments, but only for types we
    need to free afterwards (arrays, usually). We do not do this for
    simple types, like single flat structs. In the above example, we do
    this for the arrays FidsArray, StatArray, and CBArray, but 'Sync' is
    not initialized to anything.
    
    If some server RPC handlers never set a value for an output argument,
    this means we'll send uninitialized stack memory to our peer.
    Currently this can happen in, for example,
    MRXSTATS_RetrieveProcessRPCStats if 'rxi_monitor_processStats' is
    unset (specifically, the 'clock_sec' and 'clock_usec' arguments are
    never set when rx_enableProcessRPCStats() has not been called).
    
    To make sure we cannot send uninitialized data to our peer, change
    rxgen to instead 'memset(&arg, 0, sizeof(arg));' for every single
    parameter. Using memset in this way just makes this a little simpler
    inside rxgen, since all we need to do this is the name of the
    argument.
    
    With this commit, the rxgen-generated code for the above example now
    looks like this:
    
        AFSCBFids FidsArray;
        AFSBulkStats StatArray;
        AFSCBs CBArray;
        AFSVolSync Sync;
    
        memset(&FidsArray, 0, sizeof(FidsArray));
        memset(&CBArray, 0, sizeof(CBArray));
        memset(&StatArray, 0, sizeof(StatsArray));
        memset(&Sync, 0, sizeof(Sync));
    
    Reviewed-on: https://gerrit.openafs.org/13914
    Reviewed-by: Andrew Deason <adeason@sinenomine.net>
    Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
    Tested-by: BuildBot <buildbot@rampaginggeek.com>
    (cherry picked from commit 93aee3cf40622993b95bd1af77080a31670c24bb)
    
    Reviewed-on: https://gerrit.openafs.org/13917
    Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
    Tested-by: Benjamin Kaduk <kaduk@mit.edu>
    (cherry picked from commit fcaac44f845d18d6fd5d2f3685db11118d8f8626)
    
    Change-Id: Ic096570e9c894fb05d084ba451beabda3bb295e2
    Reviewed-on: https://gerrit.openafs.org/13922
    Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
    Tested-by: BuildBot <buildbot@rampaginggeek.com>

 src/rxgen/rpc_parse.c |   20 +++++++++-----------
 1 files changed, 9 insertions(+), 11 deletions(-)

-- 
OpenAFS Master Repository