From patchwork Thu Oct 26 11:31:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 158506 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:d641:0:b0:403:3b70:6f57 with SMTP id cy1csp600934vqb; Thu, 26 Oct 2023 04:32:26 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFILZYTOZ+2whAR3iXrvs5Q0x+m6TVtU4s92mdmm7LtS1WLbbLt7Ih4HqGq7+KtP2OqDIrx X-Received: by 2002:a81:b619:0:b0:5a1:d216:8d3 with SMTP id u25-20020a81b619000000b005a1d21608d3mr3850214ywh.5.1698319945831; Thu, 26 Oct 2023 04:32:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698319945; cv=none; d=google.com; s=arc-20160816; b=ipLowEOg0WJQCner1Cyvi9v97U+gprH9x1aG1MXy9TVyT8JbVg70d9GQsVq6nnGhLx +MUI7iOpEW5PcddwwVxTPTe8Gn0WEyb1bcATOjCCmz3FTtERXxb6JLEVdJef/Mun3FAi cC+cFy+9tclnfu30mWqihC+uGe7617jhV5KILZtO4LjX9xA/dU3kMF/opi9L2c9qZVoP wA8remgf18yxV2CyzVVyUDCjQp2zYho+L8w9baT7qf8LTrozJIfB1kDkXGgQd4r1v+fN fQDViXSxXeqPmx10BEZ8c8fE9D5j4Vjzn8iSIy4MAEI8KKw1I8K6diFfcug46vsStlwN tgVg== 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 2620:137:e000::3:4 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 howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id o2-20020a0dfe02000000b0057a2b4cd26asi13918632ywf.132.2023.10.26.04.32.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Oct 2023 04:32:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; 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 2620:137:e000::3:4 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 howler.vger.email (Postfix) with ESMTP id 2B53B80756FD; Thu, 26 Oct 2023 04:32:23 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344794AbjJZLcJ (ORCPT + 26 others); Thu, 26 Oct 2023 07:32:09 -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 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 howler.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 (howler.vger.email [0.0.0.0]); Thu, 26 Oct 2023 04:32:23 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780817535873081893 X-GMAIL-MSGID: 1780817535873081893 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 Acked-by: Brian Cain --- 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