From: Davide Libenzi <davidel@xmailserver.org>
To: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Linus Torvalds <torvalds@linux-foundation.org>,
Ulrich Drepper <drepper@gmail.com>, Ingo Molnar <mingo@elte.hu>
Subject: [patch 0/6] sys_indirect RFC - sys_indirect introduction
Date: Fri, 29 Jun 2007 14:48:52 -0700 [thread overview]
Message-ID: <send-serie.davidel@xmailserver.org.28360.1183153732.0> (raw)
This patch-set implements the skeleton for a new sys_indirect() system call.
The reason for such system call would be to avoid the proliferation of new
system calls, introduced to only wrap old ones by setting/unsetting a given
context before/after the real system call.
The internal operation of sys_indirect() would be (pseudo-code):
for_each_ctx(wrap_ctx, &user_ctxs) {
save_prev_ctx(&saved_chain, tsk->xxx);
tsk->xxx = wrap_ctx;
}
err = call_system_call(nr, params);
for_each_saved_ctx(ctx, &saved_chain) {
restore_ctx(tsk->xxx, ctx);
}
return err;
To made sys_indirect() decently flexible, and to avoid a sys_indirect2()
anytime soon, a simple "flags" parameter is clearly not sufficent to be
passed down with it.
To be flexible we need to allow 1) more than a simple "flags" to be passed
down 2) more than one context possibly to be set before the real system
call. Also, the data structures passed down as new-context-to-be-set should
be compat-free, in order to simplify the compat code.
The prototype for sys_indirect() is:
struct indirect_ctx {
__u32 ctx;
};
long sys_indirect(unsigned int nr,
const struct indirect_ctx **ctxs,
unsigned int nctxs,
const unsigned long *params);
The "struct indirect_ctx" is a stub structure that is supposed to be the
base for all the context set/unset operations.
An example usage for userspace POV (referring to the example in the next
patches) is:
[include/linux/indirect.h]
#define SYSIND_CTX_OPENFLAGS 0
struct sysind_ctx_OPENFLAGS {
__u32 ctx;
__u32 flags;
};
[userspace]
struct sysind_ctx_OPENFLAGS octx;
struct indirect_ctx *ctxs[1];
unsigned long params[6];
octx.ctx = SYSIND_CTX_OPENFLAGS;
octx.flags = O_CLOEXEC;
ctxs[0] = (struct indirect_ctx *) &octx;
params[0] = domain;
params[1] = type;
params[2] = proto;
res = indirect(__NR_socket, ctxs, 1, params);
The sys_indirect() system call requires a small arch-dependent asm function
call_syscall() in order to call a system call by passing call number and
parameters (compat_call_syscall() is also needed for archs having 32 bit compat).
I currently implemented them for i386 and x86-64.
The following patches builds but are totally untested at the moment.
Comments?
- Davide
next reply other threads:[~2007-06-29 21:49 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-06-29 21:48 Davide Libenzi [this message]
2007-06-30 1:48 ` Ulrich Drepper
2007-06-30 19:23 ` Davide Libenzi
2007-06-30 21:54 ` Ulrich Drepper
2007-06-30 22:27 ` Davide Libenzi
2007-06-30 22:32 ` Davide Libenzi
2007-07-01 16:25 ` Ulrich Drepper
2007-07-01 17:09 ` Davide Libenzi
2007-07-02 14:09 ` Ulrich Drepper
2007-07-02 22:37 ` Davide Libenzi
2007-07-03 0:28 ` Ulrich Drepper
2007-07-03 0:37 ` Davide Libenzi
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=send-serie.davidel@xmailserver.org.28360.1183153732.0 \
--to=davidel@xmailserver.org \
--cc=akpm@linux-foundation.org \
--cc=drepper@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=torvalds@linux-foundation.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®