From patchwork Sun Sep 24 10:40:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tip-bot2 for Thomas Gleixner X-Patchwork-Id: 144089 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:cae8:0:b0:403:3b70:6f57 with SMTP id r8csp671157vqu; Sun, 24 Sep 2023 06:45:26 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFPpQMHECIVKeVaaz6i95aBRJtWTPHqYScw3g2i7PPToGDi9Oc1v2Rpf1b214FBdYy5jjmZ X-Received: by 2002:a17:902:d4c4:b0:1b8:af5e:853c with SMTP id o4-20020a170902d4c400b001b8af5e853cmr7618218plg.26.1695563126347; Sun, 24 Sep 2023 06:45:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695563126; cv=none; d=google.com; s=arc-20160816; b=V5YDneeE1UC0Gy/0/lEfcZzBCgdVphAto3eeS/rvijNybrS3sjaXAY26Lf7nubBSxV T+26CNwRI8q3jPfXcHJOGA18f/d/++PT/lnz/kF2eUw/YS0ioPa0Hgf+z3JqowF9VkmH F9klYbHiCoySU7CQqWqpLSWEVTPLJJ6SmdGS0O6bKcBAaa+wTWzNc89/8wix/qv1mpH2 8ZGqHemYB6bgEbntTSIp2NFwxeKRZGrODM/4D2T5HLtEDdeZwNB0hEnAu/cDputv3z4k F9hlKdkruh3YV7KpIpd7TD9FAxgFu8gv9gKQDWjH/+XMONgZgyqIUZxjdS0fTIY+IMI1 V7qg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=fT6iTXbOHGfCjfaGt+1WCThYSn0gcCFJToGGpaQ5K74=; fh=yiWHAZDJiVufVm+SQRQdUs1S+qWh2QVPsdwpUIYQGgo=; b=gP+udtZoapHvo1CVmbKbJazCzsGBgI0VKotPiyvbnnSXfVbY4fsafpZS5jMwjrfBfG /fTBg9HmGQiuGyrrxYgJsPIMcgHuHUIqacUIlzcWtfPV32sQaLQOTtNAEdo4XByfF3ha 8gicCJbYa3hEXoTvsToWO9M762tWWRIjLFyRhjmkeAEYR/hnrAid73RJTiTdoFo2qlP7 Z/JnC51axq3X7pt2FuSO0EfbdwSX67lK7CpyF4q9PRVoXfZLvKImYjpMEL4wH9WapK3W HxARms+i5MwhS4m3MO5eH2TCrZp+zog1B/jEwnOMPXxorWDCBZKIwaW7HWoVSRYCOEq8 wA0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=G0LbBYFV; dkim=neutral (no key) header.i=@linutronix.de header.b=A3xfMTfx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id l9-20020a170902f68900b001b8a56b9895si7548906plg.616.2023.09.24.06.45.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Sep 2023 06:45:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=G0LbBYFV; dkim=neutral (no key) header.i=@linutronix.de header.b=A3xfMTfx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 807D08087FF9; Sun, 24 Sep 2023 03:41:10 -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 S229940AbjIXKkX (ORCPT + 30 others); Sun, 24 Sep 2023 06:40:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53104 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229646AbjIXKkW (ORCPT ); Sun, 24 Sep 2023 06:40:22 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7C015100; Sun, 24 Sep 2023 03:40:16 -0700 (PDT) Date: Sun, 24 Sep 2023 10:40:14 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1695552015; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=fT6iTXbOHGfCjfaGt+1WCThYSn0gcCFJToGGpaQ5K74=; b=G0LbBYFVICUFsrdU5v+tbadO9WEMUZVMcXarsZ2ud9VTSfBiHE8YDO4hoD3RSEXS2/+FAq vgAMNjfGbQGawNYSncCeM3QnS9oL4TKFbURG7cS3bKY1YW1gQNuPWn0gUofAIh3L4C6Yah iM3kjbeMvYrUHntsFFPNs8jvn9qiBh4cvG9xVC3+UGgHFaxYUWPjyXB63BM6t7UseFtHK8 Du170ptkRYYDhXtstRxrAdY/NPgpIq67YuC7WoD4u7E2dWBHMxrlY9Qea8+bYD+juTfF3l vJ34+C7XOFKAV030KrayHK6Mbh04OjdtHL7Perp8aAmJMe118rYziagBUMBqEQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1695552015; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=fT6iTXbOHGfCjfaGt+1WCThYSn0gcCFJToGGpaQ5K74=; b=A3xfMTfxE+VcZK5OQ4LUUOA1JEKZ+kQDmj352wo0zdzH1RZxohl65Rc6xuMUbzITC+E4rh GaKcRXTyCHcY+pCg== From: "tip-bot2 for Kees Cook" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/platform] x86/platform/uv: Annotate struct uv_rtc_timer_head with __counted_by Cc: Kees Cook , Ingo Molnar , "Gustavo A. R. Silva" , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20230922175151.work.118-kees@kernel.org> References: <20230922175151.work.118-kees@kernel.org> MIME-Version: 1.0 Message-ID: <169555201447.27769.7624440543285631039.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails X-Spam-Status: No, score=-0.9 required=5.0 tests=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]); Sun, 24 Sep 2023 03:41:10 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777790729411186086 X-GMAIL-MSGID: 1777926801127331274 The following commit has been merged into the x86/platform branch of tip: Commit-ID: d9a01959d9c954c8fe1d132b52401b0e219e37f6 Gitweb: https://git.kernel.org/tip/d9a01959d9c954c8fe1d132b52401b0e219e37f6 Author: Kees Cook AuthorDate: Fri, 22 Sep 2023 10:51:51 -07:00 Committer: Ingo Molnar CommitterDate: Sun, 24 Sep 2023 12:02:58 +02:00 x86/platform/uv: Annotate struct uv_rtc_timer_head with __counted_by Prepare for the coming implementation by GCC and Clang of the __counted_by attribute. Flexible array members annotated with __counted_by can have their accesses bounds-checked at run-time checking via CONFIG_UBSAN_BOUNDS (for array indexing) and CONFIG_FORTIFY_SOURCE (for strcpy/memcpy-family functions). Found with Coccinelle: https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci Add __counted_by for struct uv_rtc_timer_head. Signed-off-by: Kees Cook Signed-off-by: Ingo Molnar Reviewed-by: Gustavo A. R. Silva Link: https://lore.kernel.org/r/20230922175151.work.118-kees@kernel.org --- arch/x86/platform/uv/uv_time.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/platform/uv/uv_time.c b/arch/x86/platform/uv/uv_time.c index 54663f3..ff5afc8 100644 --- a/arch/x86/platform/uv/uv_time.c +++ b/arch/x86/platform/uv/uv_time.c @@ -53,7 +53,7 @@ struct uv_rtc_timer_head { struct { int lcpu; /* systemwide logical cpu number */ u64 expires; /* next timer expiration for this cpu */ - } cpu[]; + } cpu[] __counted_by(ncpus); }; /*