mirror of
				https://git.proxmox.com/git/fwupd
				synced 2025-11-04 07:13:36 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			41 lines
		
	
	
		
			763 B
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			41 lines
		
	
	
		
			763 B
		
	
	
	
		
			C
		
	
	
	
	
	
/*
 | 
						|
 * Copyright (C) 2020 Richard Hughes <richard@hughsie.com>
 | 
						|
 * Copyright (C) 2020 H.J. Lu <hjl.tools@gmail.com>
 | 
						|
 *
 | 
						|
 * SPDX-License-Identifier: LGPL-2.1+
 | 
						|
 */
 | 
						|
 | 
						|
#include "config.h"
 | 
						|
 | 
						|
#include <signal.h>
 | 
						|
#include <stdlib.h>
 | 
						|
 | 
						|
#include "fu-cpu-helper-cet-common.h"
 | 
						|
 | 
						|
#ifdef HAVE_SIGACTION
 | 
						|
static __attribute__((noreturn))void
 | 
						|
segfault_sigaction (int signal, siginfo_t *si, void *arg)
 | 
						|
{
 | 
						|
	/* CET did exactly as it should to protect the system */
 | 
						|
	exit (0);
 | 
						|
}
 | 
						|
#endif
 | 
						|
 | 
						|
int
 | 
						|
main (int argc, char *argv[])
 | 
						|
{
 | 
						|
#ifdef HAVE_SIGACTION
 | 
						|
	struct sigaction sa = { 0 };
 | 
						|
 | 
						|
	sigemptyset (&sa.sa_mask);
 | 
						|
	sa.sa_sigaction = segfault_sigaction;
 | 
						|
	sa.sa_flags = SA_SIGINFO;
 | 
						|
	sigaction (SIGSEGV, &sa, NULL);
 | 
						|
#endif
 | 
						|
 | 
						|
	fu_cpu_helper_cet_testfn1 ();
 | 
						|
 | 
						|
	/* this means CET did not work */
 | 
						|
	return 1;
 | 
						|
}
 |