lkml.org 
[lkml]   [1999]   [Apr]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: ext3 to include capabilities?
Hi!

> > PS: And now, questions: Does anyone see a possibility how to add
> > suitable information into _existing_ elf executable?
> >
> > I'd like to be able
> >
> >#setcap /bin/ping CAP_RAWSOCK
> >
> > without need to recompile ping. It is not essential feature. Still it
> > would be nice.
>
> Well, the most elegant way of including extra information in the ELF file is
> with a PT_NOTE segment. This would consist of a Phdr entry in the executable
> header, and the note segment itself. At exec time, the kernel would traverse
> the NOTE segments, looking for a capability note. When found, it would read it
> and do the appropriate things.
>
> I noticed your hack for adding capabilities to an executable in your patch.
> While this will work, its pretty ugly and against the intent of ELF's design.
> It's also inextensible, and means your ELF files can no longer be processed by
> standard tools. Note segments are there specifically so you can add extentions
> to an ELF file without changing its format.

I'm aware of my hack being ugly. Unfortunately what you describe does
not seem like being too simple. Is there existing tool which can do
this operations?

> One trick you can do is shift up everything in the executable by 1 page, insert
> the extra header and adjust the file offsets in the rest of the affected
> headers. This will leave the mapped contents of the address space unchanged,
> but change the header as far as the kernel sees it. This works because the
> new PT_NOTE segment is not mapped into the address space.

Ouch, uff, zee... Is there existing code to do that? [Unfortunately,
I'm not elf expert and me trying to do this complicated thing... Would
not be good.]

Ahha, seems like objcopy --add-section does the job. The remaining
things I've to figure out are how to access .note sections from
binfmt_elf... Does anyone know easy way how to modify section's p_type
from objcopy?

Pavel

--
I'm really pavel@atrey.karlin.mff.cuni.cz. Pavel
Look at http://atrey.karlin.mff.cuni.cz/~pavel/ ;-).

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:51    [W:0.686 / U:0.560 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site