From owner-svn-src-head@FreeBSD.ORG Thu Apr 12 15:06:58 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 7409D106564A; Thu, 12 Apr 2012 15:06:58 +0000 (UTC) (envelope-from pluknet@gmail.com) Received: from mail-lpp01m010-f54.google.com (mail-lpp01m010-f54.google.com [209.85.215.54]) by mx1.freebsd.org (Postfix) with ESMTP id 5B6108FC08; Thu, 12 Apr 2012 15:06:57 +0000 (UTC) Received: by lagv3 with SMTP id v3so2155365lag.13 for ; Thu, 12 Apr 2012 08:06:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=X42I/aUnKx8Rla2NNKtWYzj0eBzbTd8+cvoyrMofwqQ=; b=DrdTr5m1Gnq9c4ufhDUFGsLykASZ7S7arZL4aJTchFt2SC63RJDWVfivH43K/zX2sB kd5ChG2Ho+0NCuU+bthhSHWY5J4nHdbq/3PApLkZd26g2tE4WJDezavw6G9WXyW4E0en JUPHkRmSQYnRezrpTEj0cdvV9EOK33rT+ga9IGOi1Ub7ELt2Rourvw5h5P8isxdJpEPf +n1FATRy+lEExFfVNqyMWsjpVIoK146038nsjrwmUuHVsSuBc6eRVV5JIBYG0Sr9f5uK Nb5BBqF/v6DYvOKAnLLBgJZ6BERN6r025N2mMrYLHkgH37uC8tRJuxRmo1w8lNETAA+l 7mXg== MIME-Version: 1.0 Received: by 10.112.25.130 with SMTP id c2mr1217169lbg.107.1334243216315; Thu, 12 Apr 2012 08:06:56 -0700 (PDT) Sender: pluknet@gmail.com Received: by 10.152.25.69 with HTTP; Thu, 12 Apr 2012 08:06:56 -0700 (PDT) In-Reply-To: <201204121449.q3CEnP8L033082@svn.freebsd.org> References: <201204121449.q3CEnP8L033082@svn.freebsd.org> Date: Thu, 12 Apr 2012 19:06:56 +0400 X-Google-Sender-Auth: H007v4XVVdqU9r33Lltf7O7IuqY Message-ID: From: Sergey Kandaurov To: John Baldwin Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r234186 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Apr 2012 15:06:58 -0000 On 12 April 2012 18:49, John Baldwin wrote: > Author: jhb > Date: Thu Apr 12 14:49:25 2012 > New Revision: 234186 > URL: http://svn.freebsd.org/changeset/base/234186 > > Log: > =A0If a linker file contains at least one module, but all of the modules > =A0fail to load (the MOD_LOAD event fails) during a kldload(2), unload th= e > =A0linker file and fail the kldload(2) with ENOEXEC. > > =A0Reported by: =A0gcooper > =A0MFC after: =A0 =A01 week > > Modified: > =A0head/sys/kern/kern_linker.c > > Modified: head/sys/kern/kern_linker.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/kern/kern_linker.c Thu Apr 12 14:06:05 2012 =A0 =A0 =A0 =A0(= r234185) > +++ head/sys/kern/kern_linker.c Thu Apr 12 14:49:25 2012 =A0 =A0 =A0 =A0(= r234186) > @@ -380,7 +380,7 @@ linker_load_file(const char *filename, l > =A0{ > =A0 =A0 =A0 =A0linker_class_t lc; > =A0 =A0 =A0 =A0linker_file_t lf; > - =A0 =A0 =A0 int foundfile, error; > + =A0 =A0 =A0 int foundfile, error, modules; > > =A0 =A0 =A0 =A0/* Refuse to load modules if securelevel raised */ > =A0 =A0 =A0 =A0if (prison0.pr_securelevel > 0) > @@ -419,11 +419,22 @@ linker_load_file(const char *filename, l > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0linker_fil= e_unload(lf, LINKER_UNLOAD_FORCE); > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0return (er= ror); > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0} > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 modules =3D !TAILQ_EMPTY(&l= f->modules); > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0KLD_UNLOCK(); > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0linker_file_register_sysct= ls(lf); > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0linker_file_sysinit(lf); > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0KLD_LOCK(); > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0lf->flags |=3D LINKER_FILE= _LINKED; > + > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 /* > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0* If all of the modules = in this file failed > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0* to load, unload the fi= le and return an > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0* error of ENOEXEC. > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0*/ > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (modules && TAILQ_EMPTY(= &lf->modules)) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 linker_file= _unload(lf, LINKER_UNLOAD_FORCE); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (ENO= EXEC); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 } > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0*result =3D lf; > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0return (0); > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0} > @@ -627,7 +638,7 @@ linker_file_unload(linker_file_t file, i > > =A0 =A0 =A0 =A0/* > =A0 =A0 =A0 =A0 * Inform any modules associated with this file that they = are > - =A0 =A0 =A0 =A0* being be unloaded. > + =A0 =A0 =A0 =A0* being unloaded. > =A0 =A0 =A0 =A0 */ > =A0 =A0 =A0 =A0MOD_XLOCK; > =A0 =A0 =A0 =A0for (mod =3D TAILQ_FIRST(&file->modules); mod; mod =3D nex= t) { Thanks. I have had exactly this change in my local tree, but I didn't commit it for some reasons I don't recall... --=20 wbr, pluknet