From nobody Thu Oct 9 10:54:04 2025 Received: from mail-oa1-f74.google.com (mail-oa1-f74.google.com [209.85.160.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 E31CE20DD72 for ; Tue, 17 Jun 2025 20:54:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.74 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750193692; cv=none; b=t9IUkIbG9LNWnkBgtJkX9AQKbCSdChMmFHevjFz46UTsEFS4m6unpvgisgd6VeUF73HcUa0ofSyxbnF7M31sMEhSmeRerqfwXCRuupFKXZqaXPoiSbtbmJ7X9uBZlvObXAyZUeYyyjSor3IiswrHhShywzY4DmH5PdRAYdLIJBU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750193692; c=relaxed/simple; bh=ji2cHswmwo/z5ubhmd2npU+1NBNQjIr4s2B7VUnbXOQ=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=fXwy5KpTSTc0bTcUAxoUsbckv9jJyVMf2xugMoMGPsrKC/z6GnWCwMMfAGI+3JgWTDgeSvUg3Ve3M0S0y8FEiIbpYZ6YQPNf1U3ULcPJQg3F1ZZE+tpFlWAtSuRVAfXzO5RR6dlQ65yNt40Cqx4rzs1y/++Dw8MJnGzWcKbsm1M= 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=rEfWD4fE; arc=none smtp.client-ip=209.85.160.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="rEfWD4fE" Received: by mail-oa1-f74.google.com with SMTP id 586e51a60fabf-2ea76b45c6aso1241333fac.1 for ; Tue, 17 Jun 2025 13:54:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1750193690; x=1750798490; 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=dbyQnd6426Fx1NsnFOkmoHrxj7lid9QiAbcIefxO5Cg=; b=rEfWD4fEQ3BotdNbBgz37YunHHKjAVVSrSHJtTeR/tWsS2C4Z+9/fUUac6HgiltT49 h0JxLv8NAdN90xSYnheBFw73BISBwUm+C4vH2JyZ1Ij0PO5TT1UdgCfJHu7lMCbqUhEq h36uyoLe0OW8ERs6D+P5C3JhNJznJUQ22JlfueIi97l9g1isYo4K/RXhyziN2bPT8qv4 Pzz0tBBIFRP5CIx1GJQT8pb731Fs/yu/BK+YL992S/yz01AGQ+5c+C4618e28jbQ37Ac mYHzqgCcNEhYYlFEL/oouok9DDwIgCNqleVk7cdzOiR1OyoYlgfOOVbpZLxKAdipgmgC w7ZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1750193690; x=1750798490; 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=dbyQnd6426Fx1NsnFOkmoHrxj7lid9QiAbcIefxO5Cg=; b=JlNFwTQZQWk+cqp1VjUAraNJGOOSNQd4T3fV2vrKfF/HkhPC6GH7xHo+Sd6/7Usj+E ACGTH38NiPfAISPOcZJzCNikXv06JSlFeIsCcMUEYDI5mKOTkgumRaRBDGvPFZ0dLw0O QILWERaXeDsExMNpRAidrUSre8kq/Knnr9gExPAJuJl4vTfWASMe2LreQCmBImSEADzf Y7wSSKafBcpd2XCzRBm4y+o6Sn76kZaWQ9QmJdJFS5VzSBRgP0z3DrjivrWQLMlx7UsF rrn7w38lpfkMZxJlirMg9G8sOnNgtLNjiOxgTdLzvWIjsTWyz0YBB7zdZvRBjBPijqOi OQrw== X-Forwarded-Encrypted: i=1; AJvYcCVDZH9aQ0UZ/gimh5lTjwdiABh+CvuBiADUM1RvCopNKHWT/HXQdb5Ey/AWdM4TJtykP1pqMWHk6TAsNDA=@vger.kernel.org X-Gm-Message-State: AOJu0YzKzIe+TrNXYVEF5LtPdCSxaHfFtPQKXhpzX9xn6vo+6uOtlvYV RZCCz7yZMLnOe8DHzrzFC2o4wcxDd/jsgi9RNd7zDI+BMOTKID4uRCk5/hzJl/zjwa2bzd9ogX+ jjW3U0bv5QQ== X-Google-Smtp-Source: AGHT+IGO+lDFmIYK2w4ANnsn3rKPN7NvFKzlodTqOzVDtZl/njo/FT5AchdaGQP4Vk87djIL0Wjh2P0D9VgF X-Received: from oacml3.prod.google.com ([2002:a05:6871:7243:b0:2c1:5f7a:eba8]) (user=irogers job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6870:709c:b0:2d6:103e:e43d with SMTP id 586e51a60fabf-2eaf0b0bc51mr7182984fac.20.1750193689948; Tue, 17 Jun 2025 13:54:49 -0700 (PDT) Date: Tue, 17 Jun 2025 13:53:18 -0700 In-Reply-To: <20250617205320.1580946-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: <20250617205320.1580946-1-irogers@google.com> X-Mailer: git-send-email 2.50.0.rc2.701.gf1e915cc24-goog Message-ID: <20250617205320.1580946-2-irogers@google.com> Subject: [PATCH v2 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 Reviewed-by: Christophe Leroy --- include/vdso/unaligned.h | 48 +++++++++++++++++++++++++++++++++++----- 1 file changed, 42 insertions(+), 6 deletions(-) diff --git a/include/vdso/unaligned.h b/include/vdso/unaligned.h index ff0c06b6513e..f33c1eefbf68 100644 --- a/include/vdso/unaligned.h +++ b/include/vdso/unaligned.h @@ -2,14 +2,50 @@ #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; \ +#define ____get_unaligned_type(type) type: (type)0 +/** + * __get_unaligned_t - read an unaligned value from memory. + * @ptr: the pointer to load from. + * @type: the type to load from the pointer. + * + * 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 _Generic to map to a non-const= type + * - you can't memcpy into a const type. The void* cast silences ubsan war= nings. + */ +#define __get_unaligned_t(type, ptr) ({ \ + type __get_unaligned_map_ctrl =3D 0; \ + typeof(_Generic(__get_unaligned_map_ctrl, \ + ____get_unaligned_type(short int), \ + ____get_unaligned_type(unsigned short int), \ + ____get_unaligned_type(int), \ + ____get_unaligned_type(unsigned int), \ + ____get_unaligned_type(long), \ + ____get_unaligned_type(unsigned long), \ + ____get_unaligned_type(long long), \ + ____get_unaligned_type(unsigned long long), \ + default: (type)0 \ + )) __get_unaligned_val; \ + (void)__get_unaligned_map_ctrl; \ + __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.rc2.701.gf1e915cc24-goog From nobody Thu Oct 9 10:54:04 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 956D52E719C for ; Tue, 17 Jun 2025 20:54:52 +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=1750193694; cv=none; b=MO/usR5EZ6Rc68d72YF6J7v1R8bPZuaA9Ri+4kmxQFv0F3hToggtOhAAZGvBueEze3l/kOc5ADrnhoEsOI2wxCxJy/H+MboVLsxIRz+4HadzpihcGdyqYYwsTgZE96iMAltIN1LZiZRCkkuEgvy2piW95bwId0lhn7KLirDHt+g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750193694; c=relaxed/simple; bh=9SzXJ15j3U8LLY/VYfOxt4So2V01/XoyuGBXz/ltQbU=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=FCAsyfnxTCfNB5hAgmOTvONaCsaWUS9e9WHKROuvCykF6SV9+oeiJ1j5PjHVAUaeIuaEtQerQk+IjEvnMJYaZJREp+3hjIba4vzhTB+xvxPI9gek9YEV/SVbcj86UmKybY115cOh0zxmtLoQjgCo1QMEiutMBD7CeZmLzsOcjcQ= 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=mg8q6N+f; 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="mg8q6N+f" Received: by mail-pj1-f73.google.com with SMTP id 98e67ed59e1d1-31366819969so5454796a91.0 for ; Tue, 17 Jun 2025 13:54:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1750193692; x=1750798492; 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=0Z930P5mm/rRASOyUPDd8zyUujiTaQQWWaxXoM7MXu0=; b=mg8q6N+ffA75S5IVM0EC2MopHQuObSNb3Ix/ejaNQ+7XRoT12UqrZnULNe1K8a/78Y qpvOuHN0J/T4gY5ZrOS2O0er3j/xkpg+bJb9jqU4vQddQNCnGF8wygN8KFwPR7BTwCFO Bl3gkl5m9eOxoFlr8pjtWZvxAfC1sPd2xHSWe6FkD7S3A1fsLESlRkackXqp7CjqeYT7 yxJ0eaMafQPGwVDMR82gZEpOiWBIKam/P4SYfL7BBe47RR5JmGBIVO7UG0+vJq8DUh/9 mOOpnus5XdzfLey2vtHZBtSu5cZVSMwtu4IMOIMbwgmGUtt647o1r462b8EZVkOUJ/Oa B1RA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1750193692; x=1750798492; 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=0Z930P5mm/rRASOyUPDd8zyUujiTaQQWWaxXoM7MXu0=; b=pxXx8ED+QAKd4r8Sf8vhjThubQDYL1IaUxwVirioAYhEjzOxKDV3OUGyUs+NL9UkYY seJEHplPciNbB6JKxCj9wbD4t1sJPX+w8Y6y2sqBJP/VEpToRCtXHxaHugKUaau3zs3j fjDLQM9M1mojJ9tbbh6Qg3m1XlSescRSk2kHosv1ckKfyJIX1J3Ipv7qIfLSVemlJiOi nCztTK7jVt9Wit7xLdLN9LtIrXktL4F//U+E0auhk5eVL3mSi8Ed0wlDShDvY4Y0Y5qj 2+UsEuYgzbY9Pxb8RBZGC3BUtmQREERj6GvlM0+rYJrq8svC37K0WoHKGDr6JxUoq9Pl oYxw== X-Forwarded-Encrypted: i=1; AJvYcCUeCK+8Ra5oi+EZ+bTGRgvFTMJGHNz69Pa6CUEuEvU05UQAYn3RZG+MrJSpl4QfDDvxhcQKQ7BejJnkTBo=@vger.kernel.org X-Gm-Message-State: AOJu0Yx6o0q8bufWHZMJhOmWqRE5rRWVEfBYtEPeTr6qOCFev/PJ+KPl 7wtrcc4FfiykwEkEfsEygvLb7EdUMa4ZPxnp7KdJIHW0G8I8cE98gUy4dZpE9owy3lmFDoVn95N 42nL3lZyejw== X-Google-Smtp-Source: AGHT+IE0mdxRTfSCI/6oC+ccX8uVa0JxO7+mrJX+nZv1nNqdPCaIvUnYOQzT/HdQKuql5X7plbjVqBsZMCKh X-Received: from pjbdy14.prod.google.com ([2002:a17:90b:6ce:b0:313:274d:3007]) (user=irogers job=prod-delivery.src-stubby-dispatcher) by 2002:a17:90b:4d8c:b0:313:1c7b:fc62 with SMTP id 98e67ed59e1d1-313f1d589b3mr17608382a91.22.1750193691931; Tue, 17 Jun 2025 13:54:51 -0700 (PDT) Date: Tue, 17 Jun 2025 13:53:19 -0700 In-Reply-To: <20250617205320.1580946-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: <20250617205320.1580946-1-irogers@google.com> X-Mailer: git-send-email 2.50.0.rc2.701.gf1e915cc24-goog Message-ID: <20250617205320.1580946-3-irogers@google.com> Subject: [PATCH v2 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: fe9b2b7b3583 vdso: Switch get/put unaligned from packed struct to memcpy Signed-off-by: Ian Rogers --- tools/include/vdso/unaligned.h | 48 +++++++++++++++++++++++++++++----- 1 file changed, 42 insertions(+), 6 deletions(-) diff --git a/tools/include/vdso/unaligned.h b/tools/include/vdso/unaligned.h index ff0c06b6513e..f33c1eefbf68 100644 --- a/tools/include/vdso/unaligned.h +++ b/tools/include/vdso/unaligned.h @@ -2,14 +2,50 @@ #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; \ +#define ____get_unaligned_type(type) type: (type)0 +/** + * __get_unaligned_t - read an unaligned value from memory. + * @ptr: the pointer to load from. + * @type: the type to load from the pointer. + * + * 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 _Generic to map to a non-const= type + * - you can't memcpy into a const type. The void* cast silences ubsan war= nings. + */ +#define __get_unaligned_t(type, ptr) ({ \ + type __get_unaligned_map_ctrl =3D 0; \ + typeof(_Generic(__get_unaligned_map_ctrl, \ + ____get_unaligned_type(short int), \ + ____get_unaligned_type(unsigned short int), \ + ____get_unaligned_type(int), \ + ____get_unaligned_type(unsigned int), \ + ____get_unaligned_type(long), \ + ____get_unaligned_type(unsigned long), \ + ____get_unaligned_type(long long), \ + ____get_unaligned_type(unsigned long long), \ + default: (type)0 \ + )) __get_unaligned_val; \ + (void)__get_unaligned_map_ctrl; \ + __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.rc2.701.gf1e915cc24-goog From nobody Thu Oct 9 10:54:04 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 9C6BC2EF9DD for ; Tue, 17 Jun 2025 20:54:54 +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=1750193696; cv=none; b=OcSxAcMBhVQvioai8Pg31j/vK8NtJXclsNYVDBCPK7mUFkqoGO+DUUsHZNKGGtEgNyYKyJd2kFizvWC/eqRZVj8cAnFwiyADvfiRGE4VFKokB0b2aPaOLHtyVTmEyH/o80ZyWPUpJpZbMwjod0DTfuQo0z8mC4vYKPDK7TgBJV4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750193696; c=relaxed/simple; bh=k5HJSRWuV+1Mln/4BLkxqduXgXeG6WrJ7rZ+a26pUuI=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=sZ0dx0Smu2YY53amV2L4l1Bb5SAB1oV/At0EBfe8nw/b5ulIiWm4wIvJtexNbn3S4W2vN9rUFAff2mKqpv9GQoNKDOLSSB8hRF5rLBKzQhA5gypCEFiTvAhNQWxg5NC7RbMOV9dXQq9OdrifskRZE6C7ukKsS8ulgTLkFTbIO64= 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=ohpAtdWI; 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="ohpAtdWI" Received: by mail-pj1-f74.google.com with SMTP id 98e67ed59e1d1-3138e64b3f1so7419025a91.3 for ; Tue, 17 Jun 2025 13:54:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1750193694; x=1750798494; 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=3xlQaSGpJbgGPPU4jLd2/c6BgEh1uTog2yg7MQ8roEE=; b=ohpAtdWIMsVPagMpTdEEqbqqGJEINACu8Ez32VvCIGk5A+AgpJJuYZhnJPE8pa3ndx yIO0vpR4sffKtd3c2QS3SCu7gFf59OqD74lvwoQPMSdmv+wEEoeC8PRjQPrA/IkC9ySc iUV2S87P080tR+6/Ky8iUARHW48TDM9VYQcAc8Shk24QFrOtogIm6k63ONgEXEcBItYQ 2qvvfIK0GsWr9yb48s4krz9hCG9COM3TEUKPZe22CGDcab1pjY+8LmWZDuqyaCM5yU+m kKldg3mkL2WGm5Yk7j5wwf0Ji3dcFfr8VOFENb2KUePCcUFSMojba/c7H+Pwwyia0N6f qHNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1750193694; x=1750798494; 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=3xlQaSGpJbgGPPU4jLd2/c6BgEh1uTog2yg7MQ8roEE=; b=oaNQFPBLAQ40LhpCIMjObd0ZAHd7BoG1luw+VqrIvyuYQKnmXoA9/kxtNlQ8nw+E07 o+1ZVB9mElqSu6Rycy0+/Ptk/AbNI8RyUFIwOkw5YgDJmDz/Zj5yUyMsYlE8ajXunaPU N5JvjGHWtGBZ+wshx/AuPlYbxykj3qgjyYuXO5q/GJM681z6JapWT6LykA60PTLfswCZ 5LS4wsOXH2rY0QtIpe+7Dxh61KcIlK5/YCNAlkVyrgXBG0Qn8djfPTx+hOPX32+Ikjs2 l4OL/jt9BLqSi+v5veqSmRHrkN0rvOao3DAwMGOMbKzT7MhJ8Maz1jyt1mgfQZmanwIB uqPQ== X-Forwarded-Encrypted: i=1; AJvYcCVmI0bOyani8Whe7rmKiRLPrWj2VO+yNoaWG+DB7wS8/eAptBzxcQ4xEphffS2f9d+66ZSacjGNdxRKOX8=@vger.kernel.org X-Gm-Message-State: AOJu0YwCBmWzHxEg2YZYXoldRnB8GuL/lCxY2piYJoKs4PkyxJufy3hF 6/60TcMBT9Wk4aCJjpO5/zbax/4pZiheJq2ePjaXwPyj1y9uN1FJlPJGZRCMxzLkBnL64aoyclY m+baRSlWEew== X-Google-Smtp-Source: AGHT+IHSVka4J5eAYOjalcWEI2+0Bl25UJzGl73fRn3zliqO43FS2CrU0+33Xsoa30I91krygdj+UOT9DaDG X-Received: from pjbse12.prod.google.com ([2002:a17:90b:518c:b0:2fc:c98:ea47]) (user=irogers job=prod-delivery.src-stubby-dispatcher) by 2002:a17:90b:53ce:b0:313:23ed:6ff with SMTP id 98e67ed59e1d1-313f1ca7758mr19569857a91.1.1750193694031; Tue, 17 Jun 2025 13:54:54 -0700 (PDT) Date: Tue, 17 Jun 2025 13:53:20 -0700 In-Reply-To: <20250617205320.1580946-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: <20250617205320.1580946-1-irogers@google.com> X-Mailer: git-send-email 2.50.0.rc2.701.gf1e915cc24-goog Message-ID: <20250617205320.1580946-4-irogers@google.com> Subject: [PATCH v2 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.rc2.701.gf1e915cc24-goog