All of lore.kernel.org
 help / color / mirror / Atom feed
From: Catalin Marinas <catalin.marinas@arm.com>
To: Will Deacon <will@kernel.org>
Cc: Vincenzo Frascino <vincenzo.frascino@arm.com>,
	Mark Rutland <mark.rutland@arm.com>,
	linux-arm-kernel@lists.infradead.org, stable@vger.kernel.org
Subject: Re: [PATCH 1/5] arm64: vdso: don't free unallocated pages
Date: Wed, 15 Apr 2020 11:08:37 +0100	[thread overview]
Message-ID: <20200415100836.GB6526@gaia> (raw)
In-Reply-To: <20200414151033.GA30288@willie-the-truck>

On Tue, Apr 14, 2020 at 04:10:35PM +0100, Will Deacon wrote:
> On Tue, Apr 14, 2020 at 03:53:45PM +0100, Vincenzo Frascino wrote:
> > On 4/14/20 2:27 PM, Mark Rutland wrote:
> > > On Tue, Apr 14, 2020 at 01:50:38PM +0100, Vincenzo Frascino wrote:
> > >> On 4/14/20 11:42 AM, Mark Rutland wrote:
> > >>> The aarch32_vdso_pages[] array never has entries allocated in the C_VVAR
> > >>> or C_VDSO slots, and as the array is zero initialized these contain
> > >>> NULL.
> > >>>
> > >>> However in __aarch32_alloc_vdso_pages() when
> > >>> aarch32_alloc_kuser_vdso_page() fails we attempt to free the page whose
> > >>> struct page is at NULL, which is obviously nonsensical.
> > >>
> > >> Could you please explain why do you think that free(NULL) is "nonsensical"? 
> > > 
> > > Regardless of the below, can you please explain why it is sensical? I'm
> > > struggling to follow your argument here.
> > 
> > free(NULL) is a no-operation ("no action occurs") according to the C standard
> > (ISO-IEC 9899 paragraph 7.20.3.2). Hence this should not cause any bug if the
> > allocator is correctly implemented. From what I can see the implementation of
> > the page allocator honors this assumption.
> > 
> > Since you say it is a bug (providing evidence), we might have to investigate
> > because probably there is an issue somewhere else.
> 
> Not sure why you feel the need to throw the C standard around -- the patch
> from Mark looks obviously like the right thing to do to me, so:
> 
> Acked-by: Will Deacon <will@kernel.org>
> 
> Catalin -- please take this one as a fix so that I can queue the rest of
> the patches for 5.8 once it's hit mainline.

I queued this patch for -rc2. Thanks.

-- 
Catalin

WARNING: multiple messages have this Message-ID (diff)
From: Catalin Marinas <catalin.marinas@arm.com>
To: Will Deacon <will@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>,
	Vincenzo Frascino <vincenzo.frascino@arm.com>,
	stable@vger.kernel.org, linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 1/5] arm64: vdso: don't free unallocated pages
Date: Wed, 15 Apr 2020 11:08:37 +0100	[thread overview]
Message-ID: <20200415100836.GB6526@gaia> (raw)
In-Reply-To: <20200414151033.GA30288@willie-the-truck>

On Tue, Apr 14, 2020 at 04:10:35PM +0100, Will Deacon wrote:
> On Tue, Apr 14, 2020 at 03:53:45PM +0100, Vincenzo Frascino wrote:
> > On 4/14/20 2:27 PM, Mark Rutland wrote:
> > > On Tue, Apr 14, 2020 at 01:50:38PM +0100, Vincenzo Frascino wrote:
> > >> On 4/14/20 11:42 AM, Mark Rutland wrote:
> > >>> The aarch32_vdso_pages[] array never has entries allocated in the C_VVAR
> > >>> or C_VDSO slots, and as the array is zero initialized these contain
> > >>> NULL.
> > >>>
> > >>> However in __aarch32_alloc_vdso_pages() when
> > >>> aarch32_alloc_kuser_vdso_page() fails we attempt to free the page whose
> > >>> struct page is at NULL, which is obviously nonsensical.
> > >>
> > >> Could you please explain why do you think that free(NULL) is "nonsensical"? 
> > > 
> > > Regardless of the below, can you please explain why it is sensical? I'm
> > > struggling to follow your argument here.
> > 
> > free(NULL) is a no-operation ("no action occurs") according to the C standard
> > (ISO-IEC 9899 paragraph 7.20.3.2). Hence this should not cause any bug if the
> > allocator is correctly implemented. From what I can see the implementation of
> > the page allocator honors this assumption.
> > 
> > Since you say it is a bug (providing evidence), we might have to investigate
> > because probably there is an issue somewhere else.
> 
> Not sure why you feel the need to throw the C standard around -- the patch
> from Mark looks obviously like the right thing to do to me, so:
> 
> Acked-by: Will Deacon <will@kernel.org>
> 
> Catalin -- please take this one as a fix so that I can queue the rest of
> the patches for 5.8 once it's hit mainline.

I queued this patch for -rc2. Thanks.

-- 
Catalin

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2020-04-15 10:08 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-14 10:42 [PATCH 0/5] arm64: vdso: cleanups Mark Rutland
2020-04-14 10:42 ` [PATCH 1/5] arm64: vdso: don't free unallocated pages Mark Rutland
2020-04-14 10:42   ` Mark Rutland
2020-04-14 12:50   ` Vincenzo Frascino
2020-04-14 12:50     ` Vincenzo Frascino
2020-04-14 13:27     ` Mark Rutland
2020-04-14 13:27       ` Mark Rutland
2020-04-14 14:53       ` Vincenzo Frascino
2020-04-14 14:53         ` Vincenzo Frascino
2020-04-14 15:10         ` Will Deacon
2020-04-14 15:10           ` Will Deacon
2020-04-15 10:08           ` Catalin Marinas [this message]
2020-04-15 10:08             ` Catalin Marinas
2020-04-14 15:12         ` Mark Rutland
2020-04-14 15:12           ` Mark Rutland
2020-04-14 15:27           ` Vincenzo Frascino
2020-04-14 15:27             ` Vincenzo Frascino
2020-04-14 15:59         ` Catalin Marinas
2020-04-14 15:59           ` Catalin Marinas
2020-04-15 10:13   ` Catalin Marinas
2020-04-15 10:13     ` Catalin Marinas
2020-04-15 13:03     ` Mark Rutland
2020-04-15 13:03       ` Mark Rutland
2020-04-14 10:42 ` [PATCH 2/5] arm64: vdso: remove aarch32_vdso_pages[] Mark Rutland
2020-04-14 10:42 ` [PATCH 3/5] arm64: vdso: simplify arch_vdso_type ifdeffery Mark Rutland
2020-04-14 10:42 ` [PATCH 4/5] arm64: vdso: use consistent 'abi' nomenclature Mark Rutland
2020-04-14 10:42 ` [PATCH 5/5] arm64: vdso: use consistent 'map' nomenclature Mark Rutland
2020-04-14 15:20 ` [PATCH 0/5] arm64: vdso: cleanups Will Deacon
2020-04-14 15:43   ` Mark Rutland
2020-04-14 15:52     ` Will Deacon
2020-04-14 16:27       ` Mark Rutland
2020-04-28 12:49 ` Will Deacon
2020-04-28 12:52   ` Mark Rutland

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=20200415100836.GB6526@gaia \
    --to=catalin.marinas@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=mark.rutland@arm.com \
    --cc=stable@vger.kernel.org \
    --cc=vincenzo.frascino@arm.com \
    --cc=will@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.