Received: by 2002:a05:7412:a9a2:b0:e2:908c:2ebd with SMTP id o34csp360882rdh; Thu, 26 Oct 2023 04:32:27 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEqDUmWx4mL/Zt5UHj1sr0ceUFLIP2EO/EW7xKvyflrvXz1MZ5kIBmI4kiEaRaSDCwEU2fK X-Received: by 2002:a25:6804:0:b0:d9c:f811:eb6b with SMTP id d4-20020a256804000000b00d9cf811eb6bmr4214554ybc.0.1698319947022; Thu, 26 Oct 2023 04:32:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698319947; cv=none; d=google.com; s=arc-20160816; b=0hnKL/z7YD/WcgnAySXVYUkMYHKIiWWqhGMG5XoJ+BJ/VAKxCd0UkHp6NnbL3mDqEH yiogG2tohO4WUccm+fAci3s9q+w/eJpCo9llGU8CU4VK9GAD1P5hBGGGMKkQcu3GkLqI adzwp6SpSz3hupKGa/kjsAbLsvmrIzKVIcpmMw8bvnlQde+RnaeBfigRX9qB6F4yfy51 p29gbIftfIjJL6sHsIRznEUOXTcZBNZndwfCeIPCnVqopT2qtQrxD1s7/QMftJNT9iRH 2wZFnspzsrl8sCho1ETQYdO39v77JV08ce456Ew8N5Be5h9ANWO4tROXGLcTNjbfyH+P 7IGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=nJbwl958YvMAt8AOX88IKj5/m57DLKb+0w4F53bET/o=; fh=Y7d7sy9z2NiblHaDmx1WPiclBp/GTA6mFyFbtnr2f0U=; b=lBd4lIekCQdLeGO4Xs9LIWsnww1dibiDEBusOip41S/UKMEag7OMNEP2OUsfAuuijN 79Teg1dD4lAbgXefGWL9ojimDDqgfLkunVYVa7wENb4x8QaQWMwjh5/YDliY2XYR+qhd 8QarY5c/U3cI1Ec2LKcLOFjCpWiKaHEtwmXrR2Jyt/HPFBsgCPGLYr0ZpMSdpiJTYUB+ m34Rlz1s/fdoFJAW1gA/ezakoiLYKqyRxy1QCKVbQAVu0TspCkKZc9NSUXIIi8hmdEGF weqAi0lrVygKmlLqQFXLx79uPF1XNOSjZccBB3Ob0BKyRpfLDWRy3AdL12RepvvHHqIP OINw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=PHgjGQ0i; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id t34-20020a252d22000000b00d9111959e93si13683336ybt.497.2023.10.26.04.32.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Oct 2023 04:32:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=PHgjGQ0i; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id E1E01802689C; Thu, 26 Oct 2023 04:32:22 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344788AbjJZLcI (ORCPT + 99 others); Thu, 26 Oct 2023 07:32:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47276 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229649AbjJZLcH (ORCPT ); Thu, 26 Oct 2023 07:32:07 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 12E771AA for ; Thu, 26 Oct 2023 04:31:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1698319885; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=nJbwl958YvMAt8AOX88IKj5/m57DLKb+0w4F53bET/o=; b=PHgjGQ0iqi2dXNgSlS0fxYzk5/fRqKBWyItO8WgcFayp1ncO65KDkUSPIswy584MaGktvZ w45oCjo+HVYUqQQqfkQc7fQ4sf+/WD1M6lu36dUwhzn9yaxxkWcQQGn+yMvax7uZpuI9J1 pYgmR/kiJM4oAML/KYdgj7Sn01+z1Ps= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-382-wxelN0EVNUeqOSyCIXCWMw-1; Thu, 26 Oct 2023 07:31:17 -0400 X-MC-Unique: wxelN0EVNUeqOSyCIXCWMw-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id DAC53811E7B; Thu, 26 Oct 2023 11:31:16 +0000 (UTC) Received: from thuth-p1g4.redhat.com (unknown [10.39.195.56]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9DB75492BE7; Thu, 26 Oct 2023 11:31:15 +0000 (UTC) From: Thomas Huth To: Arnd Bergmann , linux-hexagon@vger.kernel.org, bcain@quicinc.com Cc: linux-kernel@vger.kernel.org, Oleg Nesterov Subject: [PATCH] hexagon: Remove CONFIG_HEXAGON_ARCH_VERSION from uapi header Date: Thu, 26 Oct 2023 13:31:14 +0200 Message-ID: <20231026113114.195854-1-thuth@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.9 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Thu, 26 Oct 2023 04:32:23 -0700 (PDT) uapi headers should not expose CONFIG switches since they are not available in userspace. Fix it in arch/hexagon/include/uapi/asm/user.h by always defining the cs0 and cs1 entries instead of pad values. Suggested-by: Arnd Bergmann Signed-off-by: Thomas Huth --- Based-on: <20231025073802.117625-1-thuth@redhat.com> Compile tested only (with CONFIG_HEXAGON_ARCH_VERSION set to 2 and with CONFIG_HEXAGON_ARCH_VERSION set to 4) arch/hexagon/include/uapi/asm/user.h | 7 +------ arch/hexagon/kernel/ptrace.c | 7 +++++-- scripts/headers_install.sh | 1 - 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/arch/hexagon/include/uapi/asm/user.h b/arch/hexagon/include/uapi/asm/user.h index 7327ec59b22f..abae6a4b5813 100644 --- a/arch/hexagon/include/uapi/asm/user.h +++ b/arch/hexagon/include/uapi/asm/user.h @@ -56,15 +56,10 @@ struct user_regs_struct { unsigned long pc; unsigned long cause; unsigned long badva; -#if CONFIG_HEXAGON_ARCH_VERSION < 4 - unsigned long pad1; /* pad out to 48 words total */ - unsigned long pad2; /* pad out to 48 words total */ - unsigned long pad3; /* pad out to 48 words total */ -#else + /* cs0 and cs1 are only available with HEXAGON_ARCH_VERSION >= 4 */ unsigned long cs0; unsigned long cs1; unsigned long pad1; /* pad out to 48 words total */ -#endif }; #endif diff --git a/arch/hexagon/kernel/ptrace.c b/arch/hexagon/kernel/ptrace.c index 125f19995b76..905b06790ab7 100644 --- a/arch/hexagon/kernel/ptrace.c +++ b/arch/hexagon/kernel/ptrace.c @@ -74,7 +74,7 @@ static int genregs_set(struct task_struct *target, unsigned int pos, unsigned int count, const void *kbuf, const void __user *ubuf) { - int ret; + int ret, ignore_offset; unsigned long bucket; struct pt_regs *regs = task_pt_regs(target); @@ -111,12 +111,15 @@ static int genregs_set(struct task_struct *target, #if CONFIG_HEXAGON_ARCH_VERSION >=4 INEXT(®s->cs0, cs0); INEXT(®s->cs1, cs1); + ignore_offset = offsetof(struct user_regs_struct, pad1); +#else + ignore_offset = offsetof(struct user_regs_struct, cs0); #endif /* Ignore the rest, if needed */ if (!ret) user_regset_copyin_ignore(&pos, &count, &kbuf, &ubuf, - offsetof(struct user_regs_struct, pad1), -1); + ignore_offset, -1); else return ret; diff --git a/scripts/headers_install.sh b/scripts/headers_install.sh index c3064ac31003..f7d9b114de8f 100755 --- a/scripts/headers_install.sh +++ b/scripts/headers_install.sh @@ -74,7 +74,6 @@ arch/arc/include/uapi/asm/page.h:CONFIG_ARC_PAGE_SIZE_16K arch/arc/include/uapi/asm/page.h:CONFIG_ARC_PAGE_SIZE_4K arch/arc/include/uapi/asm/swab.h:CONFIG_ARC_HAS_SWAPE arch/arm/include/uapi/asm/ptrace.h:CONFIG_CPU_ENDIAN_BE8 -arch/hexagon/include/uapi/asm/user.h:CONFIG_HEXAGON_ARCH_VERSION arch/m68k/include/uapi/asm/ptrace.h:CONFIG_COLDFIRE arch/nios2/include/uapi/asm/swab.h:CONFIG_NIOS2_CI_SWAB_NO arch/nios2/include/uapi/asm/swab.h:CONFIG_NIOS2_CI_SWAB_SUPPORT -- 2.41.0