From: Shuah Khan <skhan@linuxfoundation.org>
To: jmorris@namei.org, serge@hallyn.com, mpe@ellerman.id.au,
zohar@linux.ibm.com, erichte@linux.ibm.com, nayna@linux.ibm.com,
yuehaibing@huawei.com
Cc: Shuah Khan <skhan@linuxfoundation.org>,
linux-security-module@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [PATCH] security/integrity: Include __func__ in messages for easier debug
Date: Wed, 29 Jan 2020 19:01:29 -0700 [thread overview]
Message-ID: <20200130020129.15328-1-skhan@linuxfoundation.org> (raw)
Change messages to messages to make it easier to debug. The following
error message isn't informative enough to figure out what failed.
Couldn't get size: 0x800000000000000e
Change messages to include function information.
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
---
.../integrity/platform_certs/load_powerpc.c | 14 ++++++++------
security/integrity/platform_certs/load_uefi.c | 17 ++++++++++-------
2 files changed, 18 insertions(+), 13 deletions(-)
diff --git a/security/integrity/platform_certs/load_powerpc.c b/security/integrity/platform_certs/load_powerpc.c
index a2900cb85357..621454148fbc 100644
--- a/security/integrity/platform_certs/load_powerpc.c
+++ b/security/integrity/platform_certs/load_powerpc.c
@@ -25,7 +25,7 @@ static __init void *get_cert_list(u8 *key, unsigned long keylen, uint64_t *size)
rc = secvar_ops->get(key, keylen, NULL, size);
if (rc) {
- pr_err("Couldn't get size: %d\n", rc);
+ pr_err("%s: Couldn't get size: %d\n", __func__, rc);
return NULL;
}
@@ -36,7 +36,7 @@ static __init void *get_cert_list(u8 *key, unsigned long keylen, uint64_t *size)
rc = secvar_ops->get(key, keylen, db, size);
if (rc) {
kfree(db);
- pr_err("Error reading %s var: %d\n", key, rc);
+ pr_err("%s: Error reading %s var: %d\n", __func__, key, rc);
return NULL;
}
@@ -69,23 +69,25 @@ static int __init load_powerpc_certs(void)
*/
db = get_cert_list("db", 3, &dbsize);
if (!db) {
- pr_err("Couldn't get db list from firmware\n");
+ pr_err("%s: Couldn't get db list from firmware\n", __func__);
} else {
rc = parse_efi_signature_list("powerpc:db", db, dbsize,
get_handler_for_db);
if (rc)
- pr_err("Couldn't parse db signatures: %d\n", rc);
+ pr_err("%s: Couldn't parse db signatures: %d\n",
+ __func__, rc);
kfree(db);
}
dbx = get_cert_list("dbx", 4, &dbxsize);
if (!dbx) {
- pr_info("Couldn't get dbx list from firmware\n");
+ pr_info("%s: Couldn't get dbx list from firmware\n", __func__);
} else {
rc = parse_efi_signature_list("powerpc:dbx", dbx, dbxsize,
get_handler_for_dbx);
if (rc)
- pr_err("Couldn't parse dbx signatures: %d\n", rc);
+ pr_err("%s: Couldn't parse dbx signatures: %d\n",
+ __func__, rc);
kfree(dbx);
}
diff --git a/security/integrity/platform_certs/load_uefi.c b/security/integrity/platform_certs/load_uefi.c
index 111898aad56e..c3cf6575abc1 100644
--- a/security/integrity/platform_certs/load_uefi.c
+++ b/security/integrity/platform_certs/load_uefi.c
@@ -44,7 +44,7 @@ static __init void *get_cert_list(efi_char16_t *name, efi_guid_t *guid,
status = efi.get_variable(name, guid, NULL, &lsize, &tmpdb);
if (status != EFI_BUFFER_TOO_SMALL) {
- pr_err("Couldn't get size: 0x%lx\n", status);
+ pr_err("%s: Couldn't get size: 0x%lx\n", __func__, status);
return NULL;
}
@@ -55,7 +55,7 @@ static __init void *get_cert_list(efi_char16_t *name, efi_guid_t *guid,
status = efi.get_variable(name, guid, NULL, &lsize, db);
if (status != EFI_SUCCESS) {
kfree(db);
- pr_err("Error reading db var: 0x%lx\n", status);
+ pr_err("%s: Error reading db var: 0x%lx\n", __func__, status);
return NULL;
}
@@ -85,13 +85,14 @@ static int __init load_uefi_certs(void)
if (!uefi_check_ignore_db()) {
db = get_cert_list(L"db", &secure_var, &dbsize);
if (!db) {
- pr_err("MODSIGN: Couldn't get UEFI db list\n");
+ pr_err("%s: MODSIGN: Couldn't get UEFI db list\n",
+ __func__);
} else {
rc = parse_efi_signature_list("UEFI:db",
db, dbsize, get_handler_for_db);
if (rc)
- pr_err("Couldn't parse db signatures: %d\n",
- rc);
+ pr_err("%s: Couldn't parse db signatures: %d\n",
+ __func__, rc);
kfree(db);
}
}
@@ -103,7 +104,8 @@ static int __init load_uefi_certs(void)
rc = parse_efi_signature_list("UEFI:MokListRT",
mok, moksize, get_handler_for_db);
if (rc)
- pr_err("Couldn't parse MokListRT signatures: %d\n", rc);
+ pr_err("%s: Couldn't parse MokListRT signatures: %d\n",
+ __func__, rc);
kfree(mok);
}
@@ -115,7 +117,8 @@ static int __init load_uefi_certs(void)
dbx, dbxsize,
get_handler_for_dbx);
if (rc)
- pr_err("Couldn't parse dbx signatures: %d\n", rc);
+ pr_err("%s: Couldn't parse dbx signatures: %d\n",
+ __func__, rc);
kfree(dbx);
}
--
2.20.1
next reply other threads:[~2020-01-30 2:01 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-30 2:01 Shuah Khan [this message]
2020-01-30 3:08 ` [PATCH] security/integrity: Include __func__ in messages for easier debug Joe Perches
2020-02-03 13:21 ` Mimi Zohar
2020-02-03 18:55 ` Shuah Khan
2020-02-03 19:02 ` Joe Perches
2020-02-03 19:20 ` Shuah Khan
2020-02-03 19:23 ` Casey Schaufler
2020-02-03 19:29 ` Joe Perches
2020-02-03 15:15 ` Nayna
2020-02-03 19:18 ` Joe Perches
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200130020129.15328-1-skhan@linuxfoundation.org \
--to=skhan@linuxfoundation.org \
--cc=erichte@linux.ibm.com \
--cc=jmorris@namei.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=mpe@ellerman.id.au \
--cc=nayna@linux.ibm.com \
--cc=serge@hallyn.com \
--cc=yuehaibing@huawei.com \
--cc=zohar@linux.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).