From owner-freebsd-arch@FreeBSD.ORG Thu Dec 29 18:20:42 2011 Return-Path: Delivered-To: arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A748A106566B; Thu, 29 Dec 2011 18:20:42 +0000 (UTC) (envelope-from delphij@gmail.com) Received: from mail-tul01m020-f182.google.com (mail-tul01m020-f182.google.com [209.85.214.182]) by mx1.freebsd.org (Postfix) with ESMTP id 55A9A8FC19; Thu, 29 Dec 2011 18:20:42 +0000 (UTC) Received: by obbwd18 with SMTP id wd18so14563067obb.13 for ; Thu, 29 Dec 2011 10:20:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=6UFGoWNPCkywx7Z5WV8JXZ9Rj+cHEt16ELED2FDuZbk=; b=MwPPxH6Kno9ElMz7fWFtrH7UY3glfJkstJmb+VlLV78XocfcXAOFn0OWR/cDhu2h3C QvzInZkVgAWcNuYTQ2JItFF03PIHha8R1Nv1O4j3jRFHwFiGfF9rFcwacPlwuZzF6I8c rtNCwhHXPHtlzl+urVfvK++dxesOfUz2TPYLM= MIME-Version: 1.0 Received: by 10.182.76.134 with SMTP id k6mr23707183obw.10.1325182841890; Thu, 29 Dec 2011 10:20:41 -0800 (PST) Received: by 10.182.67.163 with HTTP; Thu, 29 Dec 2011 10:20:41 -0800 (PST) In-Reply-To: <20111229113829.GF50300@deviant.kiev.zoral.com.ua> References: <20111229084308.GD50300@deviant.kiev.zoral.com.ua> <20111229113829.GF50300@deviant.kiev.zoral.com.ua> Date: Thu, 29 Dec 2011 10:20:41 -0800 Message-ID: From: Xin LI To: Kostik Belousov Content-Type: text/plain; charset=UTF-8 Cc: kan@freebsd.org, arch@freebsd.org, des@freebsd.org Subject: Re: fdlopen(3) X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Dec 2011 18:20:42 -0000 On Thu, Dec 29, 2011 at 3:38 AM, Kostik Belousov wrote: > On Thu, Dec 29, 2011 at 03:15:09AM -0800, Xin LI wrote: >> Hi, >> >> On Thu, Dec 29, 2011 at 12:43 AM, Kostik Belousov wrote: >> > Hello, >> > below is the patch to add fdlopen(3) function to rtld. It allows to load >> > shared object referenced by the opened file descriptor. Intent is to allow >> > the caller to do some additional checks on the object before committing >> > to load it, in race-free manner. >> > >> > The facility was requested by des@, who also tested the patch. >> > >> > I will commit this shortly unless somebody objects. >> >> Will this prevent e.g. writes to the .so file after open, but before fdlopen()? > > How can it ? Even in theory ? e.g. process 1 open(), check for permissions, etc., then process 2 open() for write, write something, then process proceed with fdlopen()? (We do not have mandatory "lock" on file handles to prevent writing I think?). But no, this is not a "major" concern and yes, I think fdlopen() is something good to have. Cheers, -- Xin LI https://www.delphij.net/ FreeBSD - The Power to Serve! Live free or die