From nobody Sun May 10 10:33:24 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D6C16C433F5 for ; Thu, 5 May 2022 13:25:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379300AbiEEN2m (ORCPT ); Thu, 5 May 2022 09:28:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39198 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232859AbiEEN2h (ORCPT ); Thu, 5 May 2022 09:28:37 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8BF4244A0A; Thu, 5 May 2022 06:24:56 -0700 (PDT) Received: from dggpemm500020.china.huawei.com (unknown [172.30.72.53]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4KvDtw2tg9zhYty; Thu, 5 May 2022 21:24:24 +0800 (CST) Received: from dggpemm500001.china.huawei.com (7.185.36.107) by dggpemm500020.china.huawei.com (7.185.36.49) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Thu, 5 May 2022 21:24:54 +0800 Received: from ubuntu1804.huawei.com (10.67.174.152) by dggpemm500001.china.huawei.com (7.185.36.107) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Thu, 5 May 2022 21:24:54 +0800 From: Wang Weiyang To: , , , CC: , , , Subject: [PATCH 1/3] securityfs: Append line feed to /sys/kernel/security/lsm Date: Thu, 5 May 2022 21:22:59 +0800 Message-ID: <20220505132301.124832-2-wangweiyang2@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220505132301.124832-1-wangweiyang2@huawei.com> References: <20220505132301.124832-1-wangweiyang2@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.174.152] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To dggpemm500001.china.huawei.com (7.185.36.107) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" There is no LF in /sys/kerne/security/lsm output. It is a little weird, so append LF to it. Example: / # cat /sys/kernel/security/lsm capability,selinux/ # Signed-off-by: Wang Weiyang --- security/inode.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/security/inode.c b/security/inode.c index 6c326939750d..bfd5550fa129 100644 --- a/security/inode.c +++ b/security/inode.c @@ -318,8 +318,20 @@ static struct dentry *lsm_dentry; static ssize_t lsm_read(struct file *filp, char __user *buf, size_t count, loff_t *ppos) { - return simple_read_from_buffer(buf, count, ppos, lsm_names, - strlen(lsm_names)); + char *tmp; + ssize_t len =3D strlen(lsm_names); + ssize_t rc; + + tmp =3D kmalloc(len + 2, GFP_KERNEL); + if (!tmp) + return -ENOMEM; + + scnprintf(tmp, len + 2, "%s\n", lsm_names); + rc =3D simple_read_from_buffer(buf, count, ppos, tmp, strlen(tmp)); + + kfree(tmp); + + return rc; } =20 static const struct file_operations lsm_ops =3D { --=20 2.17.1 From nobody Sun May 10 10:33:24 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A86C9C433EF for ; Thu, 5 May 2022 13:25:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379389AbiEEN2t (ORCPT ); Thu, 5 May 2022 09:28:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39202 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356785AbiEEN2i (ORCPT ); Thu, 5 May 2022 09:28:38 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AA0635677B; Thu, 5 May 2022 06:24:56 -0700 (PDT) Received: from dggpemm500022.china.huawei.com (unknown [172.30.72.57]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4KvDtw45L9zhYv3; Thu, 5 May 2022 21:24:24 +0800 (CST) Received: from dggpemm500001.china.huawei.com (7.185.36.107) by dggpemm500022.china.huawei.com (7.185.36.162) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Thu, 5 May 2022 21:24:54 +0800 Received: from ubuntu1804.huawei.com (10.67.174.152) by dggpemm500001.china.huawei.com (7.185.36.107) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Thu, 5 May 2022 21:24:54 +0800 From: Wang Weiyang To: , , , CC: , , , Subject: [PATCH 2/3] evm: Append line feed to /sys/kernel/security/evm Date: Thu, 5 May 2022 21:23:00 +0800 Message-ID: <20220505132301.124832-3-wangweiyang2@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220505132301.124832-1-wangweiyang2@huawei.com> References: <20220505132301.124832-1-wangweiyang2@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.174.152] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To dggpemm500001.china.huawei.com (7.185.36.107) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" There is no LF in /sys/kerne/security/evm output. It is little weird, so append LF to it. Example: / # cat /sys/kernel/security/evm 0/ # Signed-off-by: Wang Weiyang --- security/integrity/evm/evm_secfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/security/integrity/evm/evm_secfs.c b/security/integrity/evm/ev= m_secfs.c index 8a9db7dfca7e..6a46b62aabd4 100644 --- a/security/integrity/evm/evm_secfs.c +++ b/security/integrity/evm/evm_secfs.c @@ -45,7 +45,7 @@ static ssize_t evm_read_key(struct file *filp, char __use= r *buf, if (*ppos !=3D 0) return 0; =20 - sprintf(temp, "%d", (evm_initialized & ~EVM_SETUP_COMPLETE)); + sprintf(temp, "%d\n", (evm_initialized & ~EVM_SETUP_COMPLETE)); rc =3D simple_read_from_buffer(buf, count, ppos, temp, strlen(temp)); =20 return rc; --=20 2.17.1 From nobody Sun May 10 10:33:24 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C076EC433EF for ; Thu, 5 May 2022 13:25:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351774AbiEEN2w (ORCPT ); Thu, 5 May 2022 09:28:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39204 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377265AbiEEN2i (ORCPT ); Thu, 5 May 2022 09:28:38 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CDCE95677D; Thu, 5 May 2022 06:24:56 -0700 (PDT) Received: from dggpemm500023.china.huawei.com (unknown [172.30.72.54]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4KvDtw5FdMzhYv6; Thu, 5 May 2022 21:24:24 +0800 (CST) Received: from dggpemm500001.china.huawei.com (7.185.36.107) by dggpemm500023.china.huawei.com (7.185.36.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Thu, 5 May 2022 21:24:55 +0800 Received: from ubuntu1804.huawei.com (10.67.174.152) by dggpemm500001.china.huawei.com (7.185.36.107) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Thu, 5 May 2022 21:24:54 +0800 From: Wang Weiyang To: , , , CC: , , , Subject: [PATCH 3/3] ima: Append line feed to ima/binary_runtime_measurements Date: Thu, 5 May 2022 21:23:01 +0800 Message-ID: <20220505132301.124832-4-wangweiyang2@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220505132301.124832-1-wangweiyang2@huawei.com> References: <20220505132301.124832-1-wangweiyang2@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.174.152] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To dggpemm500001.china.huawei.com (7.185.36.107) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" There is no LF in binary_runtime_measurements output. It is little weird, so append LF to it. Example: / # cat /sys/kernel/security/ima/binary_runtime_measurements ...imaboot_aggregate/ # Signed-off-by: Wang Weiyang --- security/integrity/ima/ima_fs.c | 1 + 1 file changed, 1 insertion(+) diff --git a/security/integrity/ima/ima_fs.c b/security/integrity/ima/ima_f= s.c index cd1683dad3bf..0a2f9cb25b20 100644 --- a/security/integrity/ima/ima_fs.c +++ b/security/integrity/ima/ima_fs.c @@ -183,6 +183,7 @@ int ima_measurements_show(struct seq_file *m, void *v) show =3D IMA_SHOW_BINARY_OLD_STRING_FMT; field->field_show(m, show, &e->template_data[i]); } + seq_puts(m, "\n"); return 0; } =20 --=20 2.17.1