public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Chen Gang <gang.chen@asianux.com>
To: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	"sfr@canb.auug.org.au" <sfr@canb.auug.org.au>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"paulus@samba.org" <paulus@samba.org>,
	Al Viro <viro@zeniv.linux.org.uk>,
	"linuxppc-dev@lists.ozlabs.org" <linuxppc-dev@lists.ozlabs.org>
Subject: Re: [PATCH] PowerPC: kernel: memory access violation when rtas_data_buf contents are more than 1026
Date: Wed, 24 Apr 2013 15:40:50 +0800	[thread overview]
Message-ID: <51778C82.2080807@asianux.com> (raw)
In-Reply-To: <51778885.6090306@linux.vnet.ibm.com>

On 2013年04月24日 15:23, Vasant Hegde wrote:
> On 04/24/2013 12:33 PM, Chen Gang wrote:
>> On 2013年04月24日 14:28, Vasant Hegde wrote:
>>> On 04/23/2013 08:42 AM, Chen Gang wrote:
>>>>
>>>> need set '\0' for 'local_buffer'.
>>>>
>>>> SPLPAR_MAXLENGTH is 1026, RTAS_DATA_BUF_SIZE is 4096. so the
>>>> contents of
>>>> rtas_data_buf may truncated in memcpy.
>>>>
>>>> if contents are really truncated.
>>>>     the splpar_strlen is more than 1026. the next while loop
>>>> checking will
>>>>     not find the end of buffer. that will cause memory access
>>>> violation.
>>>>
>>>
>>> Per parameter length in ibm,get-system-parameter RTAS call is limited to
>>> 1026 bytes (1024 bytes of data + 2 bytes  length). And 'rtas_data_buf'
>>> was set to 0 (first 1026 bytes) before call RTAS call. At the worst if
>>> we get junk in RTAS output length field helps to exit from the while
>>> loop. So I don't think we need this patch.
>>
>> Is get-system-parameter return the NUL terminated string ? if so, it
>> will no issue (just like your discription).
>>
> 
> Length includes the length of the NULL. So (idx < splpar_strlen)
> is safe. IMO existing code is proper.

OK, since it is not an issue, I will try another patches for powerpc POWER7.

  :-)

-- 
Chen Gang

Asianux Corporation

      reply	other threads:[~2013-04-24  7:41 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-18  4:45 [Suggestion] PowerPC: kernel: memory access violation when rtas_data_buf contents are more than 1026 Chen Gang
2013-04-23  0:31 ` Benjamin Herrenschmidt
2013-04-23  1:48   ` Chen Gang
2013-04-23  3:12     ` [PATCH] " Chen Gang
2013-04-24  6:28       ` Vasant Hegde
2013-04-24  7:03         ` Chen Gang
2013-04-24  7:23           ` Vasant Hegde
2013-04-24  7:40             ` Chen Gang [this message]

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=51778C82.2080807@asianux.com \
    --to=gang.chen@asianux.com \
    --cc=benh@kernel.crashing.org \
    --cc=hegdevasant@linux.vnet.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=paulus@samba.org \
    --cc=sfr@canb.auug.org.au \
    --cc=viro@zeniv.linux.org.uk \
    /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