Received: by 2002:a05:6359:6284:b0:131:369:b2a3 with SMTP id se4csp4688874rwb; Tue, 8 Aug 2023 12:08:50 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE5wagrVGip2kqKocdZanWjey1lDdcXjyKWgJCWBZCKBslln+30Zh72B6KhM4g1TjfZ/FYv X-Received: by 2002:a17:906:30d7:b0:99c:47a:8bcd with SMTP id b23-20020a17090630d700b0099c047a8bcdmr403753ejb.67.1691521730485; Tue, 08 Aug 2023 12:08:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691521730; cv=none; d=google.com; s=arc-20160816; b=TQGM8jdJSJfEyWLBvj+kmKKgNg/Hl56P0KrSgcT6NKfctoWz1MJzi1psspJAIu8vJ1 hBQZ+sxvN22O3vWzDp7U/D//z50kX8e9UFsUPve3a76Gpl1u0MIJn6/8KOOeb4weEIEw XKtABjk/OLfHZMISRZa21H9jPGIlfMTXvY2y0iTg/dhFHsGLB3dlvFjIAU8NhPda+iIR ZxLXz6IU5y/mJj9vDiDSSqkRqlpWnCGw9ZzpWmFkmeKWRvi4U0tiLW9f58u0GJMqOK19 Amky/zM1pQCI4w8OWgp9DNmPmV7IxF1CWtyQn02blCyXdg57KHoDinEm4YycOIxE7nLd UA4A== 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 :references:in-reply-to:message-id:subject:cc:to:from:date; bh=xRyUcRpFNwXJNXiljJLpYKDYqsb+FOdjY9WU6xXB6pg=; fh=fcYpLbbOP5GQ4OJDoFk2UFvYE02NpOU29/2mMNxxVtM=; b=pj+Oh94lDt7qrChXa4MqvoGrWkjSDkcPY38/VIt4VyqjpWJ956XZXVJCWfDdxK9uG7 BDUJjJdWvxBjEMUI9AAA7P526GXcXem1nScgVzbD8YnpefV06qIh6BhGIzIhAWpa2TfY Jtvr8F4ox/NYKF76BErdGcoiQVsk/Cf3o9uDurQq/04iwFfsIuYv9TVBQrPoWT9tKDkZ mfvm06PTIXGgO9sWFqCq3cXw4FCALBgOAj3jHi7aoUDuElH8CzWIVP2i8f3vKykRlXXv OL1I7VMvBTGWnI2euhZO64UNNRdguBbdPtS9unitYjKV7BKHtJ+VvUGoPzFiu4zFp4MI LfRQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n5-20020a1709061d0500b00988b90f50b3si5032955ejh.607.2023.08.08.12.08.24; Tue, 08 Aug 2023 12:08:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230073AbjHHSjW (ORCPT + 99 others); Tue, 8 Aug 2023 14:39:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34602 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231928AbjHHSi5 (ORCPT ); Tue, 8 Aug 2023 14:38:57 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3457075868 for ; Tue, 8 Aug 2023 10:20:46 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 83D66618D6 for ; Tue, 8 Aug 2023 17:20:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7D1EDC433C7; Tue, 8 Aug 2023 17:20:32 +0000 (UTC) Date: Tue, 8 Aug 2023 13:20:30 -0400 From: Steven Rostedt To: Sven Schnelle Cc: linux-kernel@vger.kernel.org, Tom Zanussi Subject: Re: BUG: KASAN: slab-out-of-bounds in print_synth_event+0xa68/0xa78 Message-ID: <20230808132030.4ddfc90f@gandalf.local.home> In-Reply-To: References: <20230807215310.068fce2f@gandalf.local.home> <20230808061423.0a12980f@gandalf.local.home> X-Mailer: Claws Mail 3.19.1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-6.7 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_PASS 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: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 08 Aug 2023 16:28:49 +0200 Sven Schnelle wrote: > Steven Rostedt writes: > > >> I think the problem is that the code assigns data_offset with: > >> > >> *(u32 *)&entry->fields[*n_u64] = data_offset; > >> > >> but reads it with: > >> > >> offset = (u32)entry->fields[n_u64]; > >> > >> which works on LE, but not BE. > > > > Ah, that makes sense. I didn't realize (or forgot) that s390 was BE. My > > PowerPC box that was BE died years ago, and I have stopped testing BE ever > > since :-( > > Ok. If you want something for testing BE i could provide you with an > s390 linux image + the commandline to run that within qemu. Linux on > s390 is not much different than other platforms, but you would need an > s390 cross-compiler. That's fine. I have you to test the BE code ;-) > >> diff --git a/kernel/trace/trace_events_synth.c b/kernel/trace/trace_events_synth.c > >> index d6a70aff2410..1f8fe7f2b5b2 100644 > >> --- a/kernel/trace/trace_events_synth.c > >> +++ b/kernel/trace/trace_events_synth.c > >> @@ -125,9 +125,22 @@ static bool synth_event_match(const char *system, const char *event, > >> (!system || strcmp(system, SYNTH_SYSTEM) == 0); > >> } > >> > >> +struct synth_trace_data { > >> + u16 len; > >> + u16 offset; > >> +}; > > > > This is actually common throughout the tracing code (as all dynamic fields > > have this). We should probably make this more generic than just for > > synthetic events. Although, that would probably break BE user space. Hmm, > > we could have it be: > > I'm not familiar with the ftrace code, so I think i would need some more > time to find all the other locations. Therefore i updated the patch to move > the structure declaration to trace.h and sent that as a first step. It's been on my todo list for sometime. Maybe I should just go and do that part. -- Steve