linux 2.6.25 capabilities.

M

Michal

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
 
K

Keith Thompson

Michal said:
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
[snip]

Try asking in a Linux newsgroup.
 
M

Martin Ambuhl

Michal said:
Hallo Group Members

Look at your subject header:
Subject: linux 2.6.25 capabilities.

Notice that neither it nor your reported code are in fact related to any
problem with the programming language C.

Notice that you use headers which are not standard C headers, but
specific to your implementation. None of <sys/types.h>, <unistd.h>,
<sys/ipc.h>, <sys/msg.h>, or <sys/param.h> are standard C. The "sys/"
part of some of the names and "uni" in the other are clues.

Notice that "struct msqid_ds" is not defined in your code, nor is it one
of the structs defined in the C programming language,

Notice that neither of msgget() and msgctl() are standard C functions.

That suggests that your question
Have You got idea why?
cannot be answered in terms of the C programming language, but may be
better asked in a newsgroup for users of your implementation. The folks
posting in such newsgroups, after all, claim to be the experts regarding
that implementation.
 
C

CBFalconer

Michal said:
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

This uses features not provided by standard ISO C, the subject of
this newsgroup, and thus is off-topic here. Try a linux group, or
comp.unix.programmer.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,344
Messages
2,571,423
Members
48,794
Latest member
massivestack

Latest Threads

Top