Skip to content

Commit 73f52eb

Browse files
author
Dave Brolley
committed
PR 13631 and other rework of multi-privilege level support
- PR 13631 - Detection of Reqested Privilege Level in stap-server - Parsing of the client's command now uses getopt_long and shares the getopt input with session.cxx - cmdline.cxx, cmdline.h - Do not allow multiple privilege-setting options to specify different privilege levels. - No longer a need for stap-serverd to generate a --privilege option for the spawned stap. - stap-serverd cannot (and no longer does) rely on knowledge of the highest signed privilege level when evaluating the user's credentials. - Simplified user credentials test against those required by the module in stap-serverd. - Some kernel.* probes were being registered for use by stapdev only. Corrected to be stapdev | stapsys. - Corrected testsuite problem which was hiding this bug.
1 parent d680a5e commit 73f52eb

File tree

13 files changed

+302
-177
lines changed

13 files changed

+302
-177
lines changed

Makefile.am

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ stap_SOURCES = main.cxx session.cxx \
5252
tapset-been.cxx tapset-procfs.cxx tapset-timers.cxx \
5353
tapset-perfmon.cxx tapset-mark.cxx tapset-itrace.cxx \
5454
tapset-utrace.cxx task_finder.cxx dwflpp.cxx rpm_finder.cxx \
55-
setupdwfl.cxx csclient.cxx cscommon.cxx remote.cxx privilege.cxx
55+
setupdwfl.cxx csclient.cxx cscommon.cxx remote.cxx privilege.cxx cmdline.cxx
5656
noinst_HEADERS = sdt_types.h
5757
stap_LDADD = @stap_LIBS@ @sqlite3_LIBS@ @LIBINTL@
5858
stap_DEPENDENCIES =
@@ -180,7 +180,7 @@ stap_authorize_cert_LDFLAGS = $(AM_LDFLAGS) @PIELDFLAGS@
180180
stap_authorize_cert_LDADD = $(nss_LIBS)
181181

182182
if BUILD_SERVER
183-
stap_serverd_SOURCES = stap-serverd.cxx cscommon.cxx util.cxx privilege.cxx nsscommon.cxx
183+
stap_serverd_SOURCES = stap-serverd.cxx cscommon.cxx util.cxx privilege.cxx nsscommon.cxx cmdline.cxx
184184
stap_serverd_CXXFLAGS = $(AM_CXXFLAGS) @PIECXXFLAGS@ $(nss_CFLAGS)
185185
stap_serverd_CFLAGS = $(AM_CFLAGS) @PIECFLAGS@ $(nss_CFLAGS)
186186
stap_serverd_LDFLAGS = $(AM_LDFLAGS) @PIELDFLAGS@

Makefile.in

Lines changed: 40 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ loc2c_test_LINK = $(CCLD) $(loc2c_test_CFLAGS) $(CFLAGS) \
150150
@BUILD_TRANSLATOR_TRUE@ stap-cscommon.$(OBJEXT) \
151151
@BUILD_TRANSLATOR_TRUE@ stap-remote.$(OBJEXT) \
152152
@BUILD_TRANSLATOR_TRUE@ stap-privilege.$(OBJEXT) \
153-
@BUILD_TRANSLATOR_TRUE@ $(am__objects_1)
153+
@BUILD_TRANSLATOR_TRUE@ stap-cmdline.$(OBJEXT) $(am__objects_1)
154154
stap_OBJECTS = $(am_stap_OBJECTS)
155155
stap_LINK = $(CXXLD) $(stap_CXXFLAGS) $(CXXFLAGS) $(stap_LDFLAGS) \
156156
$(LDFLAGS) -o $@
@@ -173,7 +173,8 @@ stap_gen_cert_LINK = $(CXXLD) $(stap_gen_cert_CXXFLAGS) $(CXXFLAGS) \
173173
@BUILD_SERVER_TRUE@@BUILD_TRANSLATOR_TRUE@@HAVE_NSS_TRUE@ stap_serverd-cscommon.$(OBJEXT) \
174174
@BUILD_SERVER_TRUE@@BUILD_TRANSLATOR_TRUE@@HAVE_NSS_TRUE@ stap_serverd-util.$(OBJEXT) \
175175
@BUILD_SERVER_TRUE@@BUILD_TRANSLATOR_TRUE@@HAVE_NSS_TRUE@ stap_serverd-privilege.$(OBJEXT) \
176-
@BUILD_SERVER_TRUE@@BUILD_TRANSLATOR_TRUE@@HAVE_NSS_TRUE@ stap_serverd-nsscommon.$(OBJEXT)
176+
@BUILD_SERVER_TRUE@@BUILD_TRANSLATOR_TRUE@@HAVE_NSS_TRUE@ stap_serverd-nsscommon.$(OBJEXT) \
177+
@BUILD_SERVER_TRUE@@BUILD_TRANSLATOR_TRUE@@HAVE_NSS_TRUE@ stap_serverd-cmdline.$(OBJEXT)
177178
stap_serverd_OBJECTS = $(am_stap_serverd_OBJECTS)
178179
@BUILD_SERVER_TRUE@@BUILD_TRANSLATOR_TRUE@@HAVE_AVAHI_TRUE@@HAVE_NSS_TRUE@am__DEPENDENCIES_5 = $(am__DEPENDENCIES_1)
179180
@BUILD_SERVER_TRUE@@BUILD_TRANSLATOR_TRUE@@HAVE_NSS_TRUE@stap_serverd_DEPENDENCIES = $(am__DEPENDENCIES_1) \
@@ -450,7 +451,8 @@ oldinclude_HEADERS = includes/sys/sdt.h includes/sys/sdt-config.h
450451
@BUILD_TRANSLATOR_TRUE@ task_finder.cxx dwflpp.cxx \
451452
@BUILD_TRANSLATOR_TRUE@ rpm_finder.cxx setupdwfl.cxx \
452453
@BUILD_TRANSLATOR_TRUE@ csclient.cxx cscommon.cxx remote.cxx \
453-
@BUILD_TRANSLATOR_TRUE@ privilege.cxx $(am__append_12)
454+
@BUILD_TRANSLATOR_TRUE@ privilege.cxx cmdline.cxx \
455+
@BUILD_TRANSLATOR_TRUE@ $(am__append_12)
454456
@BUILD_TRANSLATOR_TRUE@noinst_HEADERS = sdt_types.h
455457
@BUILD_TRANSLATOR_TRUE@stap_LDADD = @stap_LIBS@ @sqlite3_LIBS@ \
456458
@BUILD_TRANSLATOR_TRUE@ @LIBINTL@ $(am__append_11) \
@@ -491,7 +493,7 @@ PHONIES = $(am__append_17) $(am__append_23) runcheck update-po \
491493
@BUILD_TRANSLATOR_TRUE@@HAVE_NSS_TRUE@stap_authorize_cert_CFLAGS = $(AM_CFLAGS) @PIECFLAGS@ $(nss_CFLAGS)
492494
@BUILD_TRANSLATOR_TRUE@@HAVE_NSS_TRUE@stap_authorize_cert_LDFLAGS = $(AM_LDFLAGS) @PIELDFLAGS@
493495
@BUILD_TRANSLATOR_TRUE@@HAVE_NSS_TRUE@stap_authorize_cert_LDADD = $(nss_LIBS)
494-
@BUILD_SERVER_TRUE@@BUILD_TRANSLATOR_TRUE@@HAVE_NSS_TRUE@stap_serverd_SOURCES = stap-serverd.cxx cscommon.cxx util.cxx privilege.cxx nsscommon.cxx
496+
@BUILD_SERVER_TRUE@@BUILD_TRANSLATOR_TRUE@@HAVE_NSS_TRUE@stap_serverd_SOURCES = stap-serverd.cxx cscommon.cxx util.cxx privilege.cxx nsscommon.cxx cmdline.cxx
495497
@BUILD_SERVER_TRUE@@BUILD_TRANSLATOR_TRUE@@HAVE_NSS_TRUE@stap_serverd_CXXFLAGS = $(AM_CXXFLAGS) \
496498
@BUILD_SERVER_TRUE@@BUILD_TRANSLATOR_TRUE@@HAVE_NSS_TRUE@ @PIECXXFLAGS@ \
497499
@BUILD_SERVER_TRUE@@BUILD_TRANSLATOR_TRUE@@HAVE_NSS_TRUE@ $(nss_CFLAGS) \
@@ -773,6 +775,7 @@ distclean-compile:
773775
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/loc2c_test-loc2c.Po@am__quote@
774776
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stap-buildrun.Po@am__quote@
775777
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stap-cache.Po@am__quote@
778+
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stap-cmdline.Po@am__quote@
776779
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stap-coveragedb.Po@am__quote@
777780
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stap-csclient.Po@am__quote@
778781
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stap-cscommon.Po@am__quote@
@@ -808,6 +811,7 @@ distclean-compile:
808811
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stap_gen_cert-nsscommon.Po@am__quote@
809812
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stap_gen_cert-stap-gen-cert.Po@am__quote@
810813
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stap_gen_cert-util.Po@am__quote@
814+
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stap_serverd-cmdline.Po@am__quote@
811815
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stap_serverd-cscommon.Po@am__quote@
812816
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stap_serverd-nsscommon.Po@am__quote@
813817
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stap_serverd-privilege.Po@am__quote@
@@ -1361,6 +1365,22 @@ stap-privilege.obj: privilege.cxx
13611365
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
13621366
@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(stap_CPPFLAGS) $(CPPFLAGS) $(stap_CXXFLAGS) $(CXXFLAGS) -c -o stap-privilege.obj `if test -f 'privilege.cxx'; then $(CYGPATH_W) 'privilege.cxx'; else $(CYGPATH_W) '$(srcdir)/privilege.cxx'; fi`
13631367

1368+
stap-cmdline.o: cmdline.cxx
1369+
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(stap_CPPFLAGS) $(CPPFLAGS) $(stap_CXXFLAGS) $(CXXFLAGS) -MT stap-cmdline.o -MD -MP -MF $(DEPDIR)/stap-cmdline.Tpo -c -o stap-cmdline.o `test -f 'cmdline.cxx' || echo '$(srcdir)/'`cmdline.cxx
1370+
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/stap-cmdline.Tpo $(DEPDIR)/stap-cmdline.Po
1371+
@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@
1372+
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='cmdline.cxx' object='stap-cmdline.o' libtool=no @AMDEPBACKSLASH@
1373+
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
1374+
@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(stap_CPPFLAGS) $(CPPFLAGS) $(stap_CXXFLAGS) $(CXXFLAGS) -c -o stap-cmdline.o `test -f 'cmdline.cxx' || echo '$(srcdir)/'`cmdline.cxx
1375+
1376+
stap-cmdline.obj: cmdline.cxx
1377+
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(stap_CPPFLAGS) $(CPPFLAGS) $(stap_CXXFLAGS) $(CXXFLAGS) -MT stap-cmdline.obj -MD -MP -MF $(DEPDIR)/stap-cmdline.Tpo -c -o stap-cmdline.obj `if test -f 'cmdline.cxx'; then $(CYGPATH_W) 'cmdline.cxx'; else $(CYGPATH_W) '$(srcdir)/cmdline.cxx'; fi`
1378+
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/stap-cmdline.Tpo $(DEPDIR)/stap-cmdline.Po
1379+
@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@
1380+
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='cmdline.cxx' object='stap-cmdline.obj' libtool=no @AMDEPBACKSLASH@
1381+
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
1382+
@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(stap_CPPFLAGS) $(CPPFLAGS) $(stap_CXXFLAGS) $(CXXFLAGS) -c -o stap-cmdline.obj `if test -f 'cmdline.cxx'; then $(CYGPATH_W) 'cmdline.cxx'; else $(CYGPATH_W) '$(srcdir)/cmdline.cxx'; fi`
1383+
13641384
stap-nsscommon.o: nsscommon.cxx
13651385
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(stap_CPPFLAGS) $(CPPFLAGS) $(stap_CXXFLAGS) $(CXXFLAGS) -MT stap-nsscommon.o -MD -MP -MF $(DEPDIR)/stap-nsscommon.Tpo -c -o stap-nsscommon.o `test -f 'nsscommon.cxx' || echo '$(srcdir)/'`nsscommon.cxx
13661386
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/stap-nsscommon.Tpo $(DEPDIR)/stap-nsscommon.Po
@@ -1553,6 +1573,22 @@ stap_serverd-nsscommon.obj: nsscommon.cxx
15531573
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
15541574
@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stap_serverd_CXXFLAGS) $(CXXFLAGS) -c -o stap_serverd-nsscommon.obj `if test -f 'nsscommon.cxx'; then $(CYGPATH_W) 'nsscommon.cxx'; else $(CYGPATH_W) '$(srcdir)/nsscommon.cxx'; fi`
15551575

1576+
stap_serverd-cmdline.o: cmdline.cxx
1577+
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stap_serverd_CXXFLAGS) $(CXXFLAGS) -MT stap_serverd-cmdline.o -MD -MP -MF $(DEPDIR)/stap_serverd-cmdline.Tpo -c -o stap_serverd-cmdline.o `test -f 'cmdline.cxx' || echo '$(srcdir)/'`cmdline.cxx
1578+
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/stap_serverd-cmdline.Tpo $(DEPDIR)/stap_serverd-cmdline.Po
1579+
@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@
1580+
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='cmdline.cxx' object='stap_serverd-cmdline.o' libtool=no @AMDEPBACKSLASH@
1581+
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
1582+
@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stap_serverd_CXXFLAGS) $(CXXFLAGS) -c -o stap_serverd-cmdline.o `test -f 'cmdline.cxx' || echo '$(srcdir)/'`cmdline.cxx
1583+
1584+
stap_serverd-cmdline.obj: cmdline.cxx
1585+
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stap_serverd_CXXFLAGS) $(CXXFLAGS) -MT stap_serverd-cmdline.obj -MD -MP -MF $(DEPDIR)/stap_serverd-cmdline.Tpo -c -o stap_serverd-cmdline.obj `if test -f 'cmdline.cxx'; then $(CYGPATH_W) 'cmdline.cxx'; else $(CYGPATH_W) '$(srcdir)/cmdline.cxx'; fi`
1586+
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/stap_serverd-cmdline.Tpo $(DEPDIR)/stap_serverd-cmdline.Po
1587+
@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@
1588+
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='cmdline.cxx' object='stap_serverd-cmdline.obj' libtool=no @AMDEPBACKSLASH@
1589+
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
1590+
@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stap_serverd_CXXFLAGS) $(CXXFLAGS) -c -o stap_serverd-cmdline.obj `if test -f 'cmdline.cxx'; then $(CYGPATH_W) 'cmdline.cxx'; else $(CYGPATH_W) '$(srcdir)/cmdline.cxx'; fi`
1591+
15561592
stap_sign_module-stap-sign-module.o: stap-sign-module.cxx
15571593
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(stap_sign_module_CPPFLAGS) $(CPPFLAGS) $(stap_sign_module_CXXFLAGS) $(CXXFLAGS) -MT stap_sign_module-stap-sign-module.o -MD -MP -MF $(DEPDIR)/stap_sign_module-stap-sign-module.Tpo -c -o stap_sign_module-stap-sign-module.o `test -f 'stap-sign-module.cxx' || echo '$(srcdir)/'`stap-sign-module.cxx
15581594
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/stap_sign_module-stap-sign-module.Tpo $(DEPDIR)/stap_sign_module-stap-sign-module.Po

cmdline.cxx

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
// Shared data for parsing the stap command line
2+
// Copyright (C) 2012 Red Hat Inc.
3+
//
4+
// This file is part of systemtap, and is free software. You can
5+
// redistribute it and/or modify it under the terms of the GNU General
6+
// Public License (GPL); either version 2, or (at your option) any
7+
// later version.
8+
9+
#include <cstdlib>
10+
#include "cmdline.h"
11+
12+
int stap_long_opt = 0;
13+
14+
// NB: when adding new options, consider very carefully whether they
15+
// should be restricted from stap clients (after --client-options)!
16+
struct option stap_long_options[] = {
17+
{ "kelf", 0, &stap_long_opt, LONG_OPT_KELF },
18+
{ "kmap", 2, &stap_long_opt, LONG_OPT_KMAP },
19+
{ "ignore-vmlinux", 0, &stap_long_opt, LONG_OPT_IGNORE_VMLINUX },
20+
{ "ignore-dwarf", 0, &stap_long_opt, LONG_OPT_IGNORE_DWARF },
21+
{ "skip-badvars", 0, &stap_long_opt, LONG_OPT_SKIP_BADVARS },
22+
{ "vp", 1, &stap_long_opt, LONG_OPT_VERBOSE_PASS },
23+
{ "unprivileged", 0, &stap_long_opt, LONG_OPT_UNPRIVILEGED },
24+
#define OWE5 "tter"
25+
#define OWE1 "uild-"
26+
#define OWE6 "fu-kb"
27+
#define OWE2 "i-kno"
28+
#define OWE4 "st"
29+
#define OWE3 "w-be"
30+
{ OWE4 OWE6 OWE1 OWE2 OWE3 OWE5, 0, &stap_long_opt, LONG_OPT_OMIT_WERROR },
31+
{ "client-options", 0, &stap_long_opt, LONG_OPT_CLIENT_OPTIONS },
32+
{ "help", 0, &stap_long_opt, LONG_OPT_HELP },
33+
{ "disable-cache", 0, &stap_long_opt, LONG_OPT_DISABLE_CACHE },
34+
{ "poison-cache", 0, &stap_long_opt, LONG_OPT_POISON_CACHE },
35+
{ "clean-cache", 0, &stap_long_opt, LONG_OPT_CLEAN_CACHE },
36+
{ "compatible", 1, &stap_long_opt, LONG_OPT_COMPATIBLE },
37+
{ "ldd", 0, &stap_long_opt, LONG_OPT_LDD },
38+
{ "use-server", 2, &stap_long_opt, LONG_OPT_USE_SERVER },
39+
{ "list-servers", 2, &stap_long_opt, LONG_OPT_LIST_SERVERS },
40+
{ "trust-servers", 2, &stap_long_opt, LONG_OPT_TRUST_SERVERS },
41+
{ "use-server-on-error", 2, &stap_long_opt, LONG_OPT_USE_SERVER_ON_ERROR },
42+
{ "all-modules", 0, &stap_long_opt, LONG_OPT_ALL_MODULES },
43+
{ "remote", 1, &stap_long_opt, LONG_OPT_REMOTE },
44+
{ "remote-prefix", 0, &stap_long_opt, LONG_OPT_REMOTE_PREFIX },
45+
{ "check-version", 0, &stap_long_opt, LONG_OPT_CHECK_VERSION },
46+
{ "version", 0, &stap_long_opt, LONG_OPT_VERSION },
47+
{ "tmpdir", 1, &stap_long_opt, LONG_OPT_TMPDIR },
48+
{ "download-debuginfo", 2, &stap_long_opt, LONG_OPT_DOWNLOAD_DEBUGINFO },
49+
{ "dump-probe-types", 0, &stap_long_opt, LONG_OPT_DUMP_PROBE_TYPES },
50+
{ "privilege", 1, &stap_long_opt, LONG_OPT_PRIVILEGE },
51+
{ "suppress-handler-errors", 0, &stap_long_opt, LONG_OPT_SUPPRESS_HANDLER_ERRORS },
52+
{ "modinfo", 1, &stap_long_opt, LONG_OPT_MODINFO },
53+
{ NULL, 0, NULL, 0 }
54+
};

cmdline.h

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
// -*- C++ -*-
2+
// Copyright (C) 2012 Red Hat Inc.
3+
//
4+
// This file is part of systemtap, and is free software. You can
5+
// redistribute it and/or modify it under the terms of the GNU General
6+
// Public License (GPL); either version 2, or (at your option) any
7+
// later version.
8+
9+
#ifndef CMDLINE_H
10+
#define CMDLINE_H 1
11+
extern "C" {
12+
#include <getopt.h>
13+
}
14+
15+
// NB: when adding new options, consider very carefully whether they
16+
// should be restricted from stap clients (after --client-options)!
17+
#define LONG_OPT_KELF 1
18+
#define LONG_OPT_KMAP 2
19+
#define LONG_OPT_IGNORE_VMLINUX 3
20+
#define LONG_OPT_IGNORE_DWARF 4
21+
#define LONG_OPT_VERBOSE_PASS 5
22+
#define LONG_OPT_SKIP_BADVARS 6
23+
#define LONG_OPT_UNPRIVILEGED 7
24+
#define LONG_OPT_OMIT_WERROR 8
25+
#define LONG_OPT_CLIENT_OPTIONS 9
26+
#define LONG_OPT_HELP 10
27+
#define LONG_OPT_DISABLE_CACHE 11
28+
#define LONG_OPT_POISON_CACHE 12
29+
#define LONG_OPT_CLEAN_CACHE 13
30+
#define LONG_OPT_COMPATIBLE 14
31+
#define LONG_OPT_LDD 15
32+
#define LONG_OPT_USE_SERVER 16
33+
#define LONG_OPT_LIST_SERVERS 17
34+
#define LONG_OPT_TRUST_SERVERS 18
35+
#define LONG_OPT_ALL_MODULES 19
36+
#define LONG_OPT_REMOTE 20
37+
#define LONG_OPT_CHECK_VERSION 21
38+
#define LONG_OPT_USE_SERVER_ON_ERROR 22
39+
#define LONG_OPT_VERSION 23
40+
#define LONG_OPT_REMOTE_PREFIX 24
41+
#define LONG_OPT_TMPDIR 25
42+
#define LONG_OPT_DOWNLOAD_DEBUGINFO 26
43+
#define LONG_OPT_DUMP_PROBE_TYPES 27
44+
#define LONG_OPT_PRIVILEGE 28
45+
#define LONG_OPT_SUPPRESS_HANDLER_ERRORS 29
46+
#define LONG_OPT_MODINFO 30
47+
48+
// NB: when adding new options, consider very carefully whether they
49+
// should be restricted from stap clients (after --client-options)!
50+
#define STAP_SHORT_OPTIONS "hVvtp:I:e:o:R:r:a:m:kgPc:x:D:bs:uqwl:d:L:FS:B:WG:"
51+
52+
extern struct option stap_long_options[];
53+
extern int stap_long_opt;
54+
55+
#endif // CMDLINE_H

privilege.cxx

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -25,24 +25,6 @@ extern "C" {
2525

2626
using namespace std;
2727

28-
privilege_t pr_next (privilege_t p)
29-
{
30-
switch (p)
31-
{
32-
case pr_stapusr:
33-
p = pr_stapsys;
34-
break;
35-
case pr_stapsys:
36-
p = pr_stapdev;
37-
break;
38-
case pr_stapdev:
39-
default:
40-
p = pr_end;
41-
break;
42-
}
43-
return p;
44-
}
45-
4628
const char *pr_name (privilege_t p)
4729
{
4830
switch (p)

privilege.h

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,24 +13,20 @@ typedef enum privilege_t {
1313
pr_stapsys = 0x00000004, // Member of stapsys
1414
pr_stapdev = 0x00000008, // Member of stapdev
1515

16-
// These are used for iterating
17-
pr_begin = pr_stapusr,
18-
pr_end = pr_unknown,
19-
2016
// Predefined sets
2117
pr_highest = pr_stapdev,
22-
pr_highest_signed = pr_stapsys,
18+
pr_unprivileged = pr_stapusr,
19+
pr_privileged = pr_stapsys | pr_stapdev,
2320
pr_all = pr_stapusr | pr_stapsys | pr_stapdev
2421
} privilege_t;
2522

26-
// Name of the section in the module used to store privilege information.
23+
// Name of the section in the module used to store privilege information.
2724
#define STAP_PRIVILEGE_SECTION ".stap_privilege"
2825

2926
// Privilege management.
3027
#if defined(c_plusplus) || defined(__cplusplus)
3128
extern "C" {
3229
#endif
33-
privilege_t pr_next (privilege_t p);
3430
const char *pr_name (privilege_t p);
3531
int pr_contains (privilege_t actual, privilege_t required);
3632
privilege_t get_privilege_credentials (void);

0 commit comments

Comments
 (0)