mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Guilherme G. Piccoli" <gpiccoli@igalia.com>
To: Ard Biesheuvel <ardb@kernel.org>, Kees Cook <keescook@chromium.org>
Cc: linux-kernel@vger.kernel.org, regressions@lists.linux.dev,
	linux-fsdevel@vger.kernel.org, kernel-dev@igalia.com,
	kernel@gpiccoli.net, Anton Vorontsov <anton@enomsg.org>,
	Colin Cross <ccross@android.com>, Tony Luck <tony.luck@intel.com>,
	Thorsten Leemhuis <linux@leemhuis.info>
Subject: Re: [REGRESSION][PATCH] Revert "pstore: migrate to crypto acomp interface"
Date: Fri, 30 Sep 2022 15:31:17 -0300	[thread overview]
Message-ID: <101050d9-e3ec-8c21-5fb6-68442f51b39f@igalia.com> (raw)
In-Reply-To: <CAMj1kXFnoqj+cn-0dT8fg0kgLvVx+Q2Ex-4CUjSnA9yRprmC-w@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1507 bytes --]

On 30/09/2022 12:51, Ard Biesheuvel wrote:
> [...]
> 
> Does this help?
> 
> diff --git a/fs/pstore/platform.c b/fs/pstore/platform.c
> index b2fd3c20e7c2..c0b609d7d04e 100644
> --- a/fs/pstore/platform.c
> +++ b/fs/pstore/platform.c
> @@ -292,7 +292,7 @@ static int pstore_compress(const void *in, void *out,
>                 return ret;
>         }
> 
> -       return outlen;
> +       return creq->dlen;
>  }
> 
>  static void allocate_buf_for_compression(void)
> 

Thanks a lot Ard, this seems to be the fix! Tested with lz4/zstd/deflate
in both ramoops/efi backends, and all worked fine. It makes sense,
outlen was modified in the previous API and not in the acomp thing, so
it was a good catch =)


>> Heheh you're right! But for something like this (pstore/dmesg
>> compression broke for the most backends), I'd be glad if we could fix it
>> before the release.
> 
> Yeah better to revert - this was not a critical change anyway. But I
> think the tweak above should fix things (it works for me here)

Agreed - in fact seems it was reverted already. More than that, I found
yet another small issue in the acomp refactor, a memory leak - attached
is a patch with the fix, feel free to integrate in your acomp refactor
when re-submitting (I mean, feel free to just integrate the code, don't
need to send it as a separate patch/fix).

I'm also working some fixes in implicit conversions in pstore that
aren't great (unsigned -> int in many places), I'll send some stuff next
week.

Cheers,


Guilherme

[-- Attachment #2: pstore-Fix-memory-leak-after-the-recent-compression-.patch --]
[-- Type: text/x-patch, Size: 889 bytes --]

From cf0515dec1a339e7b644cbadaf58bfb54c9b20df Mon Sep 17 00:00:00 2001
From: "Guilherme G. Piccoli" <gpiccoli@igalia.com>
Date: Fri, 30 Sep 2022 13:45:18 -0300
Subject: [PATCH] pstore: Fix memory leak after the recent compression refactor

Fixes: e4f0a7ec586b ("pstore: migrate to crypto acomp interface")
Cc: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Guilherme G. Piccoli <gpiccoli@igalia.com>
---
 fs/pstore/platform.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/pstore/platform.c b/fs/pstore/platform.c
index d244db8c879d..1765ea157d37 100644
--- a/fs/pstore/platform.c
+++ b/fs/pstore/platform.c
@@ -741,6 +741,7 @@ static void decompress_record(struct pstore_record *record)
 	ret = crypto_acomp_decompress(dreq);
 	if (ret) {
 		pr_err("crypto_acomp_decompress failed, ret = %d!\n", ret);
+		acomp_request_free(dreq);
 		kfree(workspace);
 		return;
 	}
-- 
2.37.3


  reply	other threads:[~2022-09-30 18:31 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-29 21:55 Guilherme G. Piccoli
2022-09-30  3:29 ` Kees Cook
2022-09-30 12:39   ` Guilherme G. Piccoli
2022-09-30 15:51     ` Ard Biesheuvel
2022-09-30 18:31       ` Guilherme G. Piccoli [this message]
2022-09-30 19:08         ` Kees Cook
2022-09-30 12:03 ` [REGRESSION][PATCH] Revert "pstore: migrate to crypto acomp interface" #forregzbot Thorsten Leemhuis

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=101050d9-e3ec-8c21-5fb6-68442f51b39f@igalia.com \
    --to=gpiccoli@igalia.com \
    --cc=anton@enomsg.org \
    --cc=ardb@kernel.org \
    --cc=ccross@android.com \
    --cc=keescook@chromium.org \
    --cc=kernel-dev@igalia.com \
    --cc=kernel@gpiccoli.net \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@leemhuis.info \
    --cc=regressions@lists.linux.dev \
    --cc=tony.luck@intel.com \
    /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®