From owner-freebsd-questions@FreeBSD.ORG Tue May 22 21:06:22 2012 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 44194106566B for ; Tue, 22 May 2012 21:06:22 +0000 (UTC) (envelope-from bonomi@mail.r-bonomi.com) Received: from mail.r-bonomi.com (mx-out.r-bonomi.com [204.87.227.120]) by mx1.freebsd.org (Postfix) with ESMTP id 028818FC08 for ; Tue, 22 May 2012 21:06:21 +0000 (UTC) Received: (from bonomi@localhost) by mail.r-bonomi.com (8.14.4/rdb1) id q4ML84Zc070244; Tue, 22 May 2012 16:08:04 -0500 (CDT) Date: Tue, 22 May 2012 16:08:04 -0500 (CDT) From: Robert Bonomi Message-Id: <201205222108.q4ML84Zc070244@mail.r-bonomi.com> To: freebsd-questions@freebsd.org, tomdean@speakeasy.org In-Reply-To: <4FBBF36F.9000804@speakeasy.org> Cc: Subject: Re: Using inb() and outb() X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 May 2012 21:06:22 -0000 > From owner-freebsd-questions@freebsd.org Tue May 22 15:18:43 2012 > Date: Tue, 22 May 2012 13:13:35 -0700 > From: "Thomas D. Dean" > To: freebsd-questions@freebsd.org > Subject: Using inb() and outb() > > I have nanoBSD running a hardware control application. > > To do this, I need inb() and outb() functions. > > I an do this as root. However, it is better if none of the control > system is run as root. > > How do I allow these functions to one specific user? To do that, you would have to re-build a significant portion of the security controls of the O/S. Good luck. 'regular' users are simply -not- allowed to acces hardware I/O ports directly. Only the 'superuser' can do that. Thus, to use inb()/outb() the application must be running with EUID 0. No other options. If you don't want the application to run as root, The only other option is to write an actual 'device driver' -- which would execute as part of the kernel -- that provides the required functionality to the app, and does the actual hardware port IN/OUT operations iself, inside the driver.