From: KaiGai Kohei <kaigai@ak.jp.nec.com>
To: Eamon Walsh <ewalsh@tycho.nsa.gov>
Cc: Joshua Brindle <jbrindle@tresys.com>,
"Christopher J. PeBenito" <cpebenito@tresys.com>,
Stephen Smalley <sds@tycho.nsa.gov>,
SELinux Mail List <selinux@tycho.nsa.gov>,
KaiGai Kohei <kaigai@kaigai.gr.jp>
Subject: Re: object class discovery userland
Date: Wed, 30 May 2007 11:20:04 +0900 [thread overview]
Message-ID: <465CDF54.9050300@ak.jp.nec.com> (raw)
In-Reply-To: <465750DF.1050509@tycho.nsa.gov>
Eamon Walsh wrote:
> Here's a first go at an interface. It's an init function that is a
> replacement for avc_init(). It takes flags, the class/permission
> mapping to use, and callback functions.
>
> This is trying to solve a few other problems at the same time, namely:
>
> - selinux prefix on the function name
> - drops support for memory, threading, and locking callbacks (would just
> always use malloc and pthread)
> - adds type code to logging callback
Eamon,
At first, I want to confirm whether the new selinux_init() intend to
place userspace AVC on shared memory segment, or not.
(SE-PostgreSQL has its userspace avc on shared memory segment.)
When we put userspace AVC on shared memory segment, following points
should be paid attention.
- Locking primitive
Several processes can refer the userspace AVC on shmem, so inter-processes
locking primitive are necessary.
- Memory allocation
Allocating small memory block on shared memory segment is not simple as
malloc(). In SE-PostgreSQL case, a fixed length region is assigned by
shared memory management subsystem during process initialization.
From same reason, we cannot have a mapping table between security context
and SID value on the region managed by libselinux, because the total length
of security context is not clear when we call selinux_init().
IMO, Locking callbacks and an option which enables to place userspace AVC
on given memory region (including fixed length shmem) are desirable.
Thanks,
> selinux.h | 37 +++++++++++++++++++++++++++++++++++++
> 1 file changed, 37 insertions(+)
>
>
> Index: libselinux/include/selinux/selinux.h
> ===================================================================
> --- libselinux/include/selinux/selinux.h (revision 2445)
> +++ libselinux/include/selinux/selinux.h (working copy)
> @@ -132,6 +132,43 @@
> unsigned int seqno;
> };
>
> + struct av_mapping {
> + const char *name;
> + const access_vector_t value;
> + };
> +
> + struct security_class_mapping {
> + const char *name;
> + const security_class_t value;
> + const struct av_mapping *perms;
> + };
> +
> +/* Initialization routine for caching functions offered by the library */
> +
> + struct selinux_callbacks {
> + /* log the printf-style format and arguments,
> + with the type code indicating the type of message */
> + int (*func_log) (int type, const char *fmt, ...);
> + /* store a string representation of auditdata (corresponding
> + to the given security class) into msgbuf. */
> + void (*func_audit) (void *auditdata, security_class_t cls,
> + char *msgbuf, size_t msgbufsize);
> + };
> +
> + extern int selinux_init(int flags,
> + const struct security_class_mapping *map,
> + const struct selinux_callbacks *callbacks);
> +
> + /* Available flags */
> +#define SELINUX_THREAD 1
> +#define SELINUX_AVC 2
> +
> + /* Logging type codes, passed to the logging callback */
> +#define SELINUX_ERROR 0
> +#define SELINUX_WARNING 1
> +#define SELINUX_INFO 2
> +#define SELINUX_AVC_DENIAL 3
> +
> /* Compute an access decision. */
> extern int security_compute_av(security_context_t scon,
> security_context_t tcon,
>
>
--
Open Source Software Promotion Center, NEC
KaiGai Kohei <kaigai@ak.jp.nec.com>
--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with
the words "unsubscribe selinux" without quotes as the message.
next prev parent reply other threads:[~2007-05-30 2:20 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-04-20 14:01 object class discovery userland Christopher J. PeBenito
2007-04-20 14:04 ` Joshua Brindle
2007-04-20 14:17 ` Karl MacMillan
2007-04-20 14:23 ` Joshua Brindle
2007-04-20 14:22 ` Karl MacMillan
2007-04-20 14:27 ` Joshua Brindle
2007-04-20 14:58 ` KaiGai Kohei
2007-04-20 15:32 ` Christopher J. PeBenito
2007-04-20 16:54 ` Eamon Walsh
2007-04-20 17:02 ` Eamon Walsh
2007-04-20 17:19 ` Christopher J. PeBenito
2007-04-23 14:33 ` Stephen Smalley
2007-04-23 14:43 ` Joshua Brindle
2007-04-23 14:58 ` Stephen Smalley
2007-05-23 14:17 ` Christopher J. PeBenito
2007-05-23 18:51 ` Eamon Walsh
2007-05-24 23:46 ` Eamon Walsh
2007-05-24 23:55 ` Joshua Brindle
2007-05-25 0:00 ` Joshua Brindle
2007-05-25 21:10 ` Eamon Walsh
2007-05-25 22:36 ` Joshua Brindle
2007-05-29 17:50 ` Eamon Walsh
2007-05-29 18:36 ` Stephen Smalley
2007-05-29 18:24 ` Stephen Smalley
2007-05-29 19:17 ` Eamon Walsh
2007-05-30 2:20 ` KaiGai Kohei [this message]
2007-05-30 20:01 ` Eamon Walsh
2007-05-31 13:28 ` KaiGai Kohei
2007-06-01 17:18 ` Eamon Walsh
2007-05-29 18:19 ` Stephen Smalley
2007-05-29 19:06 ` Eamon Walsh
-- strict thread matches above, loose matches on Subject: below --
2007-04-23 16:33 Nick Nam
2007-04-23 16:36 Nick Nam
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=465CDF54.9050300@ak.jp.nec.com \
--to=kaigai@ak.jp.nec.com \
--cc=cpebenito@tresys.com \
--cc=ewalsh@tycho.nsa.gov \
--cc=jbrindle@tresys.com \
--cc=kaigai@kaigai.gr.jp \
--cc=sds@tycho.nsa.gov \
--cc=selinux@tycho.nsa.gov \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.