Git Product home page Git Product logo

smeso / sara Goto Github PK

View Code? Open in Web Editor NEW
9.0 9.0 1.0 2.39 GB

S.A.R.A. development branch. Rebased often. Use at your own risk.

License: Other

Makefile 0.23% C 97.40% Assembly 1.00% C++ 0.69% Objective-C 0.07% Shell 0.30% Perl 0.13% Awk 0.01% Python 0.12% Yacc 0.01% Lex 0.01% UnrealScript 0.01% Roff 0.02% Gherkin 0.01% XS 0.01% Clojure 0.01% M4 0.01% sed 0.01% SmPL 0.02% Raku 0.01%
hardening kernel linux lsm sara security

sara's Introduction

sara's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

sara's Issues

Small merge conflict since linux 4.18-rc6

One of the commits for linux 4.18-rc6 introduced small merge conflict with SARA. Below is a fix:

@@ -947,7 +947,7 @@
 +	if (ret)
 +		return ERR_PTR(ret);
 +
- 	vma = kmem_cache_zalloc(vm_area_cachep, GFP_KERNEL);
+ 	vma = vm_area_alloc(mm);
  	if (unlikely(vma == NULL))
  		return ERR_PTR(-ENOMEM);
 diff -uprN --ignore-space-change linux-4.17.1/security/Kconfig linux-4.17.1b/security/Kconfig

SARA fails to build with linux 4.19-rc1

  CC      security/sara/wxprot.o
In file included from security/sara/wxprot.c:21:
security/sara/wxprot.c:837:27: error: initialization of ‘int (*)(struct file *)’ from incompatible pointer type ‘int (*)(struct file *, const struct cred *)’ [-Werror=incompatible-pointer-types]
  LSM_HOOK_INIT(file_open, sara_file_open),
                           ^~~~~~~~~~~~~~
./include/linux/lsm_hooks.h:2053:57: note: in definition of macro ‘LSM_HOOK_INIT’
  { .head = &security_hook_heads.HEAD, .hook = { .HEAD = HOOK } }
                                                         ^~~~
security/sara/wxprot.c:837:27: note: (near initialization for ‘wxprot_hooks[4].hook.file_open’)
  LSM_HOOK_INIT(file_open, sara_file_open),
                           ^~~~~~~~~~~~~~
./include/linux/lsm_hooks.h:2053:57: note: in definition of macro ‘LSM_HOOK_INIT’
  { .head = &security_hook_heads.HEAD, .hook = { .HEAD = HOOK } }
                                                         ^~~~
  CC [M]  arch/x86/kvm/../../../virt/kvm/async_pf.o
cc1: some warnings being treated as errors
make[2]: *** [scripts/Makefile.build:308: security/sara/wxprot.o] Error 1
make[1]: *** [scripts/Makefile.build:548: security/sara] Error 2
make: *** [Makefile:1060: security] Error 2
make: *** Waiting for unfinished jobs....

[Linux 4.18] SARA: WXP warning while loading 'bpfilter' module

SARA: WXP: can't find path for 'none'. Default flags will be used.
bpfilter: Loaded bpfilter_umh pid 677
# Linux/x86 4.18.2 Kernel Configuration

# Compiler: gcc (GCC) 8.2.0
...
CONFIG_BPFILTER=y
CONFIG_BPFILTER_UMH=m
...
CONFIG_SECURITY_SARA=y
# CONFIG_SECURITY_SARA_DEFAULT_DISABLED is not set
CONFIG_SECURITY_SARA_WXPROT=y
# CONFIG_SECURITY_SARA_WXPROT_DEFAULT_FLAGS_ALL_COMPLAIN_VERBOSE is not set
# CONFIG_SECURITY_SARA_WXPROT_DEFAULT_FLAGS_ALL_ENFORCE_VERBOSE is not set
# CONFIG_SECURITY_SARA_WXPROT_DEFAULT_FLAGS_ALL_ENFORCE is not set
CONFIG_SECURITY_SARA_WXPROT_DEFAULT_FLAGS_NONE=y
CONFIG_SECURITY_SARA_WXPROT_EMUTRAMP=y
# CONFIG_SECURITY_SARA_WXPROT_XATTRS_ENABLED is not set
# CONFIG_SECURITY_SARA_WXPROT_DISABLED is not set
CONFIG_SECURITY_SARA_WXPROT_DEFAULT_FLAGS=0

sara failed to build with 4.15-rc8

I used https://github.com/smeso/sara/tree/sarav4
Kernel 4.15-rc8 + linux-hardened patches + some extras
gcc version 7.2.1 20171224
Archlinux

In file included from ./arch/x86/include/asm/atomic.h:5:0,
                 from ./include/linux/atomic.h:5,
                 from ./include/linux/dcache.h:5,
                 from security/sara/utils.c:12:
security/sara/utils.c: In function ‘get_current_path’:
./include/linux/compiler.h:324:38: error: call to ‘__compiletime_assert_86’ declared with attribute error: BUILD_BUG_ON failed: sizeof(*buf) != TASK_COMM_LEN
  _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
                                      ^
./include/linux/compiler.h:304:4: note: in definition of macro ‘__compiletime_assert’
    prefix ## suffix();    \
    ^~~~~~
./include/linux/compiler.h:324:2: note: in expansion of macro ‘_compiletime_assert’
  _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
  ^~~~~~~~~~~~~~~~~~~
./include/linux/build_bug.h:47:37: note: in expansion of macro ‘compiletime_assert’
 #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
                                     ^~~~~~~~~~~~~~~~~~
./include/linux/build_bug.h:71:2: note: in expansion of macro ‘BUILD_BUG_ON_MSG’
  BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
  ^~~~~~~~~~~~~~~~
./include/linux/sched.h:1502:2: note: in expansion of macro ‘BUILD_BUG_ON’
  BUILD_BUG_ON(sizeof(buf) != TASK_COMM_LEN); \
  ^~~~~~~~~~~~
security/sara/utils.c:86:3: note: in expansion of macro ‘get_task_comm’
   get_task_comm(*buf, current);
   ^~~~~~~~~~~~~
make[2]: *** [scripts/Makefile.build:310: security/sara/utils.o] Error 1
make[1]: *** [scripts/Makefile.build:569: security/sara] Error 2
make: *** [Makefile:1018: security] Error 2
make: *** Waiting for unfinished jobs....

Merge conflicts in linux 4.17rc1

S.A.R.A doesn't apply to linux 4.17-rc1:

patching file Documentation/admin-guide/LSM/SARA.rst
patching file Documentation/admin-guide/LSM/index.rst
patching file Documentation/admin-guide/kernel-parameters.txt
Hunk #1 succeeded at 3899 (offset 49 lines).
patching file arch/Kconfig
Hunk #1 succeeded at 233 (offset 3 lines).
patching file arch/x86/Kbuild
patching file arch/x86/Kconfig
Hunk #1 FAILED at 54.
1 out of 1 hunk FAILED -- saving rejects to file arch/x86/Kconfig.rej
patching file arch/x86/mm/fault.c
Hunk #2 succeeded at 1303 (offset -31 lines).
patching file arch/x86/security/Makefile
patching file arch/x86/security/sara/Makefile
patching file arch/x86/security/sara/emutramp.c
patching file arch/x86/security/sara/trampolines32.h
patching file arch/x86/security/sara/trampolines64.h
patching file fs/binfmt_elf.c
Hunk #1 succeeded at 808 (offset 5 lines).
patching file fs/binfmt_elf_fdpic.c
patching file fs/exec.c
Hunk #1 succeeded at 756 (offset 8 lines).
patching file fs/proc/base.c
Hunk #1 succeeded at 2593 (offset 34 lines).
Hunk #2 succeeded at 2634 (offset 34 lines).
patching file include/linux/cred.h
patching file include/linux/lsm_hooks.h
Hunk #2 succeeded at 1570 (offset 32 lines).
Hunk #3 FAILED at 1829.
Hunk #4 succeeded at 2085 (offset 43 lines).
1 out of 4 hunks FAILED -- saving rejects to file include/linux/lsm_hooks.h.rej
patching file include/linux/security.h
Hunk #1 succeeded at 309 (offset -2 lines).
Hunk #2 succeeded at 848 (offset -1 lines).
patching file include/uapi/linux/xattr.h
patching file mm/mmap.c
Hunk #1 succeeded at 1333 (offset 7 lines).
Hunk #2 succeeded at 1397 (offset 18 lines).
Hunk #3 succeeded at 2920 (offset 25 lines).
Hunk #4 succeeded at 3322 (offset 27 lines).
patching file security/Kconfig
Hunk #1 succeeded at 289 (offset 67 lines).
patching file security/Makefile
patching file security/sara/Kconfig
patching file security/sara/Makefile
patching file security/sara/include/emutramp.h
patching file security/sara/include/sara.h
patching file security/sara/include/sara_data.h
patching file security/sara/include/securityfs.h
patching file security/sara/include/utils.h
patching file security/sara/include/wxprot.h
patching file security/sara/main.c
patching file security/sara/sara_data.c
patching file security/sara/securityfs.c
patching file security/sara/utils.c
patching file security/sara/wxprot.c
patching file security/security.c
Hunk #1 succeeded at 80 (offset 6 lines).
Hunk #2 succeeded at 945 (offset 6 lines).
Hunk #3 succeeded at 1286 (offset 13 lines).

It's due to security: convert security hooks to use hlist

Before this, applying to linux 4.16 needed only following change:

--- sarav4.15.patch
+++ sarav4.16.patch
@@ -293,9 +293,9 @@
  	select ARCH_HAS_GCOV_PROFILE_ALL
  	select ARCH_HAS_KCOV			if X86_64
 +	select ARCH_HAS_LSM_PAGEFAULT
-	select ARCH_HAS_PHYS_TO_DMA
-	select ARCH_HAS_MEMBARRIER_SYNC_CORE
-	select ARCH_HAS_PMEM_API		if X86
+ 	select ARCH_HAS_PMEM_API		if X86_64
+ 	select ARCH_HAS_REFCOUNT
+ 	select ARCH_HAS_UACCESS_FLUSHCACHE	if X86_64
 diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c
 index b3e40773dce09..fa749582c11c2 100644
 --- a/arch/x86/mm/fault.c

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.