public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Simon Arlott <simon@arlott.org>
To: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: security_fixup_ops
Date: Sat, 17 Feb 2007 09:38:53 +0000	[thread overview]
Message-ID: <45D6CD2D.7090705@simon.arlott.org.uk> (raw)

[-- Attachment #1: Type: text/plain, Size: 1557 bytes --]

Shouldn't security_fixup_ops be exported?

Otherwise I have to include the kernel's security/dummy.c to use it and there's no other way to fix all the ops for a secondary module without copying a list of all the ops, which may change in future kernels, into the module's code.

Unless of course including kernel source in modules is ok, because the module will need to have been compiled with the right version of struct security_operations anyway.

---
/* http://redrum.lp0.eu/portac/portac.c */

#include <../security/dummy.c>

struct security_operations portac_ops = { 
	.register_security = portac_register_security,
	.unregister_security = portac_unregister_security,

	.socket_bind = portac_socket_bind
};
struct security_operations primary_ops;
struct security_operations *secondary_ops = NULL;

int portac_register_security(const char *name, struct security_operations *ops)
{
	struct security_operations tmp;
...
	/* Copy our current ops because they have
	 * been fixed with dummy functions.
	 *
	 * Keep a reference to the secondary ops
	 * for later use.
	 */
	primary_ops = portac_ops;
	secondary_ops = ops;

	/* Copy the secondary ops, override the
	 * functions we use and call security_fixup_ops
	 * to add missing dummy functions.
	 *
	 * Replace our current ops with these ops.
	 */
	tmp = *ops;
	tmp.socket_bind = portac_socket_bind;
	tmp.unregister_security = portac_unregister_security;
	security_fixup_ops(&tmp); /* from security/dummy.c */
	portac_ops = tmp;
...
}

-- 
Simon Arlott


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 829 bytes --]

             reply	other threads:[~2007-02-17  9:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-17  9:38 Simon Arlott [this message]
2007-02-19 17:40 ` security_fixup_ops Serge E. Hallyn

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=45D6CD2D.7090705@simon.arlott.org.uk \
    --to=simon@arlott.org \
    --cc=0fe037f0d97e4d61cc1him220006i098@thunder.lp0.eu \
    --cc=linux-kernel@vger.kernel.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