From: Paul Moore <pmoore@redhat.com>
To: Huw Davies <huw@codeweavers.com>
Cc: netdev@vger.kernel.org, linux-security-module@vger.kernel.org,
selinux@tycho.nsa.gov
Subject: Re: [RFC PATCH v2 08/18] ipv6: Add ipv6_renew_options_kern() that accepts a kernel mem pointer.
Date: Sun, 07 Feb 2016 14:56:05 -0500 [thread overview]
Message-ID: <2213519.F62jx6DkRd@sifl> (raw)
In-Reply-To: <1452246774-13241-9-git-send-email-huw@codeweavers.com>
On Friday, January 08, 2016 09:52:44 AM Huw Davies wrote:
> The functionality is equivalent to ipv6_renew_options() except
> that the newopt pointer is in kernel, not user, memory
>
> The kernel memory implementation will be used by the CALIPSO network
> labelling engine, which needs to be able to set IPv6 hop-by-hop
> options.
>
> Signed-off-by: Huw Davies <huw@codeweavers.com>
...
> +/**
> + * ipv6_renew_options_kern - replace a specific ext hdr with a new one.
> + *
> + * @sk: sock from which to allocate memory
> + * @opt: original options
> + * @newtype: option type to replace in @opt
> + * @newopt: new option of type @newtype to replace (kernel-mem)
> + * @newoptlen: length of @newopt
> + *
> + * See ipv6_renew_options(). The difference is that @newopt is
> + * kernel memory, rather than user memory.
> + */
> +struct ipv6_txoptions *
> +ipv6_renew_options_kern(struct sock *sk, struct ipv6_txoptions *opt,
> + int newtype, struct ipv6_opt_hdr *newopt,
> + int newoptlen)
> +{
> + struct ipv6_txoptions *ret_val;
> + const mm_segment_t old_fs = get_fs();
> +
> + set_fs(KERNEL_DS);
> + ret_val = ipv6_renew_options(sk, opt, newtype,
> + (struct ipv6_opt_hdr __user *)newopt,
> + newoptlen);
> + set_fs(old_fs);
> + return ret_val;
> +}
I should preface this by saying that I don't have a strong opinion on this
either way, and given where the code lives it is really up to DaveM, but I
wonder if it might be better to create ipv6_renew_options_kern() as the common
helper function that is called by ipv6_renew_options().
--
paul moore
security @ redhat
next prev parent reply other threads:[~2016-02-07 19:56 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-08 9:52 [RFC PATCH v2 08/18] ipv6: Add ipv6_renew_options_kern() that accepts a kernel mem pointer Huw Davies
2016-02-07 19:56 ` Paul Moore [this message]
2016-02-11 14:52 ` Huw Davies
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=2213519.F62jx6DkRd@sifl \
--to=pmoore@redhat.com \
--cc=huw@codeweavers.com \
--cc=linux-security-module@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox