Bug#775624: procps: FTBFS in jessie: dh_auto_test: make -j1 check returned exit code 2

2015-03-06 Thread Craig Small
On Thu, Mar 05, 2015 at 08:31:23AM +0100, Niels Thykier wrote:
 Is there anything holding up this bug from being fixed?
 
 If the linux patch will solve this then please CC the linux maintainers
 and ask them to apply it (assuming it was not included in their
 3.16.7-ckt7-1 upload).
 
 Otherwise, if the test is broken, then please patch out the test.
Just my forgetfullness. I'm building the package now and should be
uploaded in 30 mins or so.  I'm not sure what this linux fix is but
procps will handle either the old way or new way.

 - craig

-- 
Craig Small (@smallsees)   http://enc.com.au/   csmall at : enc.com.au
Debian GNU/Linux   http://www.debian.org/   csmall at : debian.org
GPG fingerprint:5D2F B320 B825 D939 04D2  0519 3938 F96B DF50 FEA5


-- 
To UNSUBSCRIBE, email to debian-bugs-rc-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#775624: procps: FTBFS in jessie: dh_auto_test: make -j1 check returned exit code 2

2015-03-04 Thread Niels Thykier
On Sat, 24 Jan 2015 08:59:23 +0100 Vincent Bernat ber...@debian.org wrote:
  ❦ 24 janvier 2015 18:50 +1100, Craig Small csm...@debian.org :
 
  I'm not sure if you are able to, but if you could apply the
  attached patch to see if the test works now that would be
  great.
 
  make
  make test (fails)
  apply patch
  make
  make test (works)
 
 Yes, the patch makes the tests pass.
 -- 
 Write and test a big program in small pieces.
 - The Elements of Programming Style (Kernighan  Plauger)

Hi,

Is there anything holding up this bug from being fixed?

If the linux patch will solve this then please CC the linux maintainers
and ask them to apply it (assuming it was not included in their
3.16.7-ckt7-1 upload).

Otherwise, if the test is broken, then please patch out the test.

Thanks,
~Niels


-- 
To UNSUBSCRIBE, email to debian-bugs-rc-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#775624: procps: FTBFS in jessie: dh_auto_test: make -j1 check returned exit code 2

2015-01-24 Thread Vincent Bernat
 ❦ 24 janvier 2015 18:50 +1100, Craig Small csm...@debian.org :

 I'm not sure if you are able to, but if you could apply the
 attached patch to see if the test works now that would be
 great.

 make
 make test (fails)
 apply patch
 make
 make test (works)

Yes, the patch makes the tests pass.
-- 
Write and test a big program in small pieces.
- The Elements of Programming Style (Kernighan  Plauger)


signature.asc
Description: PGP signature


Bug#775624: procps: FTBFS in jessie: dh_auto_test: make -j1 check returned exit code 2

2015-01-23 Thread Craig Small
On Fri, Jan 23, 2015 at 12:58:27PM +0100, Vincent Bernat wrote:
 Same, but:
 
 $ cat /proc/1/smaps
 cat: /proc/1/smaps: Permission denied
A user, any user, is able to open that file. However only some users can
read the file.

This is strace of more /proc/1/smaps the open succeeds but the read
fails.

open(/proc/1/smaps, O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 
0x7f8c6c9cc000
lseek(3, 0, SEEK_SET)   = 0
read(3, 0x7f8c6c9cc000, 1024)   = -1 EACCES (Permission denied)

The tests are correctly detecting something. Something in the kernel has
changed (yet again) meaning that pmap's behaviour has changed, failing
the test.

If you run the exact same command on my computer and your computer,
you will get a different result.

Interestingly, cat gives permission denied, more does not though it
doesn't print anything either.

Can you strace pmap -X 1 and send me the output?
What I'm looking for is, in my strace
line 86
open(/proc/1/smaps, O_RDONLY) = 3
then 94,96
fstat(3, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0
read(3, 0x7f7026b42000, 1024)   = -1 EACCES (Permission denied)

This is equivalent of the fopen() working in one_proc and the read()
failing in print_extended_maps

I suspect that something strange is going on with the open()

-- 
Craig Small (@smallsees)   http://enc.com.au/   csmall at : enc.com.au
Debian GNU/Linux   http://www.debian.org/   csmall at : debian.org
GPG fingerprint:5D2F B320 B825 D939 04D2  0519 3938 F96B DF50 FEA5


-- 
To UNSUBSCRIBE, email to debian-bugs-rc-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#775624: procps: FTBFS in jessie: dh_auto_test: make -j1 check returned exit code 2

2015-01-23 Thread Vincent Bernat
Control: tags -1 + patch

 ❦ 18 janvier 2015 01:49 +0100, Lucas Nussbaum lu...@lucas-nussbaum.net :

 During a rebuild of all packages in jessie (in a jessie chroot, not a
 sid chroot), your package failed to build on amd64.

I am able to reproduce this bug as well.

The failure happens in pmap test on an unreachable process (PID 1). pmap
just exits with status 1 in this case because it isn't able to open
/proc/1/smaps. The test is expecting to see the process PID and name as
the first line. I can't see why the test would have worked at some
point. Either you are root and you will get the full map or you are not
and you won't get the expected first line because it is only displayed
if a user is able to open /proc/1/smaps.

Here is a patch just removing the test.

Description: don't test pmap against unreachable process
 When running as root, the test will fail because 1 will be
 reachable. When running as non-root, the test will fail because pmap
 doesn't even try to read the process map when /proc/XX/smaps is not
 readable.
Bug-Debian: https://bugs.debian.org/775624
Last-Update: 2015-01-23

Index: procps-3.3.9/testsuite/pmap.test/pmap.exp
===
--- procps-3.3.9.orig/testsuite/pmap.test/pmap.exp
+++ procps-3.3.9/testsuite/pmap.test/pmap.exp
@@ -57,12 +57,3 @@ expect_table $test $pmap_generic_header
 set test pmap double extra extended output
 spawn $pmap -XX $mypid
 expect_table $test $pmap_generic_header \[^=\]+ \[= \]+
-
-set test pmap X with unreachable process
-spawn $pmap -X 1
-expect_pass $test $pmap_initname\$
-
-set test pmap XX with unreachable process
-spawn $pmap -XX 1
-expect_pass $test $pmap_initname\$
-

-- 
Make sure input cannot violate the limits of the program.
- The Elements of Programming Style (Kernighan  Plauger)


signature.asc
Description: PGP signature


Processed: Re: Bug#775624: procps: FTBFS in jessie: dh_auto_test: make -j1 check returned exit code 2

2015-01-23 Thread Debian Bug Tracking System
Processing control commands:

 tags -1 + patch
Bug #775624 [src:procps] procps: FTBFS in jessie: dh_auto_test: make -j1 check 
returned exit code 2
Added tag(s) patch.

-- 
775624: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=775624
Debian Bug Tracking System
Contact ow...@bugs.debian.org with problems


--
To UNSUBSCRIBE, email to debian-bugs-rc-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#775624: procps: FTBFS in jessie: dh_auto_test: make -j1 check returned exit code 2

2015-01-23 Thread Vincent Bernat
 ❦ 23 janvier 2015 22:16 +1100, Craig Small csm...@debian.org :

 /proc/1/smaps. The test is expecting to see the process PID and name as
 the first line. I can't see why the test would have worked at some
 You mean like this?
 $ pmap -X 1
 1:   /sbin/init

I get:

$ pmap -X 1
$ echo $?
1

 if a user is able to open /proc/1/smaps.
 $ ls -l /proc/1/smaps
 -r--r--r-- 1 root root 0 Jan 23 22:12 /proc/1/smaps

 So, do you have a different set of permissions?

Same, but:

$ cat /proc/1/smaps
cat: /proc/1/smaps: Permission denied
$ uname -r
3.18.0-trunk-amd64
-- 
Let us endeavor so to live that when we come to die even the undertaker will be
sorry.
-- Mark Twain, Pudd'nhead Wilson's Calendar


signature.asc
Description: PGP signature


Bug#775624: procps: FTBFS in jessie: dh_auto_test: make -j1 check returned exit code 2

2015-01-23 Thread Vincent Bernat
 ❦ 24 janvier 2015 13:40 +1100, Craig Small csm...@debian.org :

 $ cat /proc/1/smaps
 cat: /proc/1/smaps: Permission denied
 A user, any user, is able to open that file. However only some users can
 read the file.

 This is strace of more /proc/1/smaps the open succeeds but the read
 fails.

 open(/proc/1/smaps, O_RDONLY) = 3
 fstat(3, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0
 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 
 0x7f8c6c9cc000
 lseek(3, 0, SEEK_SET)   = 0
 read(3, 0x7f8c6c9cc000, 1024)   = -1 EACCES (Permission
 denied)

With 3.18:

open(/proc/1/smaps, O_RDONLY) = -1 EACCES (Permission denied)

 Can you strace pmap -X 1 and send me the output?
 What I'm looking for is, in my strace
 line 86
 open(/proc/1/smaps, O_RDONLY) = 3
 then 94,96
 fstat(3, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0
 read(3, 0x7f7026b42000, 1024)   = -1 EACCES (Permission
 denied)

Same as for more.
-- 
Use uniform input formats.
- The Elements of Programming Style (Kernighan  Plauger)


signature.asc
Description: PGP signature


Bug#775624: procps: FTBFS in jessie: dh_auto_test: make -j1 check returned exit code 2

2015-01-23 Thread Craig Small
On Sat, Jan 24, 2015 at 08:25:20AM +0100, Vincent Bernat wrote:
  ❦ 24 janvier 2015 13:40 +1100, Craig Small csm...@debian.org :
  open(/proc/1/smaps, O_RDONLY) = 3

 With 3.18:
 
 open(/proc/1/smaps, O_RDONLY) = -1 EACCES (Permission denied)
Ah ha, there we have it (and confirmed in your next email around the
kernel change).

I'll pull the printing of the process ahead of the open and we should
all be good, or at least consistent.

My guess is whenever this was written, noone would of thought you
could open a file then hit a permission denied on the read of that
file descriptor.

I'm not sure if you are able to, but if you could apply the
attached patch to see if the test works now that would be
great.

make
make test (fails)
apply patch
make
make test (works)

 Same as for more.
My more shows different to cat.
I think the kernel patch will give a more consistent look to a lot
of things that use that file.

 - Craig

-- 
Craig Small (@smallsees)   http://enc.com.au/   csmall at : enc.com.au
Debian GNU/Linux   http://www.debian.org/   csmall at : debian.org
GPG fingerprint:5D2F B320 B825 D939 04D2  0519 3938 F96B DF50 FEA5
diff --git a/pmap.c b/pmap.c
index c83617c..17e0e30 100644
--- a/pmap.c
+++ b/pmap.c
@@ -533,6 +533,10 @@ static int one_proc(proc_t * p)
 	 */
 	int maxcmd = 0xf;
 
+	escape_command(cmdbuf, p, sizeof cmdbuf, maxcmd,
+		   ESC_ARGS | ESC_BRACKETS);
+	printf(%u:   %s\n, p-tgid, cmdbuf);
+
 	if (x_option || X_option || c_option) {
 		sprintf(buf, /proc/%u/smaps, p-tgid);
 		if ((fp = fopen(buf, r)) == NULL)
@@ -543,10 +547,6 @@ static int one_proc(proc_t * p)
 			return 1;
 	}
 
-	escape_command(cmdbuf, p, sizeof cmdbuf, maxcmd,
-		   ESC_ARGS | ESC_BRACKETS);
-	printf(%u:   %s\n, p-tgid, cmdbuf);
-
 	if (X_option || c_option) {
 		print_extended_maps(fp);
 		return 0;


Bug#775624: procps: FTBFS in jessie: dh_auto_test: make -j1 check returned exit code 2

2015-01-23 Thread Vincent Bernat
 ❦ 24 janvier 2015 13:40 +1100, Craig Small csm...@debian.org :

 This is strace of more /proc/1/smaps the open succeeds but the read
 fails.

 open(/proc/1/smaps, O_RDONLY) = 3
 fstat(3, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0
 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 
 0x7f8c6c9cc000
 lseek(3, 0, SEEK_SET)   = 0
 read(3, 0x7f8c6c9cc000, 1024)   = -1 EACCES (Permission
 denied)

This was changed in 29a40ace841cba9b661711f042d1821cdc4ad47c (introduced
in 3.18rc1):

commit 29a40ace841cba9b661711f042d1821cdc4ad47c
Author: Oleg Nesterov o...@redhat.com
Date:   Thu Oct 9 15:25:26 2014 -0700

fs/proc/task_mmu.c: shift mm_access() from m_start() to proc_maps_open()

A simple test-case from Kirill Shutemov

cat /proc/self/maps /dev/null
chmod +x /proc/self/net/packet
exec /proc/self/net/packet

makes lockdep unhappy, cat/exec take seq_file-lock + cred_guard_mutex in
the opposite order.

It's a false positive and probably we should not allow chmod +x on proc
files. Still I think that we should avoid mm_access() and cred_guard_mutex
in sys_read() paths, security checking should happen at open time. Besides,
this doesn't even look right if the task changes its -mm between m_stop()
and m_start().

Add the new mm_struct *mm member into struct proc_maps_private and change
proc_maps_open() to initialize it using proc_mem_open(). Change m_start() to
use priv-mm if atomic_inc_not_zero(mm_users) succeeds or return NULL (eof)
otherwise.

The only complication is that proc_maps_open() users should additionally do
mmdrop() in fop-release(), add the new proc_map_release() helper for that.

Note: this is the user-visible change, if the task execs after open(maps)
the new -mm won't be visible via this file. I hope this is fine, and this
matches /proc/pid/mem bahaviour.

[a...@linux-foundation.org: coding-style fixes]
Signed-off-by: Oleg Nesterov o...@redhat.com
Reported-by: Kirill A. Shutemov kir...@shutemov.name
Acked-by: Kirill A. Shutemov kirill.shute...@linux.intel.com
Acked-by: Cyrill Gorcunov gorcu...@openvz.org
Cc: Eric W. Biederman ebied...@xmission.com
Signed-off-by: Andrew Morton a...@linux-foundation.org
Signed-off-by: Linus Torvalds torva...@linux-foundation.org

diff --git a/fs/proc/internal.h b/fs/proc/internal.h
index 3c685563406f..d27182854a28 100644
--- a/fs/proc/internal.h
+++ b/fs/proc/internal.h
@@ -270,6 +270,7 @@ extern int proc_remount(struct super_block *, int *, char 
*);
 struct proc_maps_private {
struct pid *pid;
struct task_struct *task;
+   struct mm_struct *mm;
 #ifdef CONFIG_MMU
struct vm_area_struct *tail_vma;
 #endif
diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
index 4d716a09d500..a1454dac7e0a 100644
--- a/fs/proc/task_mmu.c
+++ b/fs/proc/task_mmu.c
@@ -165,9 +165,9 @@ static void *m_start(struct seq_file *m, loff_t *pos)
if (!priv-task)
return ERR_PTR(-ESRCH);
 
-   mm = mm_access(priv-task, PTRACE_MODE_READ);
-   if (!mm || IS_ERR(mm))
-   return mm;
+   mm = priv-mm;
+   if (!mm || !atomic_inc_not_zero(mm-mm_users))
+   return NULL;
down_read(mm-mmap_sem);
 
tail_vma = get_gate_vma(mm);
@@ -240,9 +240,28 @@ static int proc_maps_open(struct inode *inode, struct file 
*file,
return -ENOMEM;
 
priv-pid = proc_pid(inode);
+   priv-mm = proc_mem_open(inode, PTRACE_MODE_READ);
+   if (IS_ERR(priv-mm)) {
+   int err = PTR_ERR(priv-mm);
+
+   seq_release_private(inode, file);
+   return err;
+   }
+
return 0;
 }
 
+static int proc_map_release(struct inode *inode, struct file *file)
+{
+   struct seq_file *seq = file-private_data;
+   struct proc_maps_private *priv = seq-private;
+
+   if (priv-mm)
+   mmdrop(priv-mm);
+
+   return seq_release_private(inode, file);
+}
+
 static int do_maps_open(struct inode *inode, struct file *file,
const struct seq_operations *ops)
 {
@@ -398,14 +417,14 @@ const struct file_operations proc_pid_maps_operations = {
.open   = pid_maps_open,
.read   = seq_read,
.llseek = seq_lseek,
-   .release= seq_release_private,
+   .release= proc_map_release,
 };
 
 const struct file_operations proc_tid_maps_operations = {
.open   = tid_maps_open,
.read   = seq_read,
.llseek = seq_lseek,
-   .release= seq_release_private,
+   .release= proc_map_release,
 };
 
 /*
@@ -680,14 +699,14 @@ const struct file_operations proc_pid_smaps_operations = {
.open   = pid_smaps_open,
.read   = seq_read,
.llseek = seq_lseek,
-   

Bug#775624: procps: FTBFS in jessie: dh_auto_test: make -j1 check returned exit code 2

2015-01-23 Thread Craig Small
On Fri, Jan 23, 2015 at 10:22:51AM +0100, Vincent Bernat wrote:
 /proc/1/smaps. The test is expecting to see the process PID and name as
 the first line. I can't see why the test would have worked at some
You mean like this?
$ pmap -X 1
1:   /sbin/init

 if a user is able to open /proc/1/smaps.
$ ls -l /proc/1/smaps
-r--r--r-- 1 root root 0 Jan 23 22:12 /proc/1/smaps

So, do you have a different set of permissions?

 - Craig

-- 
Craig Small (@smallsees)   http://enc.com.au/   csmall at : enc.com.au
Debian GNU/Linux   http://www.debian.org/   csmall at : debian.org
GPG fingerprint:5D2F B320 B825 D939 04D2  0519 3938 F96B DF50 FEA5


-- 
To UNSUBSCRIBE, email to debian-bugs-rc-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#775624: procps: FTBFS in jessie: dh_auto_test: make -j1 check returned exit code 2

2015-01-17 Thread Lucas Nussbaum
Source: procps
Version: 2:3.3.9-8
Severity: serious
Tags: jessie sid
User: debian...@lists.debian.org
Usertags: qa-ftbfs-20150117 qa-ftbfs
Justification: FTBFS in jessie on amd64

Hi,

During a rebuild of all packages in jessie (in a jessie chroot, not a
sid chroot), your package failed to build on amd64.

Relevant part (hopefully):
 make[4]: Entering directory '/«PKGBUILDDIR»/testsuite'
 Making a new site.exp file ...
 srcdir='.'; export srcdir; \
 EXPECT=expect; export EXPECT; \
 if /bin/bash -c runtest --version  /dev/null 21; then \
   exit_status=0; l='pmap slabtop sysctl kill free lib pgrep pkill ps pwdx 
 uptime vmstat w'; for tool in $l; do \
 if runtest  --tool $tool --srcdir $srcdir ; \
 then :; else exit_status=1; fi; \
   done; \
 else echo WARNING: could not find 'runtest' 12; :;\
 fi; \
 exit $exit_status
 WARNING: Couldn't find tool init file
 Test Run By user on Sat Jan 17 22:44:49 2015
 Native configuration is x86_64-pc-linux-gnu
 
   === pmap tests ===
 
 Schedule of variations:
 unix
 
 Running target unix
 Using /usr/share/dejagnu/baseboards/unix.exp as board description file for 
 target.
 Using /usr/share/dejagnu/config/unix.exp as generic interface file for target.
 Using ./config/unix.exp as tool-and-target-specific interface file.
 Running ./pmap.test/pmap.exp ...
 
   === pmap Summary ===
 
 # of expected passes  11
 /«PKGBUILDDIR»/pmap version 3.3.9
 
 WARNING: Couldn't find tool init file
 Test Run By user on Sat Jan 17 22:44:50 2015
 Native configuration is x86_64-pc-linux-gnu
 
   === slabtop tests ===
 
 Schedule of variations:
 unix
 
 Running target unix
 Using /usr/share/dejagnu/baseboards/unix.exp as board description file for 
 target.
 Using /usr/share/dejagnu/config/unix.exp as generic interface file for target.
 Using ./config/unix.exp as tool-and-target-specific interface file.
 Running ./slabtop.test/slabtop.exp ...
 
   === slabtop Summary ===
 
 # of unsupported tests1
 WARNING: Couldn't find tool init file
 Test Run By user on Sat Jan 17 22:44:50 2015
 Native configuration is x86_64-pc-linux-gnu
 
   === sysctl tests ===
 
 Schedule of variations:
 unix
 
 Running target unix
 Using /usr/share/dejagnu/baseboards/unix.exp as board description file for 
 target.
 Using /usr/share/dejagnu/config/unix.exp as generic interface file for target.
 Using ./config/unix.exp as tool-and-target-specific interface file.
 Running ./sysctl.test/sysctl_read.exp ...
 
   === sysctl Summary ===
 
 # of expected passes  5
 /«PKGBUILDDIR»/sysctl version 3.3.9
 
 WARNING: Couldn't find tool init file
 Test Run By user on Sat Jan 17 22:44:50 2015
 Native configuration is x86_64-pc-linux-gnu
 
   === kill tests ===
 
 Schedule of variations:
 unix
 
 Running target unix
 Using /usr/share/dejagnu/baseboards/unix.exp as board description file for 
 target.
 Using /usr/share/dejagnu/config/unix.exp as generic interface file for target.
 Using ./config/unix.exp as tool-and-target-specific interface file.
 Running ./kill.test/kill.exp ...
 
   === kill Summary ===
 
 # of expected passes  5
 /«PKGBUILDDIR»/kill version 3.3.9
 
 WARNING: Couldn't find tool init file
 Test Run By user on Sat Jan 17 22:44:50 2015
 Native configuration is x86_64-pc-linux-gnu
 
   === free tests ===
 
 Schedule of variations:
 unix
 
 Running target unix
 Using /usr/share/dejagnu/baseboards/unix.exp as board description file for 
 target.
 Using /usr/share/dejagnu/config/unix.exp as generic interface file for target.
 Using ./config/unix.exp as tool-and-target-specific interface file.
 Running ./free.test/free.exp ...
 
   === free Summary ===
 
 # of expected passes  11
 /«PKGBUILDDIR»/free version 3.3.9
 
 WARNING: Couldn't find tool init file
 Test Run By user on Sat Jan 17 22:44:52 2015
 Native configuration is x86_64-pc-linux-gnu
 
   === lib tests ===
 
 Schedule of variations:
 unix
 
 Running target unix
 Using /usr/share/dejagnu/baseboards/unix.exp as board description file for 
 target.
 Using /usr/share/dejagnu/config/unix.exp as generic interface file for target.
 Using ./config/unix.exp as tool-and-target-specific interface file.
 Running ./lib.test/fileutils.exp ...
 Running ./lib.test/strutils.exp ...
 
   === lib Summary ===
 
 # of expected passes  8
 WARNING: Couldn't find tool init file
 Test Run By user on Sat Jan 17 22:44:52 2015
 Native configuration is x86_64-pc-linux-gnu
 
   === pgrep tests ===
 
 Schedule of variations:
 unix
 
 Running target unix
 Using /usr/share/dejagnu/baseboards/unix.exp as board description file for 
 target.
 Using /usr/share/dejagnu/config/unix.exp as generic interface file for target.
 Using ./config/unix.exp as tool-and-target-specific interface file.
 Running ./pgrep.test/pgrep.exp ...
 
   === pgrep