[RFC 04/31] kernel/sys: Don't reference UTS_RELEASE directly

From: Josh Poimboeuf
Date: Tue Sep 03 2024 - 00:01:03 EST


Objtool will be getting a new feature to calculate build-time function
checksums, so each function can be uniquely identified. A function's
checksum is calculated based on its instructions, jump/call targets,
alternatives, string literals, and more.

When there are any changes to the git working tree, UTS_RELEASE is
suffixed with "+". That can result in an undesired changed checksum for
the functions which inline override_release() due to its direct
reference of the UTS_RELEASE string literal.

Convert the override_release() 'rest' variable to a static local so it
won't affect function checksums.

Signed-off-by: Josh Poimboeuf <jpoimboe@xxxxxxxxxx>
---
kernel/sys.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/sys.c b/kernel/sys.c
index 3a2df1bd9f64..526464ea194b 100644
--- a/kernel/sys.c
+++ b/kernel/sys.c
@@ -1291,7 +1291,7 @@ static int override_release(char __user *release, size_t len)
int ret = 0;

if (current->personality & UNAME26) {
- const char *rest = UTS_RELEASE;
+ static const char *rest = UTS_RELEASE;
char buf[65] = { 0 };
int ndots = 0;
unsigned v;
--
2.45.2