From owner-freebsd-hackers@FreeBSD.ORG Fri Nov 1 18:31:07 2013 Return-Path: Delivered-To: hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 36CFCF0E for ; Fri, 1 Nov 2013 18:31:07 +0000 (UTC) (envelope-from vijju.singh@gmail.com) Received: from mail-ee0-x230.google.com (mail-ee0-x230.google.com [IPv6:2a00:1450:4013:c00::230]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id C71F42F75 for ; Fri, 1 Nov 2013 18:31:06 +0000 (UTC) Received: by mail-ee0-f48.google.com with SMTP id d49so2144243eek.21 for ; Fri, 01 Nov 2013 11:31:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=NoaoRnX8gfYJJS/lrufLZe43gYFKX9sQd47lMsoO9O0=; b=VsWMXiiqbouw9V11AkklyufbStKcOFSw0hOUhg4dL6D0JpxoSxFNVrYy5lBSe4A8Te Ay1q2CExVoa5lTTbET3nLngP7EhkGDF7e6ewcDbWWMB1XDy4kIQi2+PAC65z9bMiffQN 5/jo/QOioJnnOAbsPuIMagadFBgBc3R6WrLlmvn2wr7eLEWMZMqquREFbtT/943kebWt sfcpK0lJIfPs8OaLExQ3Jbsjr91gz4py/9HItHufAXWboHQ5wvLdwggAaB/EvN+j4ZoK LIYRI6gHaWAVPm1bR4maaJ3Fpw66ooDZjUSJ2t1ytDu5uVZ1zh0rvM5JC3KjabJetTV1 f1SA== MIME-Version: 1.0 X-Received: by 10.14.173.198 with SMTP id v46mr443110eel.132.1383330665144; Fri, 01 Nov 2013 11:31:05 -0700 (PDT) Received: by 10.223.152.72 with HTTP; Fri, 1 Nov 2013 11:31:05 -0700 (PDT) Date: Fri, 1 Nov 2013 11:31:05 -0700 Message-ID: Subject: regd. thread ucred update in kern_accessat() From: Vijay Singh To: hackers@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.14 X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Nov 2013 18:31:07 -0000 Hi hackers. In kern_accessat() [I'm looking at 8.2 code], for the case where flags doesn't have AT_EACCESS set, we make a local copy of the thread ucred. This is then passed in to vn_access(). My question is why we update td->td_ucred with this temporary ucred? tmpcred = crdup(cred); tmpcred->cr_uid = cred->cr_ruid; tmpcred->cr_groups[0] = cred->cr_rgid; ==> td->td_ucred = tmpcred; At this point p->p_ucred != td->td_ucred. Couldn't this cause issues? Wouldn't it just suffice to use the tempcred as an argument to vn_access() and leave the thread's ucred intact? -vijay