From nobody Sun Jun 14 14:34:07 2026 Received: from smtpbg151.qq.com (smtpbg151.qq.com [18.169.211.239]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6D93D2D592F for ; Fri, 3 Apr 2026 06:31:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=18.169.211.239 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775197892; cv=none; b=kQCp/UaOq0yREdMJOlQ/cqlUCPoqTZo5pAKaOltf+37liwuHZVbf9ZmWtMMWfyVUxyIxBzhXoIDQnYjo4MtiFzC+41I/YIan+8YNow0gQTvtwjELOTveS4Q5hv+SCwnwLfPcd6eWfAnsr2JCLJQkeSLCO97hQTs7dN6BWeyXyns= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775197892; c=relaxed/simple; bh=u6vJhMRukMYQuAFdtZphiPWA2L7LV4Z0duj1VTqx6uc=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=XEpBjFIAIm6bCTDNES3xxpGRSX0sAeEM4LQcndXnvK1tFq2C+DDkvSTNYawsnJ5DQChu+LsZmcuGlKbo6Z2Cve8QirDyssUVeZdjuxY7NCMAlkBQC5wagO1WK3tWG+OxJ/ct2ul9F/O822tRkzuyst5LBov2S5KMF3yXMN58TTg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=uniontech.com; spf=pass smtp.mailfrom=uniontech.com; dkim=pass (1024-bit key) header.d=uniontech.com header.i=@uniontech.com header.b=cKFZjGWT; arc=none smtp.client-ip=18.169.211.239 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=uniontech.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=uniontech.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=uniontech.com header.i=@uniontech.com header.b="cKFZjGWT" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=uniontech.com; s=onoh2408; t=1775197861; bh=7cYDA48xJh8paeNIt+lHccZEVM1lwmj1+slaoNvtG3I=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=cKFZjGWTRM8l5AIOQxbJ+KHi1jIyj4YY5fjDo9s7G4jwY3nfqfH+RFCl1dT5rZhOd o3TJB9U872a1VKedV/N5Zb8KOpn4hTaDpBZMzZgmX1gzgyrzNeEqCGKsLue3W+MnFs CmfrmG5eBanmJ7k5yLwp1dFgk3W4BPlNP+4fj7Cg= X-QQ-mid: zesmtpip2t1775197817t1eb7c37b X-QQ-Originating-IP: XTgIyY/p7Zhx9sdgwi9YS0h7XLBELD4A3z5BLYHffGk= Received: from yangyuqian ( [localhost]) by bizesmtp.qq.com (ESMTP) with id ; Fri, 03 Apr 2026 14:30:10 +0800 (CST) X-QQ-SSF: 0000000000000000000000000000000 X-QQ-GoodBg: 1 X-BIZMAIL-ID: 4404439308809355893 EX-QQ-RecipientCnt: 8 From: Yuqian Yang To: Huacai Chen Cc: WANG Xuerui , Cheng Nie , Wentao Guan , Dandan Zhang , loongarch@lists.linux.dev, linux-kernel@vger.kernel.org, Yuqian Yang Subject: [PATCH] loongarch: improve logging of disabling KASLR. Date: Fri, 3 Apr 2026 14:30:08 +0800 Message-ID: X-Mailer: git-send-email 2.50.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-QQ-SENDSIZE: 520 Feedback-ID: zesmtpip:uniontech.com:qybglogicsvrgz:qybglogicsvrgz3a-1 X-QQ-XMAILINFO: MM51ngjmpkNsdMWVMMlgcLUcFX4G1b3SzsVX9BMjAYmmkstZqo39/7n9 WB326+NfltofPuFsuyaZspgA0bS6Tx+pmvEnZWpQDB3GkZdVRoMtDFx40fZzezFHvl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Tk3gLg== X-QQ-RECHKSPAM: 0 Content-Type: text/plain; charset="utf-8" Whether KASLR is disabled is not handled in nokaslr (early param "nokaslr" setup function) but in kaslr_disabled. However, the logging was done in nokaslr previously. So we move the logging to the right place and add more specific info about why it's disabled. Suggested-by: Wentao Guan Signed-off-by: Yuqian Yang --- arch/loongarch/kernel/relocate.c | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/arch/loongarch/kernel/relocate.c b/arch/loongarch/kernel/reloc= ate.c index 82aa3f0359278..be11096c3c009 100644 --- a/arch/loongarch/kernel/relocate.c +++ b/arch/loongarch/kernel/relocate.c @@ -128,9 +128,8 @@ static inline __init unsigned long get_random_boot(void) =20 static int __init nokaslr(char *p) { - pr_info("KASLR is disabled.\n"); - - return 0; /* Print a notice and silence the boot warning */ + /* The real check is handled in kaslr_disabled() below. */ + return 0; } early_param("nokaslr", nokaslr); =20 @@ -138,14 +137,19 @@ static inline __init bool kaslr_disabled(void) { char *str; const char *builtin_cmdline =3D CONFIG_CMDLINE; + const char *const message =3D "KASLR is disabled by %s in %s cmdline.\n"; =20 str =3D strstr(builtin_cmdline, "nokaslr"); - if (str =3D=3D builtin_cmdline || (str > builtin_cmdline && *(str - 1) = =3D=3D ' ')) + if (str =3D=3D builtin_cmdline || (str > builtin_cmdline && *(str - 1) = =3D=3D ' ')) { + pr_info(message, "nokaslr", "built-in"); return true; + } =20 str =3D strstr(boot_command_line, "nokaslr"); - if (str =3D=3D boot_command_line || (str > boot_command_line && *(str - 1= ) =3D=3D ' ')) + if (str =3D=3D boot_command_line || (str > boot_command_line && *(str - 1= ) =3D=3D ' ')) { + pr_info(message, "nokaslr", "boot"); return true; + } =20 #ifdef CONFIG_HIBERNATION str =3D strstr(builtin_cmdline, "nohibernate"); @@ -165,17 +169,23 @@ static inline __init bool kaslr_disabled(void) return false; =20 str =3D strstr(builtin_cmdline, "resume=3D"); - if (str =3D=3D builtin_cmdline || (str > builtin_cmdline && *(str - 1) = =3D=3D ' ')) + if (str =3D=3D builtin_cmdline || (str > builtin_cmdline && *(str - 1) = =3D=3D ' ')) { + pr_info(message, "resume=3D", "built-in"); return true; + } =20 str =3D strstr(boot_command_line, "resume=3D"); - if (str =3D=3D boot_command_line || (str > boot_command_line && *(str - 1= ) =3D=3D ' ')) + if (str =3D=3D boot_command_line || (str > boot_command_line && *(str - 1= ) =3D=3D ' ')) { + pr_info(message, "resume=3D", "boot"); return true; + } #endif =20 str =3D strstr(boot_command_line, "kexec_file"); - if (str =3D=3D boot_command_line || (str > boot_command_line && *(str - 1= ) =3D=3D ' ')) + if (str =3D=3D boot_command_line || (str > boot_command_line && *(str - 1= ) =3D=3D ' ')) { + pr_info(message, "kexec_file", "boot"); return true; + } =20 return false; } --=20 2.50.1