From nobody Mon Oct 6 10:16:33 2025 Received: from mail-pj1-f74.google.com (mail-pj1-f74.google.com [209.85.216.74]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 480272877E8 for ; Tue, 22 Jul 2025 21:58:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.74 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753221487; cv=none; b=aai2is4/+YGE5jZVRr5vlyQdX/I/I+kH+irduqGkY9CwJLK628wpDIo1+fDJgcqHOKPDavAvi3ky8zArOhq7b0XxBToM9gBZ0EzVwxh8EEJUZSmwka7CNLWJayVNhatzYWNMX3DM4C7CehWDB5gvoR4Yl/h0t0JLBmeKz4U+/5s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753221487; c=relaxed/simple; bh=dPokapA0VT0ZnXYTCDP2a7rcIZaZMOL43bSgz1bdtMI=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=qD1QVta71htDQQjtvNW46rSQ+i0ddnrMRzbA6U/iRuB2jAwx6QVpd0oQwN1j8t0MwvIkikBfrApGbh/JsgadXr1pv/72aojGxCLfZ0qPrqv/D9rkVSO4T6kMlEpPXkRGaXMF3mDwRrM1yDar6qWvtouerD+4JedaqKqJQZlrUZ4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=1fV7J+vD; arc=none smtp.client-ip=209.85.216.74 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="1fV7J+vD" Received: by mail-pj1-f74.google.com with SMTP id 98e67ed59e1d1-31202bbaafaso5122815a91.1 for ; Tue, 22 Jul 2025 14:58:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1753221485; x=1753826285; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=/ex2r39vcgr2S7UXWSrh8npW0q87ZA58tBDtcoAjsEk=; b=1fV7J+vDHTqUNZTUd+8ChLp8JZ3q4Wg9F9b7Y1jd1sJQCOjm8nwILHy3cHKeO2Bc7t y3A/ZaUm/D/cEoz9kYenKGYUW5iDBTc0ydcUr5DG+wyQ1n1hYOhymBwOyfKf5n80hX7n oRt4ZMMYLZumHGKqmA23Qbn3yYu+kU5tMDL8qzBVFxcxUAC7fFTp+2xPhZp9vOVtSjKK me695lBOfsvLhc616pbYLOeDvAWipS1hjPkQyXLQchTptBT9EMH1q2sNoHd+F6qodxxr NktkGCWwedFH3jw8yiAkJxd7Y+2/LjYUnfhtk0rdibTCkIZNBrXaRzwQZ4Wlm4D7tTCC D4sg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1753221485; x=1753826285; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=/ex2r39vcgr2S7UXWSrh8npW0q87ZA58tBDtcoAjsEk=; b=HrXeB5NuX7n3xL6fAic6wx46VCssWxtp8UVUi2ZYD6tvmbKwa9Tew+gPdVh2ANMEdL rNd6oCqETKAgZ81ihfCJrIidl0b818V8ytYPQL8JrByNGfKznM3cCT8kMx3IipJ2YG4B SCUfFTQuJOaMRfYluvTmEloVg86GOhZcvRIT2+vyT4t7TBv2ulfQm+ow6TmaUIa3OMu2 14BMYUscCdizUCUyf3tK3Ra06mMRQoUGXHbSRU4CTuGtkqF7NyPgMTpkxR8RrOKeARag 69NuuNlpCmsFqe3AznUbjM/IO7GK1sT517ibg5qMrtw20i0oNOdJxglu2FR3LdxdWkWj BMQw== X-Forwarded-Encrypted: i=1; AJvYcCUhb8YW2ZOZRn4XOVG3Z+eCOQ/D0I6H4FGAfeaEy4tS5xN4UhQKEnn5RVf6r4luMlV/8YPmaNOVl9BnJUM=@vger.kernel.org X-Gm-Message-State: AOJu0Yy3xywHRsM4+OoezMYsofu22JQKQiObHlpEhhc7T8GfyI/jbWvX /nZ1DzurBSrVTn23vS70G/kqOMvzVvEr0Wl7KPsUuJ1W8F646/251V4qswPFYrAtxhjaF/C/iix CfhlGyeI0+g== X-Google-Smtp-Source: AGHT+IFHjCyshWMiMylV9kR4oGPMWesB02y/L8dbpSt1huhYstubrB/LU+NNIVLFr/jyTqh/1k1ekykqex5b X-Received: from pjp6.prod.google.com ([2002:a17:90b:55c6:b0:30e:5bd5:880d]) (user=irogers job=prod-delivery.src-stubby-dispatcher) by 2002:a17:90b:4fc3:b0:311:9c1f:8524 with SMTP id 98e67ed59e1d1-31e507cdde8mr1232496a91.15.1753221485505; Tue, 22 Jul 2025 14:58:05 -0700 (PDT) Date: Tue, 22 Jul 2025 14:57:52 -0700 In-Reply-To: <20250722215754.672330-1-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20250722215754.672330-1-irogers@google.com> X-Mailer: git-send-email 2.50.0.727.gbf7dc18ff4-goog Message-ID: <20250722215754.672330-2-irogers@google.com> Subject: [PATCH v4 1/3] vdso: Switch get/put unaligned from packed struct to memcpy From: Ian Rogers To: Eric Biggers , Yuzhuo Jing , Andy Lutomirski , Thomas Gleixner , Vincenzo Frascino , Arnaldo Carvalho de Melo , Al Viro , Christophe Leroy , "Jason A. Donenfeld" , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org Cc: Ian Rogers Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Type punning is necessary for get/put unaligned but the use of a packed struct violates strict aliasing rules, requiring -fno-strict-aliasing to be passed to the C compiler. Switch to using memcpy so that -fno-strict-aliasing isn't necessary. Signed-off-by: Ian Rogers --- include/vdso/unaligned.h | 41 ++++++++++++++++++++++++++++++++++------ 1 file changed, 35 insertions(+), 6 deletions(-) diff --git a/include/vdso/unaligned.h b/include/vdso/unaligned.h index ff0c06b6513e..9076483c9fbb 100644 --- a/include/vdso/unaligned.h +++ b/include/vdso/unaligned.h @@ -2,14 +2,43 @@ #ifndef __VDSO_UNALIGNED_H #define __VDSO_UNALIGNED_H =20 -#define __get_unaligned_t(type, ptr) ({ \ - const struct { type x; } __packed * __get_pptr =3D (typeof(__get_pptr))(p= tr); \ - __get_pptr->x; \ +#include + +/** + * __get_unaligned_t - read an unaligned value from memory. + * @type: the type to load from the pointer. + * @ptr: the pointer to load from. + * + * Use memcpy to affect an unaligned type sized load avoiding undefined be= havior + * from approaches like type punning that require -fno-strict-aliasing in = order + * to be correct. As type may be const, use __unqual_scalar_typeof to map = to a + * non-const type - you can't memcpy into a const type. The + * __get_unaligned_ctrl_type gives __unqual_scalar_typeof its required + * expression rather than type, a pointer is used to avoid warnings about = mixing + * the use of 0 and NULL. The void* cast silences ubsan warnings. + */ +#define __get_unaligned_t(type, ptr) ({ \ + type *__get_unaligned_ctrl_type __always_unused =3D NULL; \ + __unqual_scalar_typeof(*__get_unaligned_ctrl_type) __get_unaligned_val; \ + __builtin_memcpy(&__get_unaligned_val, (void *)(ptr), \ + sizeof(__get_unaligned_val)); \ + __get_unaligned_val; \ }) =20 -#define __put_unaligned_t(type, val, ptr) do { \ - struct { type x; } __packed * __put_pptr =3D (typeof(__put_pptr))(ptr); \ - __put_pptr->x =3D (val); \ +/** + * __put_unaligned_t - write an unaligned value to memory. + * @type: the type of the value to store. + * @val: the value to store. + * @ptr: the pointer to store to. + * + * Use memcpy to affect an unaligned type sized store avoiding undefined + * behavior from approaches like type punning that require -fno-strict-ali= asing + * in order to be correct. The void* cast silences ubsan warnings. + */ +#define __put_unaligned_t(type, val, ptr) do { \ + type __put_unaligned_val =3D (val); \ + __builtin_memcpy((void *)(ptr), &__put_unaligned_val, \ + sizeof(__put_unaligned_val)); \ } while (0) =20 #endif /* __VDSO_UNALIGNED_H */ --=20 2.50.0.727.gbf7dc18ff4-goog From nobody Mon Oct 6 10:16:33 2025 Received: from mail-pj1-f74.google.com (mail-pj1-f74.google.com [209.85.216.74]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 21617286D5B for ; Tue, 22 Jul 2025 21:58:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.74 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753221489; cv=none; b=DE9C4nEw23BG9nm3/Q7iZYauddwEsFgJpaoUxtYNMv3Xpk8G8F8rkyN/VcBcJe2TLdvFggML7vYss0ZZV+8mDpImTL3SBhGwuaJtSNqWOdnoxxFVv6QnZ/ntKbU6xeLyBgeYwsT3ktiViHZQHlq8d0o2GtFnScc5LWF+eCH5Qeg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753221489; c=relaxed/simple; bh=rXMYeZ6nHjuavtHWLi92BzEDLvzM5iCtn0anCHdQWC0=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=ezWAuBXCFt5tmvI9YKq2wEDE2MswZ3jZxcl4PbPg5XeKScCm+XK2tULYq4gmlAwMJvjviPheNCZlxa3P3tnztT/Ig1nH8Zc1ktxQFCAsX3VYkDQX9r6LNrqm1qr/Zlu+SyBcOZ6c6jZOY09HQfrBePHi0hY0ET3nnjO92DXhcHY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=f4Krp/8a; arc=none smtp.client-ip=209.85.216.74 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="f4Krp/8a" Received: by mail-pj1-f74.google.com with SMTP id 98e67ed59e1d1-313ff01d2a6so4978274a91.3 for ; Tue, 22 Jul 2025 14:58:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1753221487; x=1753826287; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=gJRSNbAVtnnRSRtWxuuhl6QaFHCsA6vuAmX7FkDxBVU=; b=f4Krp/8a0YEsgK14Q505jSUp77XYNt9xulReTZFG3NmEw/b1KqXLz1cMtoSL65txVZ xP9KcWPGsYlLHRgH54FFp8uB68vvBsdkY1jhNudZ4iYF8NLjyQgkXfiW3ltZ2FWkQas/ JkmyuXauCXy+z3nrkdKk2g1XYIBqpe1VLbEOeNz7EJ42RVeWoUi2Gj+oowTsWwB6/C+x 4YTN4egkI3Zs+X89LsmCGtagHLqFOBFWT6cv3RN/+wrxZzswHHdLkvZjVWflAPdNDxoz ulUhyoZJJu9yGFkjJHnJ1VD86E+Osce+6oD4eKsxJHlAKxzD3ttH50YqCx40Q2poyIAT lmcA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1753221487; x=1753826287; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=gJRSNbAVtnnRSRtWxuuhl6QaFHCsA6vuAmX7FkDxBVU=; b=AkCGuyluGl2OlWqhiejdkoQNgwbivEE1bPrw6ntGrPCziSXlVd8eSJQuRBLNXGJm8g DWk4PvjltXgs8S7fJa16TIDhGn82fI4LHATGGc1eukj3KKUDGTumuyvO7WDXTm0gSjLt LxBEPG4522L35UOE94moL6o/+pLzzMBv5KTk09MzigzpL9VPc9Rogpt9zTt6lw3USzYC HNZGXFI61CTH1nXbtpPU6l7o38zl+2OXRFH2cFX5ky/asnmdirZ88jKEdoajcH2G3WFS /nd+9bqMiZlCcAp2/Am8VLyk4go2OVN6Y9Yag9F0XQNx/sChPvj7+XuFiYCsQlQp9iLt 9PLw== X-Forwarded-Encrypted: i=1; AJvYcCWUVqd71Hv1P4KeI8+idUHSh5VjKUafbe1dt85JbxCAYAGe+/TCN0TkbrIeIYDED9H+Loiw8mNgiy7uj3U=@vger.kernel.org X-Gm-Message-State: AOJu0YxDF78/TFk2xuxCQTqIWZhBEl7pNvsrQQ6jneBSDDnTaU13b98c Gh/7S31ItgcUipe1sUGeMkf8BcsF/XgfUSiX4jOQjQIiQWzqKaEMIsCnaPmYNHL4MSJ9CiA1gz3 osstu47pk2Q== X-Google-Smtp-Source: AGHT+IHdhqHoxMMDAXiufK5PlecdJ/IBjH5JHd18OWhrASaqpf5K8i3TM25fRL4P6wJuPv3uT7mpBTaWZ7Q4 X-Received: from pjbqx13.prod.google.com ([2002:a17:90b:3e4d:b0:312:1c59:43a6]) (user=irogers job=prod-delivery.src-stubby-dispatcher) by 2002:a17:90b:4e83:b0:31c:15d9:8aa with SMTP id 98e67ed59e1d1-31e507fe866mr1144679a91.34.1753221487472; Tue, 22 Jul 2025 14:58:07 -0700 (PDT) Date: Tue, 22 Jul 2025 14:57:53 -0700 In-Reply-To: <20250722215754.672330-1-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20250722215754.672330-1-irogers@google.com> X-Mailer: git-send-email 2.50.0.727.gbf7dc18ff4-goog Message-ID: <20250722215754.672330-3-irogers@google.com> Subject: [PATCH v4 2/3] tools headers: Update the linux/unaligned.h copy with the kernel sources From: Ian Rogers To: Eric Biggers , Yuzhuo Jing , Andy Lutomirski , Thomas Gleixner , Vincenzo Frascino , Arnaldo Carvalho de Melo , Al Viro , Christophe Leroy , "Jason A. Donenfeld" , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org Cc: Ian Rogers Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" To pick up the changes in: e5f39a57c4c5 vdso: Switch get/put unaligned from packed struct to memcpy As the code is dependent on __unqual_scalar_typeof, update the tools version of compiler_types.h to include this. Signed-off-by: Ian Rogers --- tools/include/linux/compiler_types.h | 22 +++++++++++++++ tools/include/vdso/unaligned.h | 41 ++++++++++++++++++++++++---- 2 files changed, 57 insertions(+), 6 deletions(-) diff --git a/tools/include/linux/compiler_types.h b/tools/include/linux/com= piler_types.h index d09f9dc172a4..890982283a5e 100644 --- a/tools/include/linux/compiler_types.h +++ b/tools/include/linux/compiler_types.h @@ -40,4 +40,26 @@ #define asm_goto_output(x...) asm goto(x) #endif =20 +/* + * __unqual_scalar_typeof(x) - Declare an unqualified scalar type, leaving + * non-scalar types unchanged. + */ +/* + * Prefer C11 _Generic for better compile-times and simpler code. Note: 'c= har' + * is not type-compatible with 'signed char', and we define a separate cas= e. + */ +#define __scalar_type_to_expr_cases(type) \ + unsigned type: (unsigned type)0, \ + signed type: (signed type)0 + +#define __unqual_scalar_typeof(x) typeof( \ + _Generic((x), \ + char: (char)0, \ + __scalar_type_to_expr_cases(char), \ + __scalar_type_to_expr_cases(short), \ + __scalar_type_to_expr_cases(int), \ + __scalar_type_to_expr_cases(long), \ + __scalar_type_to_expr_cases(long long), \ + default: (x))) + #endif /* __LINUX_COMPILER_TYPES_H */ diff --git a/tools/include/vdso/unaligned.h b/tools/include/vdso/unaligned.h index ff0c06b6513e..9076483c9fbb 100644 --- a/tools/include/vdso/unaligned.h +++ b/tools/include/vdso/unaligned.h @@ -2,14 +2,43 @@ #ifndef __VDSO_UNALIGNED_H #define __VDSO_UNALIGNED_H =20 -#define __get_unaligned_t(type, ptr) ({ \ - const struct { type x; } __packed * __get_pptr =3D (typeof(__get_pptr))(p= tr); \ - __get_pptr->x; \ +#include + +/** + * __get_unaligned_t - read an unaligned value from memory. + * @type: the type to load from the pointer. + * @ptr: the pointer to load from. + * + * Use memcpy to affect an unaligned type sized load avoiding undefined be= havior + * from approaches like type punning that require -fno-strict-aliasing in = order + * to be correct. As type may be const, use __unqual_scalar_typeof to map = to a + * non-const type - you can't memcpy into a const type. The + * __get_unaligned_ctrl_type gives __unqual_scalar_typeof its required + * expression rather than type, a pointer is used to avoid warnings about = mixing + * the use of 0 and NULL. The void* cast silences ubsan warnings. + */ +#define __get_unaligned_t(type, ptr) ({ \ + type *__get_unaligned_ctrl_type __always_unused =3D NULL; \ + __unqual_scalar_typeof(*__get_unaligned_ctrl_type) __get_unaligned_val; \ + __builtin_memcpy(&__get_unaligned_val, (void *)(ptr), \ + sizeof(__get_unaligned_val)); \ + __get_unaligned_val; \ }) =20 -#define __put_unaligned_t(type, val, ptr) do { \ - struct { type x; } __packed * __put_pptr =3D (typeof(__put_pptr))(ptr); \ - __put_pptr->x =3D (val); \ +/** + * __put_unaligned_t - write an unaligned value to memory. + * @type: the type of the value to store. + * @val: the value to store. + * @ptr: the pointer to store to. + * + * Use memcpy to affect an unaligned type sized store avoiding undefined + * behavior from approaches like type punning that require -fno-strict-ali= asing + * in order to be correct. The void* cast silences ubsan warnings. + */ +#define __put_unaligned_t(type, val, ptr) do { \ + type __put_unaligned_val =3D (val); \ + __builtin_memcpy((void *)(ptr), &__put_unaligned_val, \ + sizeof(__put_unaligned_val)); \ } while (0) =20 #endif /* __VDSO_UNALIGNED_H */ --=20 2.50.0.727.gbf7dc18ff4-goog From nobody Mon Oct 6 10:16:33 2025 Received: from mail-pj1-f73.google.com (mail-pj1-f73.google.com [209.85.216.73]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B192928725F for ; Tue, 22 Jul 2025 21:58:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.73 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753221491; cv=none; b=LU0owmD7GWNDvj8OlA7ENhTJGeovW9BkQgz5Gtr2VoG0tiL5RSkIxb6GHWP0Z97fO7k6xHAJTKtgVvsEpHVI6PAnB7AClSNtRSsi5h920Ep8GMxpUaOoMsSbO5DfrCfpB3O6cOsueXXnT1G/1ZHqJjzznTh/p+7yvbS9f7GdLa8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753221491; c=relaxed/simple; bh=Y9rAwk43R5Qu/XneIvtPPaxorqlg9IJwfPk0mko3rAw=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=smuJatBg5aTNG29SUcbopvKe53HrO2AiERtddPsMgQlk7CBqqfPjp9YZwkeEl3WNrWBK8bmV1tFSv3m0POCEm32dJH5c7qC7zAnTDdhOri+NbGXO1jkjrZo3ndVsh3i3nJVX9bp3j10QpOcYJdXRCHeYb3h2ZYgpoeVp/rjaMGw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=C853fdJ0; arc=none smtp.client-ip=209.85.216.73 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="C853fdJ0" Received: by mail-pj1-f73.google.com with SMTP id 98e67ed59e1d1-315af08594fso5678350a91.2 for ; Tue, 22 Jul 2025 14:58:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1753221489; x=1753826289; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=06wlXYRsyscOOukfm0BoHmWOsjunsh8IZmbqRpcqtRo=; b=C853fdJ0xOQbgEZtQOkgX2C8yILwNijR7CiheNFg56U/T68obrJAaKZOBRtXdAJdpY 2cEl1M1y2ST7E96LEmvGdbRRMKKAv6KPmVDG5uAchPsFPqcoiUI/PqS2h5AiLGfzzosP dzVkjKfe2us7v/rGB8m8ZC8WFTxeYb0xrg6y6jpZuSh1C2fiZupOLk8Y0ZkSxtWb3Nke KbI+h7XRtNUmhtM81RvMDSBXuJaF598mPEkfsIO4BfPKMpzL/kM8vpjDQYigeLk3myWJ jbr2L6L2xfZQCxj+ASc/CF+RzDE8sjGWezkmF9zorii4CRIRX09b5hNLovLdNOg9KCfu vJUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1753221489; x=1753826289; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=06wlXYRsyscOOukfm0BoHmWOsjunsh8IZmbqRpcqtRo=; b=gbTNyP6d4UGQvFaFdbJMdYUTBzFvb9lgAcjpaDe1XG7QZUz+mW0nEOVeSFZNyRAQUC cEH3dAzcNrd0cUjnvNXz4lKyMSbJWu1/jyEh7lDH03vKzisE6WaLjQgrgpvQDQnebFGD ZwGmUhCJiGaIQgGCvxlLOegfo1Bxsm3fz9bd3N7KeDPLl+y3JtfyAd3tRheY1DiSmn8X /bPe9Eskb4J4ZNIs20QUTVIQMqKya2WC4kqxLxbBUkfxm+oWxatVgkuolsuKMZDmIJbv tD0X1KXNS/PBBHkI+Daknfx6/E3i5I7+0tFa9NL3fn9KO/jkTL7V/GEtKIB55MFb8jNj n2Lw== X-Forwarded-Encrypted: i=1; AJvYcCUSUVTL4115ytSsBf8XA+CtW5A1L7Zm6QIY5OAIMyLHyQ++ppQc5JotDmN+Wq4KGUVMvYZk+EvKxSKRnXo=@vger.kernel.org X-Gm-Message-State: AOJu0YymVhMwBy4w0mwh/DF+ryM/i4et9Ewnlx1EHQHLglnhReh9Fc2L Ww9Ra8sS9XJxzeCVQqxZ2sQ36u4DJNIqNTR4ksKxh8z3+m7QG6xaBqhLmedxw58WM9PhGbz4RNG +J/KXR6n7NA== X-Google-Smtp-Source: AGHT+IEfl0qr0pR281L9dJaXexJr+ertXkeG0LYGx/wzbCfiyuMlqHnbJNq3oMgCoRDj/DcPskPxdJRnCpAd X-Received: from pjg12.prod.google.com ([2002:a17:90b:3f4c:b0:312:df0e:5f09]) (user=irogers job=prod-delivery.src-stubby-dispatcher) by 2002:a17:90b:3d09:b0:312:e91c:e340 with SMTP id 98e67ed59e1d1-31e50859540mr1050005a91.35.1753221489083; Tue, 22 Jul 2025 14:58:09 -0700 (PDT) Date: Tue, 22 Jul 2025 14:57:54 -0700 In-Reply-To: <20250722215754.672330-1-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20250722215754.672330-1-irogers@google.com> X-Mailer: git-send-email 2.50.0.727.gbf7dc18ff4-goog Message-ID: <20250722215754.672330-4-irogers@google.com> Subject: [PATCH v4 3/3] tools headers: Remove unneeded ignoring of warnings in unaligned.h From: Ian Rogers To: Eric Biggers , Yuzhuo Jing , Andy Lutomirski , Thomas Gleixner , Vincenzo Frascino , Arnaldo Carvalho de Melo , Al Viro , Christophe Leroy , "Jason A. Donenfeld" , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org Cc: Ian Rogers Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Now the get/put unaligned use memcpy the -Wpacked and -Wattributes warnings don't need disabling. Signed-off-by: Ian Rogers --- tools/include/linux/unaligned.h | 4 ---- 1 file changed, 4 deletions(-) diff --git a/tools/include/linux/unaligned.h b/tools/include/linux/unaligne= d.h index 395a4464fe73..d51ddafed138 100644 --- a/tools/include/linux/unaligned.h +++ b/tools/include/linux/unaligned.h @@ -6,9 +6,6 @@ * This is the most generic implementation of unaligned accesses * and should work almost anywhere. */ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wpacked" -#pragma GCC diagnostic ignored "-Wattributes" #include =20 #define get_unaligned(ptr) __get_unaligned_t(typeof(*(ptr)), (ptr)) @@ -143,6 +140,5 @@ static inline u64 get_unaligned_be48(const void *p) { return __get_unaligned_be48(p); } -#pragma GCC diagnostic pop =20 #endif /* __LINUX_UNALIGNED_H */ --=20 2.50.0.727.gbf7dc18ff4-goog