Hallo Group Members
I have the following problem with capabilities under linux. It looks
like they are not taken into consideration when when program is run in
gdb. A bit more detailed below
/tmp/p1.c:
#include <sys/types.h>
#include <unistd.h>
#include <sys/ipc.h>
#include <sys/msg.h>
#include <sys/param.h>
#include <string.h>
#include <time.h>
#include <stdio.h>
#include <errno.h>
int main() {
struct msqid_ds ds;
int queue_id = msgget( 1/*key*/, IPC_CREAT|0666 );
if ( msgctl(queue_id, IPC_STAT, &ds) != 0 )
return 0;
ds.msg_qbytes = 256*1024;
if ( msgctl(queue_id, IPC_SET, &ds) < 0 ) {
printf( "Error: %s\n", strerror( errno ) );
}
return 0;
}
prompt$ /tmp/p1
Error: Operation not permitted
prompt# /usr/sbin/setcap CAP_SYS_RESOURCE+eip /tmp/p1
prompt$ /tmp/p1 #. now works fine.
prompt$
but:
prompt$ gdb /tmp/p1
GNU gdb Fedora (6.8-17.fc9)
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "i386-redhat-linux-gnu"...
(gdb) run
Starting program: /tmp/p1
Error: Operation not permitted
Program exited normally.
prompt$ gcc --version
gcc (GCC) 4.3.0 20080428 (Red Hat 4.3.0-8)
Copyright (C) 2008 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
I am running fedora core 9 with kernel 2.6.25.14-108.
Have You got idea why?
Best regards