lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20100802102750.7d414819.kamezawa.hiroyu@jp.fujitsu.com>
Date:	Mon, 2 Aug 2010 10:27:50 +0900
From:	KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>
To:	Bojan Smojver <bojan@...ursive.com>
Cc:	Nigel Cunningham <nigel@...onice.net>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH]: Compress hibernation image with LZO (in-kernel)

On Mon, 02 Aug 2010 11:21:08 +1000
Bojan Smojver <bojan@...ursive.com> wrote:

> On Mon, 2010-08-02 at 10:10 +0900, KAMEZAWA Hiroyuki wrote:
> > Why swsusp can avoid memory leak is that it records which
> > pages should be freed after resume in the bitmap, which will be saved
> > to image header(?) 
> 
> Right. So, are you saying that all allocations in save_image() should be
> done using __get_free_page() or __get_free_pages() and not with
> vmalloc()?
> 
I don't say so but a consideration about following is required.
(And it's good to write "we're safe because...as comment")

 1. Information about pointers used for vmalloc are saved into image.
 2. Information(1) is properly recovered after resume and we can free it.
 3. No more allocation will happen once we start wriritng to the disk.

Then, vmalloc() area itself's information will be saved as
  "this vmalloc area is used"

and, at resume, recoreved as
  "this vmalloc area is used"

Then, you can free it because you remember pointers.

Then, you should make 

@@ -372,6 +380,38 @@ static int save_image(struct swap_map_handle *handle,
 	struct bio *bio;
 	struct timeval start;
 	struct timeval stop;
+	size_t ul, cl;
+	unsigned char *unc, *cmp, *wrk, *page; 

as global variable. Because global variables will be saved as it is,
you can find it after resume and free used vmalloc() buffers.

Maybe freeing it at swsusp_free() will be clean.


Thanks,
-Kame

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ