From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CAB42CE7A86 for ; Fri, 22 Sep 2023 22:34:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230090AbjIVWem (ORCPT ); Fri, 22 Sep 2023 18:34:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37814 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229544AbjIVWei (ORCPT ); Fri, 22 Sep 2023 18:34:38 -0400 X-Greylist: delayed 520 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Fri, 22 Sep 2023 15:34:32 PDT Received: from out-204.mta0.migadu.com (out-204.mta0.migadu.com [91.218.175.204]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C488AE8 for ; Fri, 22 Sep 2023 15:34:32 -0700 (PDT) Date: Fri, 22 Sep 2023 15:25:34 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1695421545; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=oUtaqf0D4+kd8F29+reRe8AfJZsyK1jKCQl6YrgKT6Q=; b=XXsHEoQvZhTuvaPIpzFnTXFtFyZSYIWNJ+Cl7hv8y6BgBNo0e/dD+zddOiNO3qOcrBVx8o /o9Ww54gkEyKZlaO5Jx1i0s/3ANxs8cABQ4OQFN9jkltEyeilJnLYTPUFF665UmB5QNvFK pwWcQ5htGY1uOBF3am0YTDwgvqNDwnc= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Roman Gushchin To: Kees Cook Cc: Andrew Morton , Shakeel Butt , Johannes Weiner , Michal Hocko , "Matthew Wilcox (Oracle)" , Nathan Chancellor , Nick Desaulniers , Tom Rix , Yosry Ahmed , Yu Zhao , Miaohe Lin , Yafang Shao , Kefeng Wang , Qi Zheng , linux-kernel@vger.kernel.org, llvm@lists.linux.dev, linux-hardening@vger.kernel.org Subject: Re: [PATCH] mm/memcg: Annotate struct mem_cgroup_threshold_ary with __counted_by Message-ID: References: <20230922175327.work.985-kees@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230922175327.work.985-kees@kernel.org> X-Migadu-Flow: FLOW_OUT Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Sep 22, 2023 at 10:53:28AM -0700, Kees Cook wrote: > 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). > > As found with Coccinelle[1], add __counted_by for struct mem_cgroup_threshold_ary. > > [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci > > Cc: Andrew Morton > Cc: Shakeel Butt > Cc: Roman Gushchin > Cc: Johannes Weiner > Cc: Michal Hocko > Cc: "Matthew Wilcox (Oracle)" > Signed-off-by: Kees Cook Acked-by: Roman Gushchin Thanks!