mirror of
				https://git.proxmox.com/git/mirror_zfs.git
				synced 2025-10-26 18:05:04 +03:00 
			
		
		
		
	Workaround UBSAN errors for variable arrays
This gets around UBSAN errors when using arrays at the end of structs. It converts some zero-length arrays to variable length arrays and disables UBSAN checking on certain modules. It is based off of the patch from #15460. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Tested-by: Thomas Lamprecht <t.lamprecht@proxmox.com> Co-authored-by: Thomas Lamprecht <t.lamprecht@proxmox.com> Signed-off-by: Tony Hutter <hutter2@llnl.gov> Issue #15145 Closes #15510
This commit is contained in:
		
							parent
							
								
									f1659cc782
								
							
						
					
					
						commit
						e92a680c70
					
				| @ -108,7 +108,7 @@ typedef struct spl_kmem_magazine { | |||||||
| 	uint32_t		skm_refill;	/* Batch refill size */ | 	uint32_t		skm_refill;	/* Batch refill size */ | ||||||
| 	struct spl_kmem_cache	*skm_cache;	/* Owned by cache */ | 	struct spl_kmem_cache	*skm_cache;	/* Owned by cache */ | ||||||
| 	unsigned int		skm_cpu;	/* Owned by cpu */ | 	unsigned int		skm_cpu;	/* Owned by cpu */ | ||||||
| 	void			*skm_objs[0];	/* Object pointers */ | 	void			*skm_objs[];	/* Object pointers */ | ||||||
| } spl_kmem_magazine_t; | } spl_kmem_magazine_t; | ||||||
| 
 | 
 | ||||||
| typedef struct spl_kmem_obj { | typedef struct spl_kmem_obj { | ||||||
|  | |||||||
| @ -130,7 +130,7 @@ typedef struct raidz_row { | |||||||
| 	uint64_t rr_offset;		/* Logical offset for *_io_verify() */ | 	uint64_t rr_offset;		/* Logical offset for *_io_verify() */ | ||||||
| 	uint64_t rr_size;		/* Physical size for *_io_verify() */ | 	uint64_t rr_size;		/* Physical size for *_io_verify() */ | ||||||
| #endif | #endif | ||||||
| 	raidz_col_t rr_col[0];		/* Flexible array of I/O columns */ | 	raidz_col_t rr_col[];		/* Flexible array of I/O columns */ | ||||||
| } raidz_row_t; | } raidz_row_t; | ||||||
| 
 | 
 | ||||||
| typedef struct raidz_map { | typedef struct raidz_map { | ||||||
| @ -139,7 +139,7 @@ typedef struct raidz_map { | |||||||
| 	int rm_nskip;			/* RAIDZ sectors skipped for padding */ | 	int rm_nskip;			/* RAIDZ sectors skipped for padding */ | ||||||
| 	int rm_skipstart;		/* Column index of padding start */ | 	int rm_skipstart;		/* Column index of padding start */ | ||||||
| 	const raidz_impl_ops_t *rm_ops;	/* RAIDZ math operations */ | 	const raidz_impl_ops_t *rm_ops;	/* RAIDZ math operations */ | ||||||
| 	raidz_row_t *rm_row[0];		/* flexible array of rows */ | 	raidz_row_t *rm_row[];		/* flexible array of rows */ | ||||||
| } raidz_map_t; | } raidz_map_t; | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -488,6 +488,10 @@ zfs-$(CONFIG_ARM64) += $(addprefix zfs/,$(ZFS_OBJS_ARM64)) | |||||||
| zfs-$(CONFIG_PPC)   += $(addprefix zfs/,$(ZFS_OBJS_PPC_PPC64)) | zfs-$(CONFIG_PPC)   += $(addprefix zfs/,$(ZFS_OBJS_PPC_PPC64)) | ||||||
| zfs-$(CONFIG_PPC64) += $(addprefix zfs/,$(ZFS_OBJS_PPC_PPC64)) | zfs-$(CONFIG_PPC64) += $(addprefix zfs/,$(ZFS_OBJS_PPC_PPC64)) | ||||||
| 
 | 
 | ||||||
|  | UBSAN_SANITIZE_zap_leaf.o := n | ||||||
|  | UBSAN_SANITIZE_zap_micro.o := n | ||||||
|  | UBSAN_SANITIZE_sa.o := n | ||||||
|  | 
 | ||||||
| # Suppress incorrect warnings from versions of objtool which are not | # Suppress incorrect warnings from versions of objtool which are not | ||||||
| # aware of x86 EVEX prefix instructions used for AVX512. | # aware of x86 EVEX prefix instructions used for AVX512. | ||||||
| OBJECT_FILES_NON_STANDARD_vdev_raidz_math_avx512bw.o := y | OBJECT_FILES_NON_STANDARD_vdev_raidz_math_avx512bw.o := y | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Tony Hutter
						Tony Hutter