From owner-svn-src-head@FreeBSD.ORG Tue Apr 1 01:25:01 2014 Return-Path: Delivered-To: svn-src-head@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 ESMTPS id 9F4E4890; Tue, 1 Apr 2014 01:25:01 +0000 (UTC) Received: from mail-wg0-x22e.google.com (mail-wg0-x22e.google.com [IPv6:2a00:1450:400c:c00::22e]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E5DDADF1; Tue, 1 Apr 2014 01:25:00 +0000 (UTC) Received: by mail-wg0-f46.google.com with SMTP id b13so6756817wgh.5 for ; Mon, 31 Mar 2014 18:24:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:subject:message-id:mime-version:content-type :content-disposition:user-agent; bh=273sFTQPG3Br0mYOarLgJnkOpoxHBJrAnQl/iRpWwak=; b=FpesCDy73Suslqf9DLBF3LaDGDHuwXW3mL7kJaQuTgxoE9zrnSrhiLcfHVqDU49B7t 3GXCg+pLBZiubc4ffOxPDPzUHehmFL8D05wRs9vrKkQiyj0pp/N6RVRyyza9CbZZQIir piXmy2A2L5fbCmeWxFId628R9nvzwFY/GbVIxXDPHxY9gRb3qfrqZZLchlbR8YSDA+QE IScF2135oId4IqAIAW76fKxC6GJfisHc8ovETtFTInxhj7IZyHyHldFMoJaj7W2Z5nL2 F81UZo0ckIQEtEXsC/968PWXu7u1K8I1cDGM5BFbqoJPVX9LnYjtfsLeaTTOP/Jg+Rn4 8Elg== X-Received: by 10.194.190.42 with SMTP id gn10mr18702034wjc.9.1396315499303; Mon, 31 Mar 2014 18:24:59 -0700 (PDT) Received: from dft-labs.eu (n1x0n-1-pt.tunnel.tserv5.lon1.ipv6.he.net. [2001:470:1f08:1f7::2]) by mx.google.com with ESMTPSA id ff9sm29888641wib.11.2014.03.31.18.24.57 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 31 Mar 2014 18:24:58 -0700 (PDT) Sender: Mateusz Guzik Date: Tue, 1 Apr 2014 03:24:55 +0200 From: Mateusz Guzik To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r263981 - in head: lib/libc/gen sys/kern sys/sys Message-ID: <20140401012455.GA26117@dft-labs.eu> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 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: Tue, 01 Apr 2014 01:25:01 -0000 Author: mjg Date: Tue Apr 1 03:20:35 2014 New Revision: 263981 URL: http://svnweb.freebsd.org/changeset/base/263981 Log: Add a new errno: EMACS - Editor too big. Make a best-effort to detect that Emacs is about to executed and return the error. MFC after: 1 week Modified: head/lib/libc/gen/errlst.c head/sys/kern/kern_exec.c head/sys/sys/errno.h Modified: lib/libc/gen/errlst.c =================================================================== --- head/lib/libc/gen/errlst.c (263980) +++ head/lib/libc/gen/errlst.c (263981) @@ -155,6 +155,7 @@ "Not permitted in capability mode", /* 94 - ECAPMODE */ "State not recoverable", /* 95 - ENOTRECOVERABLE */ "Previous owner died", /* 96 - EOWNERDEAD */ + "Editor too big", /* 97 - EMACS */ }; const int sys_nerr = sizeof(sys_errlist) / sizeof(sys_errlist[0]); Modified: sys/kern/kern_exec.c =================================================================== --- head/sys/kern/kern_exec.c (263980) +++ head/sys/kern/kern_exec.c (263981) @@ -337,6 +337,7 @@ int (*img_first)(struct image_params *); struct pargs *oldargs = NULL, *newargs = NULL; struct sigacts *oldsigacts, *newsigacts; + char *e; #ifdef KTRACE struct vnode *tracevp = NULL; struct ucred *tracecred = NULL; @@ -418,6 +419,19 @@ SDT_PROBE(proc, kernel, , exec, args->fname, 0, 0, 0, 0 ); + /* + * A best-effort to check whether the file to be run is EMACS + */ + if (args->fname != NULL) { + e = args->fname + strlen(args->fname); + while (e > args->fname && *e != '/') + e--; + if (strcasecmp(e, "/emacs") == 0) { + error = EMACS; + goto exec_fail; + } + } + interpret: if (args->fname != NULL) { #ifdef CAPABILITY_MODE Modified: sys/sys/errno.h =================================================================== --- head/sys/sys/errno.h (263980) +++ head/sys/sys/errno.h (263981) @@ -178,10 +178,11 @@ #define ECAPMODE 94 /* Not permitted in capability mode */ #define ENOTRECOVERABLE 95 /* State not recoverable */ #define EOWNERDEAD 96 /* Previous owner died */ +#define EMACS 97 /* Editor too big */ #endif /* _POSIX_SOURCE */ #ifndef _POSIX_SOURCE -#define ELAST 96 /* Must be equal largest errno */ +#define ELAST 97 /* Must be equal largest errno */ #endif /* _POSIX_SOURCE */ #ifdef _KERNEL