1. 21 10月, 2010 8 次提交
    • E
      secmark: make secmark object handling generic · 2606fd1f
      Eric Paris 提交于
      Right now secmark has lots of direct selinux calls.  Use all LSM calls and
      remove all SELinux specific knowledge.  The only SELinux specific knowledge
      we leave is the mode.  The only point is to make sure that other LSMs at
      least test this generic code before they assume it works.  (They may also
      have to make changes if they do not represent labels as strings)
      Signed-off-by: NEric Paris <eparis@redhat.com>
      Acked-by: NPaul Moore <paul.moore@hp.com>
      Acked-by: NPatrick McHardy <kaber@trash.net>
      Signed-off-by: NJames Morris <jmorris@namei.org>
      2606fd1f
    • K
      security: remove unused parameter from security_task_setscheduler() · b0ae1981
      KOSAKI Motohiro 提交于
      All security modules shouldn't change sched_param parameter of
      security_task_setscheduler().  This is not only meaningless, but also
      make a harmful result if caller pass a static variable.
      
      This patch remove policy and sched_param parameter from
      security_task_setscheduler() becuase none of security module is
      using it.
      
      Cc: James Morris <jmorris@namei.org>
      Signed-off-by: NKOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
      Signed-off-by: NJames Morris <jmorris@namei.org>
      b0ae1981
    • K
      selinux: fix up style problem on /selinux/status · 36f7f284
      KaiGai Kohei 提交于
      This patch fixes up coding-style problem at this commit:
      
       4f27a7d49789b04404eca26ccde5f527231d01d5
       selinux: fast status update interface (/selinux/status)
      Signed-off-by: NKaiGai Kohei <kaigai@ak.jp.nec.com>
      Signed-off-by: NJames Morris <jmorris@namei.org>
      36f7f284
    • M
      selinux: change to new flag variable · 8b0c543e
      matt mooney 提交于
      Replace EXTRA_CFLAGS with ccflags-y.
      Signed-off-by: Nmatt mooney <mfm@muteddisk.com>
      Signed-off-by: NJames Morris <jmorris@namei.org>
      8b0c543e
    • P
      selinux: really fix dependency causing parallel compile failure. · 60272da0
      Paul Gortmaker 提交于
      While the previous change to the selinux Makefile reduced the window
      significantly for this failure, it is still possible to see a compile
      failure where cpp starts processing selinux files before the auto
      generated flask.h file is completed.  This is easily reproduced by
      adding the following temporary change to expose the issue everytime:
      
      -      cmd_flask = scripts/selinux/genheaders/genheaders ...
      +      cmd_flask = sleep 30 ; scripts/selinux/genheaders/genheaders ...
      
      This failure happens because the creation of the object files in the ss
      subdir also depends on flask.h.  So simply incorporate them into the
      parent Makefile, as the ss/Makefile really doesn't do anything unique.
      
      With this change, compiling of all selinux files is dependent on
      completion of the header file generation, and this test case with
      the "sleep 30" now confirms it is functioning as expected.
      Signed-off-by: NPaul Gortmaker <paul.gortmaker@windriver.com>
      Signed-off-by: NJames Morris <jmorris@namei.org>
      60272da0
    • P
      selinux: fix parallel compile error · ceba72a6
      Paul Gortmaker 提交于
      Selinux has an autogenerated file, "flask.h" which is included by
      two other selinux files.  The current makefile has a single dependency
      on the first object file in the selinux-y list, assuming that will get
      flask.h generated before anyone looks for it, but that assumption breaks
      down in a "make -jN" situation and you get:
      
         selinux/selinuxfs.c:35: fatal error: flask.h: No such file or directory
         compilation terminated.
         remake[9]: *** [security/selinux/selinuxfs.o] Error 1
      
      Since flask.h is included by security.h which in turn is included
      nearly everywhere, make the dependency apply to all of the selinux-y
      list of objs.
      Signed-off-by: NPaul Gortmaker <paul.gortmaker@windriver.com>
      Signed-off-by: NJames Morris <jmorris@namei.org>
      ceba72a6
    • K
      selinux: fast status update interface (/selinux/status) · 11904167
      KaiGai Kohei 提交于
      This patch provides a new /selinux/status entry which allows applications
      read-only mmap(2).
      This region reflects selinux_kernel_status structure in kernel space.
        struct selinux_kernel_status
        {
                u32     length;         /* length of this structure */
                u32     sequence;       /* sequence number of seqlock logic */
                u32     enforcing;      /* current setting of enforcing mode */
                u32     policyload;     /* times of policy reloaded */
                u32     deny_unknown;   /* current setting of deny_unknown */
        };
      
      When userspace object manager caches access control decisions provided
      by SELinux, it needs to invalidate the cache on policy reload and setenforce
      to keep consistency.
      However, the applications need to check the kernel state for each accesses
      on userspace avc, or launch a background worker process.
      In heuristic, frequency of invalidation is much less than frequency of
      making access control decision, so it is annoying to invoke a system call
      to check we don't need to invalidate the userspace cache.
      If we can use a background worker thread, it allows to receive invalidation
      messages from the kernel. But it requires us an invasive coding toward the
      base application in some cases; E.g, when we provide a feature performing
      with SELinux as a plugin module, it is unwelcome manner to launch its own
      worker thread from the module.
      
      If we could map /selinux/status to process memory space, application can
      know updates of selinux status; policy reload or setenforce.
      
      A typical application checks selinux_kernel_status::sequence when it tries
      to reference userspace avc. If it was changed from the last time when it
      checked userspace avc, it means something was updated in the kernel space.
      Then, the application can reset userspace avc or update current enforcing
      mode, without any system call invocations.
      This sequence number is updated according to the seqlock logic, so we need
      to wait for a while if it is odd number.
      Signed-off-by: NKaiGai Kohei <kaigai@ak.jp.nec.com>
      Acked-by: NEric Paris <eparis@redhat.com>
      --
       security/selinux/include/security.h |   21 ++++++
       security/selinux/selinuxfs.c        |   56 +++++++++++++++
       security/selinux/ss/Makefile        |    2 +-
       security/selinux/ss/services.c      |    3 +
       security/selinux/ss/status.c        |  129 +++++++++++++++++++++++++++++++++++
       5 files changed, 210 insertions(+), 1 deletions(-)
      Signed-off-by: NJames Morris <jmorris@namei.org>
      11904167
    • E
      selinux: type_bounds_sanity_check has a meaningless variable declaration · daa6d83a
      Eric Paris 提交于
      type is not used at all, stop declaring and assigning it.
      Signed-off-by: NEric Paris <eparis@redhat.com>
      Acked-by: NStephen Smalley <sds@tycho.nsa.gov>
      Signed-off-by: NJames Morris <jmorris@namei.org>
      daa6d83a
  2. 18 8月, 2010 2 次提交
    • N
      tty: fix fu_list abuse · d996b62a
      Nick Piggin 提交于
      tty: fix fu_list abuse
      
      tty code abuses fu_list, which causes a bug in remount,ro handling.
      
      If a tty device node is opened on a filesystem, then the last link to the inode
      removed, the filesystem will be allowed to be remounted readonly. This is
      because fs_may_remount_ro does not find the 0 link tty inode on the file sb
      list (because the tty code incorrectly removed it to use for its own purpose).
      This can result in a filesystem with errors after it is marked "clean".
      
      Taking idea from Christoph's initial patch, allocate a tty private struct
      at file->private_data and put our required list fields in there, linking
      file and tty. This makes tty nodes behave the same way as other device nodes
      and avoid meddling with the vfs, and avoids this bug.
      
      The error handling is not trivial in the tty code, so for this bugfix, I take
      the simple approach of using __GFP_NOFAIL and don't worry about memory errors.
      This is not a problem because our allocator doesn't fail small allocs as a rule
      anyway. So proper error handling is left as an exercise for tty hackers.
      
      [ Arguably filesystem's device inode would ideally be divorced from the
      driver's pseudo inode when it is opened, but in practice it's not clear whether
      that will ever be worth implementing. ]
      
      Cc: linux-kernel@vger.kernel.org
      Cc: Christoph Hellwig <hch@infradead.org>
      Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
      Cc: Greg Kroah-Hartman <gregkh@suse.de>
      Signed-off-by: NNick Piggin <npiggin@kernel.dk>
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      d996b62a
    • N
      fs: cleanup files_lock locking · ee2ffa0d
      Nick Piggin 提交于
      fs: cleanup files_lock locking
      
      Lock tty_files with a new spinlock, tty_files_lock; provide helpers to
      manipulate the per-sb files list; unexport the files_lock spinlock.
      
      Cc: linux-kernel@vger.kernel.org
      Cc: Christoph Hellwig <hch@infradead.org>
      Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
      Acked-by: NAndi Kleen <ak@linux.intel.com>
      Acked-by: NGreg Kroah-Hartman <gregkh@suse.de>
      Signed-off-by: NNick Piggin <npiggin@kernel.dk>
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      ee2ffa0d
  3. 07 8月, 2010 1 次提交
  4. 02 8月, 2010 23 次提交
  5. 16 7月, 2010 3 次提交
  6. 22 5月, 2010 1 次提交
  7. 17 5月, 2010 1 次提交
  8. 29 4月, 2010 1 次提交
    • S
      selinux: generalize disabling of execmem for plt-in-heap archs · fcaaade1
      Stephen Smalley 提交于
      On Tue, 2010-04-27 at 11:47 -0700, David Miller wrote:
      > From: "Tom \"spot\" Callaway" <tcallawa@redhat.com>
      > Date: Tue, 27 Apr 2010 14:20:21 -0400
      >
      > > [root@apollo ~]$ cat /proc/2174/maps
      > > 00010000-00014000 r-xp 00000000 fd:00 15466577
      > >  /sbin/mingetty
      > > 00022000-00024000 rwxp 00002000 fd:00 15466577
      > >  /sbin/mingetty
      > > 00024000-00046000 rwxp 00000000 00:00 0
      > >  [heap]
      >
      > SELINUX probably barfs on the executable heap, the PLT is in the HEAP
      > just like powerpc32 and that's why VM_DATA_DEFAULT_FLAGS has to set
      > both executable and writable.
      >
      > You also can't remove the CONFIG_PPC32 ifdefs in selinux, since
      > because of the VM_DATA_DEFAULT_FLAGS setting used still in that arch,
      > the heap will always have executable permission, just like sparc does.
      > You have to support those binaries forever, whether you like it or not.
      >
      > Let's just replace the CONFIG_PPC32 ifdef in SELINUX with CONFIG_PPC32
      > || CONFIG_SPARC as in Tom's original patch and let's be done with
      > this.
      >
      > In fact I would go through all the arch/ header files and check the
      > VM_DATA_DEFAULT_FLAGS settings and add the necessary new ifdefs to the
      > SELINUX code so that other platforms don't have the pain of having to
      > go through this process too.
      
      To avoid maintaining per-arch ifdefs, it seems that we could just
      directly use (VM_DATA_DEFAULT_FLAGS & VM_EXEC) as the basis for deciding
      whether to enable or disable these checks.   VM_DATA_DEFAULT_FLAGS isn't
      constant on some architectures but instead depends on
      current->personality, but we want this applied uniformly.  So we'll just
      use the initial task state to determine whether or not to enable these
      checks.
      Signed-off-by: NStephen Smalley <sds@tycho.nsa.gov>
      Acked-by: NDavid S. Miller <davem@davemloft.net>
      Signed-off-by: NJames Morris <jmorris@namei.org>
      fcaaade1