mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Mika Penttilä" <mika.penttila@kolumbus.fi>
To: linux-kernel@vger.kernel.org, linux-net@vger.kernel.org
Subject: cryptoapi incorrect struct page usage
Date: Sat, 09 Aug 2003 23:33:52 +0300	[thread overview]
Message-ID: <3F355AB0.6@kolumbus.fi> (raw)

It seems that cryptoapi usage wrt mm is not safe. At least both ipsec 
and cryptoloop practise these kinds of things :

example from net/xfrm/xfrm_algo.c

int
skb_to_sgvec(struct sk_buff *skb, struct scatterlist *sg, int offset, 
int len)
{
    int start = skb_headlen(skb);
    int i, copy = start - offset;
    int elt = 0;

    if (copy > 0) {
        if (copy > len)
            copy = len;
        sg[elt].page = virt_to_page(skb->data + offset);
        sg[elt].offset = (unsigned long)(skb->data + offset) % PAGE_SIZE;
        sg[elt].length = copy;



so unpinned pages are passed to cryptoapi. Nothing prevents these pages 
from being swapped out. Something like get_user_pages() is needed to pin 
these pages for the duration of crypto operations. Comments?

--Mika



             reply	other threads:[~2003-08-09 20:27 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-08-09 20:33 Mika Penttilä [this message]
2003-08-09 20:36 ` David S. Miller

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=3F355AB0.6@kolumbus.fi \
    --to=mika.penttila@kolumbus.fi \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-net@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

all inboxes | Powered by JetHome®