Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp595705pxb; Thu, 21 Apr 2022 06:31:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwaVtjauaQzW34TECyM95ZX+MFnhSRDIkGG5/SdIHPuuXOTYqqmvAxR7mTlnyuiixfXOXb9 X-Received: by 2002:a17:906:3c10:b0:6e8:9e25:5156 with SMTP id h16-20020a1709063c1000b006e89e255156mr23617718ejg.703.1650547909341; Thu, 21 Apr 2022 06:31:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650547909; cv=none; d=google.com; s=arc-20160816; b=XP1AT4lF0IZpxWr5TeLwVCi9kCNpg9cCfw4+KYOCFSK3LofAjXl9lo6iHbPA8fNfKu Z3kqdARGlYtP1XUCg6pFUrGn0ZOINF9u6DC7D8+T2Y9HZCOOBn25uieIy/3kLCNOMcl9 ryfIHdcuvZfAx6QCJBmPBj0efYD2wkkgDTLqahLVH2gDvGA5HIEp6wbSfoMq39zucxx5 xaE3dehKIQ7V2D/NTFKj0Bpvxc7fkL5FGYghObZEYLsO/TIISBphlc69SXvJyZE7GjN0 R+SjPvb8mz1UqbHORsKy0yyW382L28ilK6vU4WvHMOPSQLeOBqtwWxSk9SDCDQvXW+ix nQJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=1syVurlPdZtVxfD77EA07da6Q0rSSJ2SEOZ9IIvMxUw=; b=xjkrqZUEsatNGtTDnQwHl+By4CxW4lwXRvO9ya7WQZedVQmzWSxFQ+YsyeARFoxIC9 pvKYZhSMiZ1/IhJeRy+9QDSUzQz9fYIjcCajtjiSOgo98CN1q5WMmyiwqXob56NhK7kH L779QqgCz2b9OfHcF1e2qD8MrGiiMKv7sPVUAx2nWMqq3rxg1/wV2ziszJ+jdJh7ZcPV sdNw6Pw3bt0jC0S3YalpDyRV00B/E5jIEN+BCF4dT4aZubQRzJYl9rXCq0vnuW3LrCVL KRBIN3q3xSOVgnBrh9FCb7xWANxTyyH0yUx97fJyQJaGqDS/UsSR7lkgbzjHu6zR9EnI y+/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=TGBBcj36; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id rh24-20020a17090720f800b006ef57f5e94esi4009696ejb.1006.2022.04.21.06.31.24; Thu, 21 Apr 2022 06:31:49 -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; dkim=pass header.i=@chromium.org header.s=google header.b=TGBBcj36; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1358979AbiDTCsE (ORCPT + 99 others); Tue, 19 Apr 2022 22:48:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41570 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239192AbiDTCsD (ORCPT ); Tue, 19 Apr 2022 22:48:03 -0400 Received: from mail-pj1-x1029.google.com (mail-pj1-x1029.google.com [IPv6:2607:f8b0:4864:20::1029]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0C01725284 for ; Tue, 19 Apr 2022 19:45:18 -0700 (PDT) Received: by mail-pj1-x1029.google.com with SMTP id md20-20020a17090b23d400b001cb70ef790dso3683880pjb.5 for ; Tue, 19 Apr 2022 19:45:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=1syVurlPdZtVxfD77EA07da6Q0rSSJ2SEOZ9IIvMxUw=; b=TGBBcj36GCla9UWEXP4zSj1zN0lOz5f2ul/fVLRyFgR+Vmtff+G7616OT5lwErhECF 9l49f5c5cC6fMMAfxNJcj0Bb8iXOIzz6GM+mMs2I7aEAwJCy25tk/uj4wogq/zPS9Qgq 2cK93xOr7di3AU/YzmT6A8NyM/aHbOBD2bq2k= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=1syVurlPdZtVxfD77EA07da6Q0rSSJ2SEOZ9IIvMxUw=; b=T1OS3Dig8V3IMcNwIYdukXPS1tGY2hOwnwByLIWgizyaz3AfOQncjD9kNy87Ic/zTK 05JlLJktTPlR80AOrcMCLr/0NdrnhDKNEduURcMw0YoO14b+fqHAaaDRte5QABI5I+Td a+SReysvC0GUaIlDCzAnaTOIR5MwyPj0WrkI0k569fntA3C3kvaLRHEsUbeNTgL1m67y V5hwI/9pOXPnYl4CYatGo23MzJ5ff1IvjYy57Q2LARtWq70uBDoOWgzUWWtkJ9RGWpHE uDely52ZWQXiHGAw7IpaYOA89trSkiHv8eF5+j3UUqtoGNTJY9g4hqihuZKJ329AlyWB /G/A== X-Gm-Message-State: AOAM533vmN+1vcxBprVj96TuWk97xJZIhsbyhKE2TnPIGVybc+DzoG7T 7MeT2xpyDzigoorFv8x4qTSSRw== X-Received: by 2002:a17:90a:31cb:b0:1d2:8998:61f9 with SMTP id j11-20020a17090a31cb00b001d2899861f9mr1854240pjf.186.1650422717621; Tue, 19 Apr 2022 19:45:17 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id n3-20020a056a000d4300b0050ac8dbfd0csm745637pfv.163.2022.04.19.19.45.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Apr 2022 19:45:17 -0700 (PDT) Date: Tue, 19 Apr 2022 19:45:16 -0700 From: Kees Cook To: joao@overdrivepizza.com Cc: linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org, peterz@infradead.org, jpoimboe@redhat.com, andrew.cooper3@citrix.com, samitolvanen@google.com, mark.rutland@arm.com, hjl.tools@gmail.com, alyssa.milburn@linux.intel.com, ndesaulniers@google.com, gabriel.gomes@linux.intel.com, rick.p.edgecombe@intel.com Subject: Re: [RFC PATCH 10/11] linux/interrupt: Fix prototype matching property Message-ID: <202204191942.3C273AB@keescook> References: <20220420004241.2093-1-joao@overdrivepizza.com> <20220420004241.2093-11-joao@overdrivepizza.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220420004241.2093-11-joao@overdrivepizza.com> X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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, Apr 19, 2022 at 05:42:40PM -0700, joao@overdrivepizza.com wrote: > Unions will make function pointers with different prototypes be used through > the same call. This leads into the same call instruction being used for > calling functions with different prototypes, making them unsuitable for > prototype-based fine-grained CFI. Why? Shouldn't the callers be using different prototypes? > Fix this CFI policy violation by removing the function pointer union in > the tasklet struct. The good news is that tasklet is on the way out the door[1], so this may quickly become a non-issue, but also to that end, this fix is hardly a problem for a deprecated API... -Kees [1] https://lore.kernel.org/linux-hardening/20220419211658.11403-1-apais@linux.microsoft.com/ > > Signed-off-by: Joao Moreira > --- > include/linux/interrupt.h | 6 ++---- > 1 file changed, 2 insertions(+), 4 deletions(-) > > diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h > index f40754caaefa..8d5504b0f20b 100644 > --- a/include/linux/interrupt.h > +++ b/include/linux/interrupt.h > @@ -650,10 +650,8 @@ struct tasklet_struct > unsigned long state; > atomic_t count; > bool use_callback; > - union { > - void (*func)(unsigned long data); > - void (*callback)(struct tasklet_struct *t); > - }; > + void (*func)(unsigned long data); > + void (*callback)(struct tasklet_struct *t); > unsigned long data; > }; > > -- > 2.35.1 > -- Kees Cook