All of lore.kernel.org
 help / color / mirror / Atom feed
* Current git tree broke busybox start-stop-daemon
@ 2008-04-16 17:25 Joakim Tjernlund
  2008-04-16 19:00 ` Alexey Dobriyan
  0 siblings, 1 reply; 5+ messages in thread
From: Joakim Tjernlund @ 2008-04-16 17:25 UTC (permalink / raw)
  To: Linux-Kernel

root@localhost:~# start-stop-daemon --stop --name eq_ppp_mgr
start-stop-daemon: lseek: Invalid argument

root@localhost:~# strace start-stop-daemon --stop --name eq_ppp_mgr
execve("/sbin/start-stop-daemon", ["start-stop-daemon", "--stop", "--name", "eq_ppp_mgr"], [/* 12 vars */]) = 0
uname({sys="Linux", node="localhost.localdomain", ...}) = 0
brk(0)                                  = 0x1007c000
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x48017000
access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)
open("/opt/appl/executing/lib/tls/ppc603/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/opt/appl/executing/lib/tls/ppc603", 0xbfb940a0) = -1 ENOENT (No such file or directory)
open("/opt/appl/executing/lib/tls/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/opt/appl/executing/lib/tls", 0xbfb940a0) = -1 ENOENT (No such file or directory)
open("/opt/appl/executing/lib/ppc603/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/opt/appl/executing/lib/ppc603", 0xbfb940a0) = -1 ENOENT (No such file or directory)
open("/opt/appl/executing/lib/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/opt/appl/executing/lib", {st_mode=S_IFDIR|0755, st_size=0, ...}) = 0
open("/opt/appl/started/lib/tls/ppc603/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/opt/appl/started/lib/tls/ppc603", 0xbfb940a0) = -1 ENOENT (No such file or directory)
open("/opt/appl/started/lib/tls/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/opt/appl/started/lib/tls", 0xbfb940a0) = -1 ENOENT (No such file or directory)
open("/opt/appl/started/lib/ppc603/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/opt/appl/started/lib/ppc603", 0xbfb940a0) = -1 ENOENT (No such file or directory)
open("/opt/appl/started/lib/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/opt/appl/started/lib", {st_mode=S_IFDIR|0755, st_size=0, ...}) = 0
open("/opt/appl/next/lib/tls/ppc603/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/opt/appl/next/lib/tls/ppc603", 0xbfb940a0) = -1 ENOENT (No such file or directory)
open("/opt/appl/next/lib/tls/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/opt/appl/next/lib/tls", 0xbfb940a0) = -1 ENOENT (No such file or directory)
open("/opt/appl/next/lib/ppc603/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/opt/appl/next/lib/ppc603", 0xbfb940a0) = -1 ENOENT (No such file or directory)
open("/opt/appl/next/lib/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/opt/appl/next/lib", {st_mode=S_IFDIR|0755, st_size=0, ...}) = 0
open("/etc/ld.so.cache", O_RDONLY)      = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=64, ...}) = 0
mmap(NULL, 64, PROT_READ, MAP_PRIVATE, 3, 0) = 0x48018000
close(3)                                = 0
open("/lib/tls/ppc603/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/lib/tls/ppc603", 0xbfb940a0)   = -1 ENOENT (No such file or directory)
open("/lib/tls/libc.so.6", O_RDONLY)    = -1 ENOENT (No such file or directory)
stat64("/lib/tls", 0xbfb940a0)          = -1 ENOENT (No such file or directory)
open("/lib/ppc603/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/lib/ppc603", 0xbfb940a0)       = -1 ENOENT (No such file or directory)
open("/lib/libc.so.6", O_RDONLY)        = 3
read(3, "\177ELF\1\2\1\0\0\0\0\0\0\0\0\0\0\3\0\24\0\0\0\1\0\1\314"..., 512) = 512
fstat64(3, {st_mode=S_IFREG|0755, st_size=1345728, ...}) = 0
mmap(0xfea7000, 1346452, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xfea7000
madvise(0xfea7000, 1346452, MADV_SEQUENTIAL|0x1) = 0
mprotect(0xffd8000, 97172, PROT_NONE)   = 0
mmap(0xffe8000, 24576, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x131000) = 0xffe8000
mmap(0xffee000, 7060, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xffee000
close(3)                                = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x48019000
mprotect(0xffe8000, 8192, PROT_READ)    = 0
mprotect(0x48026000, 4096, PROT_READ)   = 0
munmap(0x48018000, 64)                  = 0
open("/dev/urandom", O_RDONLY)          = 3
read(3, "a\25\24G", 4)                  = 4
close(3)                                = 0
getuid()                                = 0
open("/proc", O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY) = 3
fstat64(3, {st_mode=S_IFDIR|0555, st_size=0, ...}) = 0
fcntl64(3, F_SETFD, FD_CLOEXEC)         = 0
brk(0)                                  = 0x1007c000
brk(0x1009d000)                         = 0x1009d000
getdents64(3, /* 35 entries */, 1024)   = 1024
getdents64(3, /* 40 entries */, 1024)   = 1024
open("/proc/1/stat", O_RDONLY|O_LARGEFILE) = 4
_llseek(4, 0, 0xbfb94898, SEEK_END)     = -1 EINVAL (Invalid argument)
write(2, "start-stop-daemon: lseek: Invali"..., 43start-stop-daemon: lseek: Invalid argument
) = 43
exit_group(1)                           = ?
Process 555 detached


So it appears that lseek is no longer allowed for /proc/1/stat
Bug or feature?
start-stop-daemon works fine in 2.6.23

  Jocke

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Current git tree broke busybox start-stop-daemon
  2008-04-16 17:25 Current git tree broke busybox start-stop-daemon Joakim Tjernlund
@ 2008-04-16 19:00 ` Alexey Dobriyan
  2008-04-16 19:34   ` Al Viro
  0 siblings, 1 reply; 5+ messages in thread
From: Alexey Dobriyan @ 2008-04-16 19:00 UTC (permalink / raw)
  To: Joakim Tjernlund; +Cc: linux-kernel, ebiederm, viro

On Wed, Apr 16, 2008 at 07:25:02PM +0200, Joakim Tjernlund wrote:
> open("/proc/1/stat", O_RDONLY|O_LARGEFILE) = 4
> _llseek(4, 0, 0xbfb94898, SEEK_END)     = -1 EINVAL (Invalid argument)

> So it appears that lseek is no longer allowed for /proc/1/stat
> Bug or feature?
> start-stop-daemon works fine in 2.6.23

That's what happens when switching ->llseek method from NULL
(effectively, default_llseek), to seq_lseek (which rejects SEEK_END).

commit be614086a4aff163d5aa0dc160638d1193b59cde
commit ee992744ea53db0a90c986fd0a70fbbf91e7f8bd

Al, do you remember why SEEK_END was omitted back then?


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Current git tree broke busybox start-stop-daemon
@ 2008-04-16 19:04 tjernlund
  0 siblings, 0 replies; 5+ messages in thread
From: tjernlund @ 2008-04-16 19:04 UTC (permalink / raw)
  To: 'Linux-Kernel', 'Joakim Tjernlund'

root@localhost:~# start-stop-daemon --stop --name eq_ppp_mgr
start-stop-daemon: lseek: Invalid argument

root@localhost:~# strace start-stop-daemon --stop --name eq_ppp_mgr
execve("/sbin/start-stop-daemon", ["start-stop-daemon", "--stop", "--name", "eq_ppp_mgr"], [/* 12 vars */]) = 0
uname({sys="Linux", node="localhost.localdomain", ...}) = 0
brk(0)                                  = 0x1007c000
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x48017000
access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)
open("/opt/appl/executing/lib/tls/ppc603/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/opt/appl/executing/lib/tls/ppc603", 0xbfb940a0) = -1 ENOENT (No such file or directory)
open("/opt/appl/executing/lib/tls/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/opt/appl/executing/lib/tls", 0xbfb940a0) = -1 ENOENT (No such file or directory)
open("/opt/appl/executing/lib/ppc603/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/opt/appl/executing/lib/ppc603", 0xbfb940a0) = -1 ENOENT (No such file or directory)
open("/opt/appl/executing/lib/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/opt/appl/executing/lib", {st_mode=S_IFDIR|0755, st_size=0, ...}) = 0
open("/opt/appl/started/lib/tls/ppc603/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/opt/appl/started/lib/tls/ppc603", 0xbfb940a0) = -1 ENOENT (No such file or directory)
open("/opt/appl/started/lib/tls/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/opt/appl/started/lib/tls", 0xbfb940a0) = -1 ENOENT (No such file or directory)
open("/opt/appl/started/lib/ppc603/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/opt/appl/started/lib/ppc603", 0xbfb940a0) = -1 ENOENT (No such file or directory)
open("/opt/appl/started/lib/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/opt/appl/started/lib", {st_mode=S_IFDIR|0755, st_size=0, ...}) = 0
open("/opt/appl/next/lib/tls/ppc603/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/opt/appl/next/lib/tls/ppc603", 0xbfb940a0) = -1 ENOENT (No such file or directory)
open("/opt/appl/next/lib/tls/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/opt/appl/next/lib/tls", 0xbfb940a0) = -1 ENOENT (No such file or directory)
open("/opt/appl/next/lib/ppc603/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/opt/appl/next/lib/ppc603", 0xbfb940a0) = -1 ENOENT (No such file or directory)
open("/opt/appl/next/lib/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/opt/appl/next/lib", {st_mode=S_IFDIR|0755, st_size=0, ...}) = 0
open("/etc/ld.so.cache", O_RDONLY)      = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=64, ...}) = 0
mmap(NULL, 64, PROT_READ, MAP_PRIVATE, 3, 0) = 0x48018000
close(3)                                = 0
open("/lib/tls/ppc603/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/lib/tls/ppc603", 0xbfb940a0)   = -1 ENOENT (No such file or directory)
open("/lib/tls/libc.so.6", O_RDONLY)    = -1 ENOENT (No such file or directory)
stat64("/lib/tls", 0xbfb940a0)          = -1 ENOENT (No such file or directory)
open("/lib/ppc603/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/lib/ppc603", 0xbfb940a0)       = -1 ENOENT (No such file or directory)
open("/lib/libc.so.6", O_RDONLY)        = 3
read(3, "\177ELF\1\2\1\0\0\0\0\0\0\0\0\0\0\3\0\24\0\0\0\1\0\1\314"..., 512) = 512
fstat64(3, {st_mode=S_IFREG|0755, st_size=1345728, ...}) = 0
mmap(0xfea7000, 1346452, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xfea7000
madvise(0xfea7000, 1346452, MADV_SEQUENTIAL|0x1) = 0
mprotect(0xffd8000, 97172, PROT_NONE)   = 0
mmap(0xffe8000, 24576, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x131000) = 0xffe8000
mmap(0xffee000, 7060, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xffee000
close(3)                                = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x48019000
mprotect(0xffe8000, 8192, PROT_READ)    = 0
mprotect(0x48026000, 4096, PROT_READ)   = 0
munmap(0x48018000, 64)                  = 0
open("/dev/urandom", O_RDONLY)          = 3
read(3, "a\25\24G", 4)                  = 4
close(3)                                = 0
getuid()                                = 0
open("/proc", O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY) = 3
fstat64(3, {st_mode=S_IFDIR|0555, st_size=0, ...}) = 0
fcntl64(3, F_SETFD, FD_CLOEXEC)         = 0
brk(0)                                  = 0x1007c000
brk(0x1009d000)                         = 0x1009d000
getdents64(3, /* 35 entries */, 1024)   = 1024
getdents64(3, /* 40 entries */, 1024)   = 1024
open("/proc/1/stat", O_RDONLY|O_LARGEFILE) = 4
_llseek(4, 0, 0xbfb94898, SEEK_END)     = -1 EINVAL (Invalid argument)
write(2, "start-stop-daemon: lseek: Invali"..., 43start-stop-daemon: lseek: Invalid argument
) = 43
exit_group(1)                           = ?
Process 555 detached


So it appears that lseek is no longer allowed for /proc/1/stat
Bug or feature?
start-stop-daemon works fine in 2.6.23

  Jocke


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Current git tree broke busybox start-stop-daemon
  2008-04-16 19:00 ` Alexey Dobriyan
@ 2008-04-16 19:34   ` Al Viro
  2008-04-16 19:47     ` Alexey Dobriyan
  0 siblings, 1 reply; 5+ messages in thread
From: Al Viro @ 2008-04-16 19:34 UTC (permalink / raw)
  To: Alexey Dobriyan; +Cc: Joakim Tjernlund, linux-kernel, ebiederm

On Wed, Apr 16, 2008 at 11:00:57PM +0400, Alexey Dobriyan wrote:
> On Wed, Apr 16, 2008 at 07:25:02PM +0200, Joakim Tjernlund wrote:
> > open("/proc/1/stat", O_RDONLY|O_LARGEFILE) = 4
> > _llseek(4, 0, 0xbfb94898, SEEK_END)     = -1 EINVAL (Invalid argument)
> 
> > So it appears that lseek is no longer allowed for /proc/1/stat
> > Bug or feature?
> > start-stop-daemon works fine in 2.6.23
> 
> That's what happens when switching ->llseek method from NULL
> (effectively, default_llseek), to seq_lseek (which rejects SEEK_END).
> 
> commit be614086a4aff163d5aa0dc160638d1193b59cde
> commit ee992744ea53db0a90c986fd0a70fbbf91e7f8bd
> 
> Al, do you remember why SEEK_END was omitted back then?

Because there's no sane way to implement it?  Note that original cheerfully
did nothing, since it had zero ->i_size for that file.  Which makes program
in question very odd - what behaviour does it rely upon?

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Current git tree broke busybox start-stop-daemon
  2008-04-16 19:34   ` Al Viro
@ 2008-04-16 19:47     ` Alexey Dobriyan
  0 siblings, 0 replies; 5+ messages in thread
From: Alexey Dobriyan @ 2008-04-16 19:47 UTC (permalink / raw)
  To: Al Viro; +Cc: Joakim Tjernlund, linux-kernel, ebiederm

On Wed, Apr 16, 2008 at 08:34:17PM +0100, Al Viro wrote:
> On Wed, Apr 16, 2008 at 11:00:57PM +0400, Alexey Dobriyan wrote:
> > On Wed, Apr 16, 2008 at 07:25:02PM +0200, Joakim Tjernlund wrote:
> > > open("/proc/1/stat", O_RDONLY|O_LARGEFILE) = 4
> > > _llseek(4, 0, 0xbfb94898, SEEK_END)     = -1 EINVAL (Invalid argument)
> > 
> > > So it appears that lseek is no longer allowed for /proc/1/stat
> > > Bug or feature?
> > > start-stop-daemon works fine in 2.6.23
> > 
> > That's what happens when switching ->llseek method from NULL
> > (effectively, default_llseek), to seq_lseek (which rejects SEEK_END).
> > 
> > commit be614086a4aff163d5aa0dc160638d1193b59cde
> > commit ee992744ea53db0a90c986fd0a70fbbf91e7f8bd
> > 
> > Al, do you remember why SEEK_END was omitted back then?
> 
> Because there's no sane way to implement it?

Ugly ->index games, sigh...

> Note that original cheerfully
> did nothing, since it had zero ->i_size for that file.  Which makes program
> in question very odd - what behaviour does it rely upon?

Busybox just wants to estimate size of a file. And it knows about
zero-length /proc/*/stat .

libbb/read.c:

void *xmalloc_open_read_close(const char *filename, size_t *sizep)
{
	char *buf;
	size_t size = sizep ? *sizep : INT_MAX;
	int fd;
	off_t len;

	fd = xopen(filename, O_RDONLY);
	/* /proc/N/stat files report len 0 here */
	/* In order to make such files readable, we add small const */
	len = xlseek(fd, 0, SEEK_END) | 0x3ff; /* + up to 1k */
		...


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2008-04-16 20:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-16 17:25 Current git tree broke busybox start-stop-daemon Joakim Tjernlund
2008-04-16 19:00 ` Alexey Dobriyan
2008-04-16 19:34   ` Al Viro
2008-04-16 19:47     ` Alexey Dobriyan
  -- strict thread matches above, loose matches on Subject: below --
2008-04-16 19:04 tjernlund

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.