[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

glibc - capaibility control mechanism



Situation:

Current glibc have a mechanism called hwcaps. It is not documented and
I was never able to correctly use it anyway. Parts of this mechanism are
used to have TLS libraries.
There are several problems with that:
- Several hacks to use that for tls.
- Not working.

Proposal:

* The capabilities are referenced by name. There are several sources available
  to select the used ones, others may be added later:
  - /etc/ld.so.capabilities
  - environment variable: LD_CAPABILITIES

  The grammer for it is
  CAPABILITY-STRING := ( CLEAR | DEFAULT | CHANGE ) { SEP CHANGE };
  CLEAR := "clear";
  DEFAULT := "default";
  CHANGE := ( PLUS | MINUS ) CAPABILITY;
  PLUS := "+";
  MINUS := "-";
  CAPABILITY := character { character };
  SEP := " " { " " };

  "clear" resets to an empty set. "default" resets to a sane default. "-tls"
  removes tls from the set of used capabilities.
  
* ld.so should only use informations from the cache file to find libs
  for additional capabilities, this behaviour may be disabled for
  special capabilities like tls, this removes the io overhead for
  additional capabilities. This implies that a missing cache file will
  disable any but that special capabilities, but I don't see that as a
  problem.

Examples

Available capabilities:
- a (marked as essential), priority: 3
- b (marked as default), priority: 2
- c, priority: 1

* Scenario 1:
  - No cache file
  - /etc/ld.so.capabilities is not existant
  Libraries order:
  - a/liba.so
  - liba.so

* Scenario 2:
  - No cache file
  - /etc/ld.so.capabilities: "-a" or "clear"
  Libraries order:
  - liba.so

* Scenario 3:
  - Cache file is available
  - /etc/ld.so.capabilities is not existant
  Libraries order:
  - a/b/liba.so
  - a/liba.so
  - b/liba.so
  - liba.so

* Scenario 4:
  - Cache file is available
  - /etc/ld.so.capabilities: "+c" or LD_CAPABILITIES: "+c"
  Libraries order:
  - a/b/c/liba.so
  - a/b/liba.so
  - a/liba.so
  - b/c/liba.so
  - b/liba.so
  - c/liba.so
  - liba.so

* Scenario 5:
  - Cache file is available
  - /etc/ld.so.capabilities: "clear" or LD_CAPABILITIES: "clear"
  Libraries order:
  - liba.so

* Scenario 6:
  - Cache file is available
  - /etc/ld.so.capabilities: "+c"
  - LD_CAPABILITIES: "default"
  Libraries order:
  - a/b/liba.so
  - a/liba.so
  - b/liba.so
  - liba.so

Bastian

-- 
Either one of us, by himself, is expendable.  Both of us are not.
		-- Kirk, "The Devil in the Dark", stardate 3196.1

Attachment: signature.asc
Description: Digital signature


Reply to: