linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Dave Jones <davej@codemonkey.org.uk>,
	Christoph Hellwig <hch@infradead.org>,
	Kees Cook <keescook@chromium.org>,
	Linux Kernel <linux-kernel@vger.kernel.org>
Subject: Re: sg_io HARDENED_USERCOPY_PAGESPAN trace
Date: Fri, 30 Dec 2016 05:37:12 -0800	[thread overview]
Message-ID: <20161230133712.GA27511@infradead.org> (raw)
In-Reply-To: <20161229154351.6zrxuagi62pga6mt@codemonkey.org.uk>

On Thu, Dec 29, 2016 at 10:43:51AM -0500, Dave Jones wrote:
> On Wed, Dec 28, 2016 at 11:56:42PM -0800, Christoph Hellwig wrote:
>  > On Wed, Dec 28, 2016 at 04:40:16PM -0500, Dave Jones wrote:
>  > >  sg_io+0x113/0x470
>  > 
>  > Can you resolve that to a source line using a gdb?
> 
> It's the copy_from_user in an inlined copy of blk_fill_sghdr_rq.

That must be this line right at the beginning of blk_fill_sghdr_rq

	if (copy_from_user(rq->cmd, hdr->cmdp, hdr->cmd_len))
		return -EFAULT;

We're copying the SCSI CDB from the userspace pointer inside the hdr
we copied earlier into the request.

req->cmd is set to req->__cmd which is a u8 array with 16 members in
struct request by default, but if hdr->cmd_len is bigger than BLK_MAX_CDB
(16) we do a separate allocation for it in the caller:

	if (hdr->cmd_len > BLK_MAX_CDB) {
		rq->cmd = kzalloc(hdr->cmd_len, GFP_KERNEL);
		if (!rq->cmd)
			goto out_put_request;
	}

so I'm not really sure what the problem here could be.

  reply	other threads:[~2016-12-30 13:37 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-28 21:40 sg_io HARDENED_USERCOPY_PAGESPAN trace Dave Jones
2016-12-29  7:56 ` Christoph Hellwig
2016-12-29 15:43   ` Dave Jones
2016-12-30 13:37     ` Christoph Hellwig [this message]
2016-12-30 15:01       ` Dave Jones
2016-12-30 15:10         ` Christoph Hellwig
2017-01-03 21:48           ` Kees Cook
2017-01-08  9:44             ` Christoph Hellwig

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=20161230133712.GA27511@infradead.org \
    --to=hch@infradead.org \
    --cc=davej@codemonkey.org.uk \
    --cc=keescook@chromium.org \
    --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;
as well as URLs for NNTP newsgroup(s).