From: Nathan Lynch <ntl-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org>
To: Oren Laadan <orenl-eQaUEPhvms7ENvBUuze7eA@public.gmane.org>
Cc: Linux Containers
<containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org>,
Dan Smith <danms-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
Subject: Re: ckpt-v19-rc2
Date: Thu, 03 Dec 2009 15:31:09 -0600 [thread overview]
Message-ID: <1259875869.8693.30.camel@localhost.localdomain> (raw)
In-Reply-To: <Pine.LNX.4.64.0912012352420.5665-CXF6herHY6ykSYb+qCZC/1i27PF6R63G9nwVQlTi/Pw@public.gmane.org>
[-- Attachment #1: Type: text/plain, Size: 1214 bytes --]
On Wed, 2009-12-02 at 00:23 -0500, Oren Laadan wrote:
> I put together ckpt-v19-rc2 (kernel and user)
I'm not sure yet whether this is a regression, but checkpoint seems to
be unable to handle file mappings that extend past the end of the file.
I noticed this with Fedora 11 userspace on powerpc (ld.so sometimes maps
libraries this way). I did not see this failure with a v19-rc1-based
kernel I tested earlier this week, but I haven't retested with that yet.
Here's an example - 8K mapping of a 4K file:
# stat -c%s /tmp/myfile
4096
# grep myfile /proc/5164/maps
f7e2b000-f7e2d000 r--p 00000000 08:06 5103709 /tmp/myfile
# checkpoint 5164 > /tmp/mmap.ckpt
checkpoint: Bad address
When we try to follow the mapping past the end of the file, we get
VM_FAULT_SIGBUS from handle_mm_fault(); the stack trace from debugging
code I added is:
.__get_dirty_page+0x4c/0x164 (unreliable)
.checkpoint_memory_contents+0x134/0x5a4
.private_vma_checkpoint+0xf4/0x120
.filemap_checkpoint+0x198/0x1d0
.checkpoint_mm+0x3c4/0x4fc
.checkpoint_obj+0x17c/0x1d0
.checkpoint_obj_mm+0x50/0x88
.checkpoint_task+0x710/0xaa0
.do_checkpoint+0x9c0/0xb24
.SyS_checkpoint+0xd0/0x11c
Attached is a testcase.
[-- Attachment #2: mmap.c --]
[-- Type: text/x-csrc, Size: 1635 bytes --]
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <sys/types.h>
static size_t page_sz; /* system page size */
static size_t file_sz; /* size of the file */
static size_t map_sz; /* size of the mapping to establish */
static const char *filepath = "myfile";
static void setup(void)
{
page_sz = sysconf(_SC_PAGESIZE);
file_sz = page_sz;
map_sz = file_sz + page_sz;
}
static void bail_perror(const char *msg)
{
perror(msg);
exit(1);
}
static void bail_msg(const char *msg)
{
fprintf(stderr, "%s\n", msg);
exit(1);
}
int create_file(size_t sz)
{
const void *buf;
ssize_t written;
struct stat sb;
int fd;
int rc;
rc = unlink(filepath);
if (rc < 0 && errno != ENOENT)
bail_perror("unlink");
fd = open(filepath, (O_RDWR | O_CREAT | O_EXCL), S_IRUSR);
if (fd < 0)
bail_perror("creat");
buf = calloc(1, sz);
if (!buf)
bail_perror("calloc");
written = 0;
while (written < sz) {
ssize_t res;
/* unsigned char zero = '\0'; */
res = write(fd, buf + written, sz - written);
if (res < 0)
bail_perror("write");
written += res;
}
/* check size */
rc = fstat(fd, &sb);
if (rc < 0)
bail_perror("fstat");
if (sb.st_size != sz)
bail_msg("unexpected file size");
return fd;
}
void map_file(int fd, size_t map_sz)
{
void *addr;
addr = mmap(NULL, map_sz, PROT_READ, MAP_PRIVATE, fd, 0);
if (addr == MAP_FAILED)
bail_perror("mmap");
}
int main(int argc, char **argv)
{
int fd;
setup();
fd = create_file(file_sz);
map_file(fd, map_sz);
printf("ready\n");
pause();
return 0;
}
[-- Attachment #3: Type: text/plain, Size: 206 bytes --]
_______________________________________________
Containers mailing list
Containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org
https://lists.linux-foundation.org/mailman/listinfo/containers
next prev parent reply other threads:[~2009-12-03 21:31 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-02 5:23 ckpt-v19-rc2 Oren Laadan
[not found] ` <Pine.LNX.4.64.0912012352420.5665-CXF6herHY6ykSYb+qCZC/1i27PF6R63G9nwVQlTi/Pw@public.gmane.org>
2009-12-03 19:50 ` [PATCH] checkpoint: remove clone_with_pids remnants from arch/powerpc Nathan Lynch
2009-12-03 19:50 ` [PATCH] checkpoint: fix net/checkpoint.c for 64-bit Nathan Lynch
2009-12-03 21:31 ` Nathan Lynch [this message]
[not found] ` <1259875869.8693.30.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2009-12-03 22:15 ` ckpt-v19-rc2 Oren Laadan
[not found] ` <4B183888.7070103-eQaUEPhvms7ENvBUuze7eA@public.gmane.org>
2009-12-05 0:24 ` ckpt-v19-rc2 Oren Laadan
2009-12-04 18:17 ` ckpt-v19-rc2 Serge E. Hallyn
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=1259875869.8693.30.camel@localhost.localdomain \
--to=ntl-e+axbwqsrlaavxtiumwx3w@public.gmane.org \
--cc=containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
--cc=danms-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org \
--cc=orenl-eQaUEPhvms7ENvBUuze7eA@public.gmane.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.