Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp8898253rwi; Tue, 25 Oct 2022 12:16:10 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7XnfGCaFzKABa/6MowwsOhumSGzxarQ9JDOLaqrj4HPPO17YztEi6KHh1S4/TUSTLJTQTD X-Received: by 2002:a17:90a:cc0b:b0:213:cef:1ffc with SMTP id b11-20020a17090acc0b00b002130cef1ffcmr14179776pju.36.1666725359988; Tue, 25 Oct 2022 12:15:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666725359; cv=none; d=google.com; s=arc-20160816; b=hCh6oD0MSwcLf4aqzmgeZNiw5qOJqD4ezM9uioDif4A7NW80YIWd0BE/iltxEGaRlM d6yujWQjDJto82EC2f5VUEw6Cbm2rUns1Pq3Z1LQtS0Mm0iPLSwCpMoPJRHW+WqAq1j4 iM+fr9eMHasLII7s/kBDRtkL72xsaRmDw8xhaBnHB+fMXgb8mR9zFWN3PCzzb2yk6Vtb ysmCA8TTbC9DEHpzNKnQdlVDwvf+Vb/JCvUXHjOyQomou2KKOoPHMQVFrdQcaOm/GZMr 1tSoZYBWOfl9LWQrEFiio237aZK49dO0TzWYMpyZKNBwgyDhhcUpoj6SPUo8rlqIE+2u eTpg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature; bh=KGezVsV0Po7wkqsLTMkHH3Oi+nbFxChfwJVSfxR3dMA=; b=DPtXFmq8DPuDcCanlkoF0F1pIJxuOR7JNZ8ki4eMfdSeftdA05eTzd09XeOTAye4uG EXRlNb//tyslhh+3dEXs8vKy4dzwAwkEKowpQi7bIUuDB2dCNKsd+UzlIk/ein1GzAu8 PLWd+9JLDnhBbYiXxaIYuCUgto9aCz+6ocDMMeGhywf/BflFr7bdJ7CzmV/DxGFU2OOc i6N2ILWGCMjIMhVCnktc/zmJMot6a6QLDeEr6QHrXhgA1WNvxrxBXu1Em57Gt6BOwI+V RJHQrSLWwSw7dJL9Wp46w8Ayouq/lGYmDBa9b+nz9rpQztr1SOi/B6xylDbIEH+u1gzS asoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@yahoo.com header.s=s2048 header.b=RtHzdyOb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g20-20020a170902d1d400b0017ae43612d9si3197995plb.324.2022.10.25.12.15.48; Tue, 25 Oct 2022 12:15:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@yahoo.com header.s=s2048 header.b=RtHzdyOb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232839AbiJYSpl (ORCPT + 99 others); Tue, 25 Oct 2022 14:45:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45966 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232773AbiJYSpd (ORCPT ); Tue, 25 Oct 2022 14:45:33 -0400 Received: from sonic316-26.consmr.mail.ne1.yahoo.com (sonic316-26.consmr.mail.ne1.yahoo.com [66.163.187.152]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 86F604C023 for ; Tue, 25 Oct 2022 11:45:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1666723527; bh=KGezVsV0Po7wkqsLTMkHH3Oi+nbFxChfwJVSfxR3dMA=; h=From:To:Cc:Subject:Date:References:From:Subject:Reply-To; b=RtHzdyObclKhnjsaIJ3WAnb0UjvxSjbHlzVkiGZntj54rFgNGIF4CXaomux15f3JW87ijJw3jQreoPbke1kMMqgbXV/7Ol0SmvXZWmbAlULGLpnwMAoRJ7Bb4sbpNQz62mgxkC/M/Rbn/Oy+YlP4DhjPAcGasLfGRm3CNKvDkpQqRW12F+H/aBYHo+fR4dXJOoX8+fiTUKDaXTbY6tx9i7cwX3VZ/yFzi/OfqUL0+21ZKTtCrzmTXGPrnA/lezTaIqhyj659HbQn7rHsFv2D+fUuB25jAvFQFUMLi75LV231WLwPke6yefphnKQHMoHFUfoZ0D85kv/tPINpvjOAjA== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1666723527; bh=26r7vNZRlFAy0Nfuom5q612171Iyc4BcfBGeJQK5EpL=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=K+RTrKborR8VYFMAOqndcIhkgTMM58sS4OmRZrnu+fl+l6XUSmkQ1yUR0w+zy2uqYsFk0qMSRG8iLpEAJTE8opyTgaE0kODTNBu79CbtGYznBQqk72qnnYs4IgYaLC3mBINEvH0LnL5mrfadhbwkDpL9Bbvx/1+Mz9w4r2EosoaVYZ7Cj2m2zycDsZXbi+ER4mPLev0kfDO7UqYL/Ocyw6h3Tl4436EmQT61ouQUL3ERqrVqLPWHGcPYH8A9IvnYScMaZFTVPjSRQyXZC/vM+upOUSo23HyC1d2gjmyZqbErJkmD9axx+VIoLgsaromAeviOmmBlLRWNDJOPQL7f4w== X-YMail-OSG: JZ_ZOsMVM1mICj.po.vXEvgKtW5akTQdEDwKXTT5rzW17TRFdh7Xx15UzzwcFY5 p0PmDRHeXE7cROtRr3p2ZHtop03WwcjD1NXi0ge1ca1RZclINMeRwGMtX_0rLrOS2E65aQPxLYNU O9vjjtnzGDMXTjJGMhbHfv3N3z3N1UkPUUKTrQwXxjq0n3qBkn8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by sonic316.consmr.mail.ne1.yahoo.com with HTTP; Tue, 25 Oct 2022 18:45:27 +0000 Received: by hermes--production-ne1-c47ffd5f5-h6ptj (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID cee108ccde84a9105dc7ebe9516c7326; Tue, 25 Oct 2022 18:45:23 +0000 (UTC) From: Casey Schaufler To: casey.schaufler@intel.com, paul@paul-moore.com, linux-security-module@vger.kernel.org Cc: casey@schaufler-ca.com, jmorris@namei.org, keescook@chromium.org, john.johansen@canonical.com, penguin-kernel@i-love.sakura.ne.jp, stephen.smalley.work@gmail.com, linux-kernel@vger.kernel.org, linux-api@vger.kernel.org, mic@digikod.net Subject: [PATCH v1 0/8] LSM: Two basic syscalls Date: Tue, 25 Oct 2022 11:45:11 -0700 Message-Id: <20221025184519.13231-1-casey@schaufler-ca.com> X-Mailer: git-send-email 2.37.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit References: <20221025184519.13231-1-casey.ref@schaufler-ca.com> X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add two system calls for the Linux Security Module ABI. lsm_self_attr() provides the security module specific attributes that have previously been visible in the /proc/self/attr directory. For each attribute that is set on the current process the system call will return an LSM identifier, an attribute identifier and the value of the attribute. The LSM and attribute identifier values are defined in include/uapi/linux/lsm.h lsm_module_list() provides the LSM identifiers, in order, of the security modules that are active on the system. This has been available in the securityfs file /sys/kernel/security/lsm. Patch 0001 changes the LSM registration from passing the name of the module to passing a lsm_id structure that contains the name of the module. Patch 0002 adds an LSM identifier number to the lsm_id structure. Patch 0003 adds an attribute identifier to the lsm_id. Patch 0004 adds the registered lsm_ids to a table. Patch 0005 changes security_[gs]etprocattr() to use LSM IDs instead of LSM names. Patch 0006 implements lsm_self_attr(). Patch 0007 implements lsm_module_list(). Patch 0008 wires up the two syscalls. Casey Schaufler (8): LSM: Identify modules by more than name LSM: Add an LSM identifier for external use LSM: Identify the process attributes for each module LSM: Maintain a table of LSM attribute data proc: Use lsmids instead of lsm names for attrs LSM: lsm_self_attr syscall for LSM self attributes LSM: Create lsm_module_list system call lsm: wireup syscalls lsm_self_attr and lsm_module_list arch/alpha/kernel/syscalls/syscall.tbl | 2 + arch/arm/tools/syscall.tbl | 2 + arch/arm64/include/asm/unistd32.h | 2 + arch/ia64/kernel/syscalls/syscall.tbl | 2 + arch/m68k/kernel/syscalls/syscall.tbl | 2 + arch/microblaze/kernel/syscalls/syscall.tbl | 2 + arch/mips/kernel/syscalls/syscall_n32.tbl | 2 + arch/mips/kernel/syscalls/syscall_n64.tbl | 2 + arch/mips/kernel/syscalls/syscall_o32.tbl | 2 + arch/parisc/kernel/syscalls/syscall.tbl | 2 + arch/powerpc/kernel/syscalls/syscall.tbl | 2 + arch/s390/kernel/syscalls/syscall.tbl | 2 + arch/sh/kernel/syscalls/syscall.tbl | 2 + arch/sparc/kernel/syscalls/syscall.tbl | 2 + arch/x86/entry/syscalls/syscall_32.tbl | 2 + arch/x86/entry/syscalls/syscall_64.tbl | 2 + arch/xtensa/kernel/syscalls/syscall.tbl | 2 + fs/proc/base.c | 29 +-- fs/proc/internal.h | 2 +- include/linux/lsm_hooks.h | 13 +- include/linux/security.h | 28 ++- include/linux/syscalls.h | 3 + include/uapi/asm-generic/unistd.h | 5 +- include/uapi/linux/lsm.h | 67 ++++++ kernel/sys_ni.c | 4 + security/Makefile | 1 + security/apparmor/lsm.c | 9 +- security/bpf/hooks.c | 13 +- security/commoncap.c | 8 +- security/landlock/cred.c | 2 +- security/landlock/fs.c | 2 +- security/landlock/ptrace.c | 2 +- security/landlock/setup.c | 6 + security/landlock/setup.h | 1 + security/loadpin/loadpin.c | 9 +- security/lockdown/lockdown.c | 8 +- security/lsm_syscalls.c | 194 ++++++++++++++++++ security/safesetid/lsm.c | 9 +- security/security.c | 37 +++- security/selinux/hooks.c | 11 +- security/smack/smack_lsm.c | 9 +- security/tomoyo/tomoyo.c | 9 +- security/yama/yama_lsm.c | 8 +- .../arch/mips/entry/syscalls/syscall_n64.tbl | 2 + .../arch/powerpc/entry/syscalls/syscall.tbl | 2 + .../perf/arch/s390/entry/syscalls/syscall.tbl | 2 + .../arch/x86/entry/syscalls/syscall_64.tbl | 2 + 47 files changed, 484 insertions(+), 47 deletions(-) create mode 100644 include/uapi/linux/lsm.h create mode 100644 security/lsm_syscalls.c base-commit: 247f34f7b80357943234f93f247a1ae6b6c3a740 -- 2.37.3