Re: [PATCH] add lock hook to prevent race

From: Antony Edwards (aedwardat_private)
Date: Fri Jan 18 2002 - 08:29:46 PST

  • Next message: Amandeep Singh: "Ipchains firewall rules"

    Hi,
    
    > I realize that copy_from_user can sleep in the fucntions
    > fcntl_[gs]etlk(64), but it's not clear to me what could
    > be raceable if that (kernel) interface was changed to
    > using the already looked up filp instead of the fd.
    > any ideas?
    
    If fcntl_*lck* was passed the already looked up filp (as
    the other handlers in do_fcntl are) then I don't think
    there is any race. The filp has a non-zero ref-count and
    is passed on the stack, so there's no way another thread
    can mess around with any relationships.
    
    I think changing the kernel interface is a much cleaner
    solution (better to prevent the race than detect it),
    and would be happy to provide a patch to do it. I just
    didn't want to change any base kernel interfaces in
    my original patch for acceptance.
    
    BTW, looking around this morning I found a bug in my
    patch. When the lock hooks fail they should "goto
    out_putf", not "goto out". I've attached the new patch.
    
    Antony
    
    (See attached file: lsm-2.5.2-locks-3.patch)
    
    

    _______________________________________________ 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 : Fri Jan 18 2002 - 08:33:55 PST