Re: about security_skb_alloc??

From: Seth Arnold (sarnold@private)
Date: Mon Sep 22 2003 - 00:17:59 PDT

  • Next message: Roger Rodrigues: "Man to Boy love"

    On Sun, Sep 21, 2003 at 05:20:12PM +0800, Yuan ChunYang wrote:
    > hi, i am  programing a module using LSM hooks function. But it often
    > shutdown my computer. And you can not know when it will happen and
    > happens suddenly .I do not catch the reason now. But from the debug, i
    > find that there maybe are mistakes in security_skb_alloc hooks function.
    
    > 	/* Often shutdown HERE !!! */
    > 	ssec = (struct skb_security_struct *)kmalloc(sizeof(struct
    > skb_security_struct), GFP_ATOMIC); 
    
    Poking around, it appears to me that this hook has been passed the GFP
    mask value that you should use when allocating memory. Have you tried
    using it instead of GFP_ATOMIC? (Do you -know- that GFP_ATOMIC is the
    right mask to use?)
    
    >     Is it necessary to add reference count in sk_buff security struct
    > when clone ? I think it only copy control struct and security struct 
    > but not copy data when clone a sk_buff. So it's necessary to add another
    > reference count in security struct because there is a reference count in
    > sk_buff struct. It's right?
    
    I -think- this depends upon your code. I think you could code your module
    such that you need to maintain a reference count (say, if your sk_buff
    security structs are shared when cloned), or that you do NOT need to
    maintain a reference count (say, if your sk_buff security structs are
    copied when cloned, so no struct is used more than once).
    
    I think this is up to your goals. :)
    
    Hope this helps
    
    -- 
    You too can spend five years in prison; just distribute this program
    once US Senator Hollings's CBDTPA bill is passed into law:
    perl -e 'while(<>) { print;}'
    
    
    



    This archive was generated by hypermail 2b30 : Mon Sep 22 2003 - 00:18:50 PDT