Message ID | 20230925230829.341-1-beaub@linux.microsoft.com |
---|---|
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:cae8:0:b0:403:3b70:6f57 with SMTP id r8csp1580870vqu; Mon, 25 Sep 2023 17:29:30 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE3Tppzb7PQyx5uNABURrd0Mnuwj/VxMqSRE9H+HHQdGfeppkJQfjbvDsgfn0m6eehYQTzs X-Received: by 2002:a05:6a20:9499:b0:13b:a2c9:922e with SMTP id hs25-20020a056a20949900b0013ba2c9922emr5603900pzb.27.1695688169979; Mon, 25 Sep 2023 17:29:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695688169; cv=none; d=google.com; s=arc-20160816; b=WdjBGHQ+oYQ6j2yBB2BNt3iIM+gYmf3LHX7avRDLApRNBwNz6pxvQc/vn8F04zusgB jBzmQOj9wqQluZmDJ7RF73oj4NLLQSpAkAP26cnb3mqFAUOYpAL3sOEyKH18IvQ6oB24 089XbaonC5k9nl5H+LwV6ILyOH4I3Ds4cybLxKeHuQeTpnE+yEafJuGCbJptwcauEEy9 7Dv0tuw6LZu7Pf7U8h9zM8PWkoyDBNdMIt2AuSUMm1njxetrpKKMZzUqAqhf10TOEQbh bVX8HaKw4hVqaKtBF3iPk8Gi8YhptSqMvC1e10/mFyNIAu0qh/EB+RaQw/hgC35EzLXw MpEw== 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:dkim-filter; bh=WGDr+0JsXreUEVyfzTBHxnHOYS93XAqsVjTMSDqYl4w=; fh=cnVkuVrG/TdFI46uycxh/TNno8+tW8fsC0qurRWz87Y=; b=0VtNK0dmadZrBCOGgXp+Q/DgcWxFWxgBmI0yVStBjSxayUOLATaP/o74r5uvODl58I 18l6taCUnmFmjPXkqI/K4+csn94tJpfw1faGdOia58RNNOKwP2UpoKvnqNnWD2umsqRU PhZNXdW0UNh0AKCwvFp35xvUv6SPKAIV8R54aNtMtKX55pcW8PDiPabfTFAh6BMetpdX huvkNYUPPnby1Ed/Quq5YKHivtkT1UV3LS6dnThCnFl1etzqj9TGvUUio5PHMqVzhGyy Bjm9GRobhy6/qRszKeR3EnhIBo1VcQcTo1ZDSs1OhjLoIlxLrG4hkZ+SySjXa3NtOHcc xkbA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=Fdv3QOue; 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=linux.microsoft.com Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id cu8-20020a17090afa8800b0026b31ed4895si13536481pjb.29.2023.09.25.17.29.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Sep 2023 17:29:29 -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=@linux.microsoft.com header.s=default header.b=Fdv3QOue; 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=linux.microsoft.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 6E64680934BD; Mon, 25 Sep 2023 16:08:43 -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 S233405AbjIYXIn (ORCPT <rfc822;chrisfriedt@gmail.com> + 28 others); Mon, 25 Sep 2023 19:08:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46302 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229811AbjIYXIl (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 25 Sep 2023 19:08:41 -0400 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 1E643101; Mon, 25 Sep 2023 16:08:35 -0700 (PDT) Received: from localhost.localdomain (unknown [4.155.48.113]) by linux.microsoft.com (Postfix) with ESMTPSA id 82132212C81C; Mon, 25 Sep 2023 16:08:34 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 82132212C81C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1695683314; bh=WGDr+0JsXreUEVyfzTBHxnHOYS93XAqsVjTMSDqYl4w=; h=From:To:Cc:Subject:Date:From; b=Fdv3QOueUxSXZd/3+0t9KbsGME99vaUuIjsVeI2PRhTYK6pO+CPO5Inx0dvnud7Yq NXZmQ6jwfqPx4cq04uKVAxktDWUj6YA7rp7BTYhoqzOqEwKkl1F4Bx3FjFmckhFN0b ZyeypgHF8a/9pBEIjWXM3ow1o92ndIdNp730coIs= From: Beau Belgrave <beaub@linux.microsoft.com> To: rostedt@goodmis.org, mhiramat@kernel.org Cc: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, cleger@rivosinc.com, linux-kselftest@vger.kernel.org Subject: [PATCH 0/2] tracing/user_events: Fix alignment issues for 32 on 64-bit and BE Date: Mon, 25 Sep 2023 23:08:27 +0000 Message-Id: <20230925230829.341-1-beaub@linux.microsoft.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-17.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_PASS,SPF_PASS,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> 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]); Mon, 25 Sep 2023 16:08:43 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778057918363408036 X-GMAIL-MSGID: 1778057918363408036 |
Series |
tracing/user_events: Fix alignment issues for 32 on 64-bit and BE
|
|
Message
Beau Belgrave
Sept. 25, 2023, 11:08 p.m. UTC
All architectures should use a long aligned address passed to set_bit(). User processes can pass either a 32-bit or 64-bit sized value to be updated when tracing is enabled when on a 64-bit kernel. Both cases are ensured to be naturally aligned, however, that is not enough. The address must be long aligned without affecting checks on the value within the user process which require different adjustments for the bit for little and big endian CPUs. 32 bit on 64 bit, even when properly long aligned, still require a 32 bit offset to be done for BE. Due to this, it cannot be easily put into a generic method. The abi_test also used a long, which broke the test on 64-bit BE machines. The change simply uses an int for 32-bit value checks and a long when on 64-bit kernels for 64-bit specific checks. I've run these changes and self tests for user_events on ppc64 BE, x86_64 LE, and aarch64 LE. It'd be great to test this also on RISC-V, but I do not have one. Clément Léger originally put a patch together for the alignment issue, but we uncovered more issues as we went further into the problem. Clément felt my version was better [1] so I am sending this series out that addresses the selftest, BE bit offset, and the alignment issue. 1. https://lore.kernel.org/linux-trace-kernel/713f4916-00ff-4a24-82d1-72884500a2d3@rivosinc.com/ Beau Belgrave (2): tracing/user_events: Align set_bit() address for all archs selftests/user_events: Fix abi_test for BE archs kernel/trace/trace_events_user.c | 58 ++++++++++++++++--- .../testing/selftests/user_events/abi_test.c | 16 ++--- 2 files changed, 60 insertions(+), 14 deletions(-) base-commit: fc1653abba0d554aad80224e51bcad42b09895ed