Correct incantation to get a string in sys_security?

From: David Wheeler (dwheelerat_private)
Date: Tue Sep 03 2002 - 09:08:27 PDT

  • Next message: David Wheeler: "Re: linux-security-module digest, Vol 1 #577 - 1 msg"

    Hi folks - I need some quick help.
    What's the proper incantation to use in sys_security()
    to acquire a string sent from userspace
    as the first parameter of "args"?
    
    As you know, sys_security has this form:
    static int stacker_sys_security (unsigned int id, unsigned int call,
                                    unsigned long *args)
    
    I check for the correct id, then check for certain call values,
    and for certain call values I need the user to pass in a
    C string (\0-terminated, with a maximum size).
    get_user() seems to be for single characters, so that's not
    what I want.
    
    Preprocessor-defined copy_from_user() takes a constant length,
    which isn't really what I want. I guess that could do if necessary,
    though I'd prefer to stop copying on \0 (to avoid funky problems if
    there isn't valid memory if I do a full copy).
    The documentation on copy_from_user is pitiful;
    I'm not sure what I can trust and I'm not sure what
    incantations are necessary to use it to get the string I need.
    
    Suggestions welcome!  I suspect for somebody here, this is an
    easy question.
    
    
    --- David A. Wheeler
    
    
    
    
    _______________________________________________
    linux-security-module mailing list
    linux-security-moduleat_private
    http://mail.wirex.com/mailman/listinfo/linux-security-module
    



    This archive was generated by hypermail 2b30 : Tue Sep 03 2002 - 09:15:42 PDT