Patch "s390/cpacf: Make use of invalid opcode produce a link error" has been added to the 5.10-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    s390/cpacf: Make use of invalid opcode produce a link error

to the 5.10-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     s390-cpacf-make-use-of-invalid-opcode-produce-a-link.patch
and it can be found in the queue-5.10 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit dd53b6a67fdd1af2fbfb0333570ef8689f774427
Author: Harald Freudenberger <freude@xxxxxxxxxxxxx>
Date:   Tue May 14 10:09:32 2024 +0200

    s390/cpacf: Make use of invalid opcode produce a link error
    
    [ Upstream commit 32e8bd6423fc127d2b37bdcf804fd76af3bbec79 ]
    
    Instead of calling BUG() at runtime introduce and use a prototype for a
    non-existing function to produce a link error during compile when a not
    supported opcode is used with the __cpacf_query() or __cpacf_check_opcode()
    inline functions.
    
    Suggested-by: Heiko Carstens <hca@xxxxxxxxxxxxx>
    Signed-off-by: Harald Freudenberger <freude@xxxxxxxxxxxxx>
    Reviewed-by: Holger Dengler <dengler@xxxxxxxxxxxxx>
    Reviewed-by: Juergen Christ <jchrist@xxxxxxxxxxxxx>
    Cc: stable@xxxxxxxxxxxxxxx
    Signed-off-by: Heiko Carstens <hca@xxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/arch/s390/include/asm/cpacf.h b/arch/s390/include/asm/cpacf.h
index fa31f71cf5746..0f6ff2008a159 100644
--- a/arch/s390/include/asm/cpacf.h
+++ b/arch/s390/include/asm/cpacf.h
@@ -161,6 +161,13 @@
 
 typedef struct { unsigned char bytes[16]; } cpacf_mask_t;
 
+/*
+ * Prototype for a not existing function to produce a link
+ * error if __cpacf_query() or __cpacf_check_opcode() is used
+ * with an invalid compile time const opcode.
+ */
+void __cpacf_bad_opcode(void);
+
 static __always_inline void __cpacf_query_rre(u32 opc, u8 r1, u8 r2,
 					      cpacf_mask_t *mask)
 {
@@ -232,7 +239,7 @@ static __always_inline void __cpacf_query(unsigned int opcode,
 		__cpacf_query_rre(CPACF_PRNO, 2, 4, mask);
 		break;
 	default:
-		BUG();
+		__cpacf_bad_opcode();
 	}
 }
 
@@ -257,7 +264,8 @@ static __always_inline int __cpacf_check_opcode(unsigned int opcode)
 	case CPACF_KMA:
 		return test_facility(146);	/* check for MSA8 */
 	default:
-		BUG();
+		__cpacf_bad_opcode();
+		return 0;
 	}
 }
 




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux