* Debian woody dpkg no longer works with recent linux kernel.
@ 2005-10-09 15:16 Junichi Uekawa
2005-10-09 22:33 ` Bug#322309: " Scott James Remnant
0 siblings, 1 reply; 6+ messages in thread
From: Junichi Uekawa @ 2005-10-09 15:16 UTC (permalink / raw)
To: 322309-submitter, 322309, 329468, 329468-submitter, debian-devel,
linux-kernel, 332903-submitter
Hi,
dpkg in Debian woody (3.0) is broken by recent linux kernels;
due to the following command changing behavior (mmap of
zero-byte length):
addr=mmap(NULL, 0, PROT_READ, MAP_SHARED, fd, 0);
These bugs are caused by mmap changing behavior;
it used to return NULL when given a length of 0.
However, it now returns -1, and gives back an errno=EINVAL.
This triggers problems in Debian installation.
The workaround is to give some content to the files:
/var/lib/status
/var/lib/available
$ uname -r
2.6.14-rc3dancer-gedb4a353
$ ./a.c b
a.c: In function 'main':
a.c:26: warning: comparison between pointer and integer
mmap: Invalid argument
$ ls -l b
-rw-r--r-- 1 dancer dancer 0 2005-10-09 22:29 b
$ uname -r
2.2.26
$ cat a.c
/*BINFMTC:
* */
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <fcntl.h>
#include <sys/mman.h>
int main(int argc, char **argv)
{
int fd;
void*addr;
if (argc < 2)
{
fprintf(stderr, "Filename required\n");
return 1;
}
if((fd=open(argv[1], O_RDONLY))==-1)
{
perror("open");
return 1;
}
addr=mmap(NULL, 0, PROT_READ, MAP_SHARED, fd, 0);
if (addr==-1)
{
perror("mmap");
return 1;
}
printf ("%p\n", addr);
if(close(fd)==-1)
{
perror("close");
return 1;
}
return 0;
}
$ ./a.out b
(nil)
regards,
junichi
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: Bug#322309: Debian woody dpkg no longer works with recent linux kernel. 2005-10-09 15:16 Debian woody dpkg no longer works with recent linux kernel Junichi Uekawa @ 2005-10-09 22:33 ` Scott James Remnant 2005-10-10 1:07 ` Junichi Uekawa 2005-10-11 14:24 ` Junichi Uekawa 0 siblings, 2 replies; 6+ messages in thread From: Scott James Remnant @ 2005-10-09 22:33 UTC (permalink / raw) To: Junichi Uekawa, 322309 Cc: 322309-submitter, 329468, 329468-submitter, debian-devel, linux-kernel, 332903-submitter [-- Attachment #1: Type: text/plain, Size: 611 bytes --] On Mon, 2005-10-10 at 00:16 +0900, Junichi Uekawa wrote: > dpkg in Debian woody (3.0) is broken by recent linux kernels; > due to the following command changing behavior (mmap of > zero-byte length): > > addr=mmap(NULL, 0, PROT_READ, MAP_SHARED, fd, 0); > > These bugs are caused by mmap changing behavior; > it used to return NULL when given a length of 0. > However, it now returns -1, and gives back an errno=EINVAL. > Indeed. This was the sole change in the 1.13.8 release. Scott -- Have you ever, ever felt like this? Had strange things happen? Are you going round the twist? [-- Attachment #2: This is a digitally signed message part --] [-- Type: application/pgp-signature, Size: 189 bytes --] ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Bug#322309: Debian woody dpkg no longer works with recent linux kernel. 2005-10-09 22:33 ` Bug#322309: " Scott James Remnant @ 2005-10-10 1:07 ` Junichi Uekawa 2005-10-11 14:24 ` Junichi Uekawa 1 sibling, 0 replies; 6+ messages in thread From: Junichi Uekawa @ 2005-10-10 1:07 UTC (permalink / raw) To: Scott James Remnant Cc: Junichi Uekawa, 322309, 322309-submitter, 329468, 329468-submitter, debian-devel, linux-kernel, 332903-submitter [-- Attachment #1: Type: text/plain, Size: 982 bytes --] Hi, > > dpkg in Debian woody (3.0) is broken by recent linux kernels; > > due to the following command changing behavior (mmap of > > zero-byte length): > > > > addr=mmap(NULL, 0, PROT_READ, MAP_SHARED, fd, 0); > > > > These bugs are caused by mmap changing behavior; > > it used to return NULL when given a length of 0. > > However, it now returns -1, and gives back an errno=EINVAL. > > > Indeed. This was the sole change in the 1.13.8 release. Thanks, I didn't notice it was since 2.6.12. woody dpkg was long broken. I've only seen more recent reports about this. To fix this problem, will require update to dpkg in woody; which might not be feasible. We could drop support of woody chroots in etch. It might be possible to add a workaround hack in [c]debootstrap to trap mmap; or fill status/available files before invoking dpkg. I'm not quite sure why sarge manages to bootstrap despite having a dpkg version (1.10.28) that shouldn't work. regards, junichi [-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --] ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Bug#322309: Debian woody dpkg no longer works with recent linux kernel. 2005-10-09 22:33 ` Bug#322309: " Scott James Remnant 2005-10-10 1:07 ` Junichi Uekawa @ 2005-10-11 14:24 ` Junichi Uekawa 2005-10-11 15:15 ` Junichi Uekawa 2005-10-11 15:19 ` Jon Masters 1 sibling, 2 replies; 6+ messages in thread From: Junichi Uekawa @ 2005-10-11 14:24 UTC (permalink / raw) To: Scott James Remnant Cc: Junichi Uekawa, 322309, 329468, debian-devel, linux-kernel, 332903 Hi, > > dpkg in Debian woody (3.0) is broken by recent linux kernels; > > due to the following command changing behavior (mmap of > > zero-byte length): > > > > addr=mmap(NULL, 0, PROT_READ, MAP_SHARED, fd, 0); > > > > These bugs are caused by mmap changing behavior; > > it used to return NULL when given a length of 0. > > However, it now returns -1, and gives back an errno=EINVAL. > > > Indeed. This was the sole change in the 1.13.8 release. 1.13.8 is more recent than sarge; and I'm not quite sure why sarge successfully installs, and woody fails. I'm seeing several potential solutions. 0. Backport dpkg change to woody and update woody (maybe impossible due to Debian oldstable update infrastructure) 1. Modify [c]debootstrap to dump dummy data in /var/lib/dpkg/{status,available} 2. write a kernel patch to return 0 when mmap is called with length=0 3. Create a LD_PRELOAD or ptrace hack to return 0 when mmap is called with length=0 regards, junichi ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Bug#322309: Debian woody dpkg no longer works with recent linux kernel. 2005-10-11 14:24 ` Junichi Uekawa @ 2005-10-11 15:15 ` Junichi Uekawa 2005-10-11 15:19 ` Jon Masters 1 sibling, 0 replies; 6+ messages in thread From: Junichi Uekawa @ 2005-10-11 15:15 UTC (permalink / raw) To: Scott James Remnant Cc: Junichi Uekawa, 322309, 329468, debian-devel, linux-kernel, 332903 Hi, > > > dpkg in Debian woody (3.0) is broken by recent linux kernels; > > > due to the following command changing behavior (mmap of > > > zero-byte length): > > > > > > addr=mmap(NULL, 0, PROT_READ, MAP_SHARED, fd, 0); > > > > > > These bugs are caused by mmap changing behavior; > > > it used to return NULL when given a length of 0. > > > However, it now returns -1, and gives back an errno=EINVAL. > > > > > Indeed. This was the sole change in the 1.13.8 release. > > 1.13.8 is more recent than sarge; and I'm not quite sure > why sarge successfully installs, and woody fails. Okay, I've verified that dpkg on sarge doesn't call mmap. strace snippet: umask(022) = 022 open("/var/lib/dpkg/status", O_RDONLY) = 3 fstat(3, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0 close(3) = 0 open("/var/lib/dpkg/updates/", O_RDONLY|O_NONBLOCK|O_DIRECTORY) = 3 fstat(3, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 fcntl(3, F_SETFD, FD_CLOEXEC) = 0 getdents64(3, /* 2 entries */, 4096) = 48 getdents64(3, /* 0 entries */, 4096) = 0 close(3) = 0 open("/var/lib/dpkg/available", O_RDONLY) = 3 fstat(3, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0 close(3) = 0 exit_group(0, 0, 0x2aaaaadfc530, 0x2, 0x2aaaaae00640 <unfinished ... exit status So, the impact is restricted on trying to run woody dpkg on newer kernels. regards, junichi ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Bug#322309: Debian woody dpkg no longer works with recent linux kernel. 2005-10-11 14:24 ` Junichi Uekawa 2005-10-11 15:15 ` Junichi Uekawa @ 2005-10-11 15:19 ` Jon Masters 1 sibling, 0 replies; 6+ messages in thread From: Jon Masters @ 2005-10-11 15:19 UTC (permalink / raw) To: Junichi Uekawa Cc: Scott James Remnant, 322309, 329468, debian-devel, linux-kernel, 332903 On 10/11/05, Junichi Uekawa <dancer@netfort.gr.jp> wrote: > > > dpkg in Debian woody (3.0) is broken by recent linux kernels; > > > due to the following command changing behavior (mmap of > > > zero-byte length): > > > > > > addr=mmap(NULL, 0, PROT_READ, MAP_SHARED, fd, 0); > > > > > > These bugs are caused by mmap changing behavior; > > > it used to return NULL when given a length of 0. > > > However, it now returns -1, and gives back an errno=EINVAL. > I'm seeing several potential solutions. > Backport dpkg change to woody and update woody > (maybe impossible due to Debian oldstable > update infrastructure) That's probably the best fix. > write a kernel patch to return 0 when mmap is > called with length=0 Bad idea. I'm not the greatest authority on what the standards say mmap should be doing, but this change seems logical and there's no point in changing the kernel to revert the behaviour just for Debian systems. It'd be another pointless Debian kernel patch :-) > Create a LD_PRELOAD or ptrace hack to return > 0 when mmap is called with length=0 Yummy. Better than the previous hack. Jon. ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2005-10-11 15:19 UTC | newest] Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2005-10-09 15:16 Debian woody dpkg no longer works with recent linux kernel Junichi Uekawa 2005-10-09 22:33 ` Bug#322309: " Scott James Remnant 2005-10-10 1:07 ` Junichi Uekawa 2005-10-11 14:24 ` Junichi Uekawa 2005-10-11 15:15 ` Junichi Uekawa 2005-10-11 15:19 ` Jon Masters
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox
Powered by JetHome