Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1148899pxa; Thu, 13 Aug 2020 01:37:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy0R1YnqGHt1UEsB4lfSrYOQLow9VKOZ+QFNnti/swLxI6QdskCEHdUdA/zMDwJ47wjRlyB X-Received: by 2002:a05:6402:847:: with SMTP id b7mr3773365edz.39.1597307834190; Thu, 13 Aug 2020 01:37:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597307834; cv=none; d=google.com; s=arc-20160816; b=HbfAZLzgxmkvSIxt40reDq3aAarzg/rMnT6HhqYUbzBIe72a9kh6kuUOkqAD7Z5Hr7 7kktFpaxzJwF5M9McmT1dVG9DbDFzxsw3GG8/8nHZOiIT1SPbBs0Z7PNA7kD1vOD5soe /r0VJguBprzA54fbYIHnfGhnnnpaCuJYWw2+FbLCXh4sGFVWCnteOTFvDt8xgRPs6huI Pf6kEniyMfgSFoKeRVKcaLDZ6D/xcVaDh2zYyn2eK01M00TGyR0x1gKZK0+7NoVYZXJQ d2js/2+HeqjkqYIVbSvkU+qBkcYhitr1/oWGGJKBqcNlorSxBshPqdjal4dBPnGE5Mxd lXJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=WON/ejwuAOLIRcklKfzFj37axQddakk+egj2VgauEew=; b=rVS+U1SSFOatgk8Vfxc44IcFbvSfTTI9E9ZgdVDWImHzRV/V4i2pP+s9lRzDdQ5sjw Yzh2OXfysl5OMN5haHBlJjckk4mE6mC7jCBiTXcrhzJHnoNCqhCZmncTRZSGfCyP7DfV kQcGLC3afK3hktxy9vn/a7J349HOnNQJthz4QqF5jyn9yWACRlbhFa85xOjWWPzYflIs DEKDH4r0g/76a6i1Rq0/XyI88o8T1zimo8ORulx1Rjja83hn4MCMCYKab+mr96ZTh+sx rgBom7S7OWoQ2SvD6dprhtctlPkfa7NstgD9riEf2PcYz6Nfq4TSfrua34k4kxPjTOsW o4BA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=tBee+0gR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v18si2901087ejj.270.2020.08.13.01.36.50; Thu, 13 Aug 2020 01:37:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=tBee+0gR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726102AbgHMIgS (ORCPT + 99 others); Thu, 13 Aug 2020 04:36:18 -0400 Received: from mail.kernel.org ([198.145.29.99]:46710 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726048AbgHMIgR (ORCPT ); Thu, 13 Aug 2020 04:36:17 -0400 Received: from mail-ot1-f52.google.com (mail-ot1-f52.google.com [209.85.210.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 1738A20791 for ; Thu, 13 Aug 2020 08:36:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597307777; bh=WON/ejwuAOLIRcklKfzFj37axQddakk+egj2VgauEew=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=tBee+0gRDN8Wq12sUz7+NT+sK7KI2Woi8vFFwv/fzfdL/zbvXuGsYS8vSk6GDVdNJ JEC+kh+XmnhB9IznM3LjDH9afosqd5p12xj9aPV/aAR2InY7uv5sYPcarQaHI5REoU BS6+bBo7+hsxSwt/c/otU9JtxyjVzxLw7jj3RFyo= Received: by mail-ot1-f52.google.com with SMTP id 93so4197252otx.2 for ; Thu, 13 Aug 2020 01:36:17 -0700 (PDT) X-Gm-Message-State: AOAM530ozlSy0oDpxcbait6OT7mPs0wIhLJGNqrucorwAFdLZCTj/eBB cqr877mzeLEc7IvQj55cfwvChAVDuu59Mv73aVE= X-Received: by 2002:a9d:6251:: with SMTP id i17mr3148788otk.90.1597307776442; Thu, 13 Aug 2020 01:36:16 -0700 (PDT) MIME-Version: 1.0 References: <20200811163427.6edbf343@coco.lan> <20200811145524.GE2674@hirez.programming.kicks-ass.net> <20200811172738.2d632a09@coco.lan> <20200811160134.GA13652@linux-8ccs> <20200812104005.GN2674@hirez.programming.kicks-ass.net> <20200812125645.GA8675@willie-the-truck> <20200812141557.GQ14398@arm.com> <20200812160017.GA30302@linux-8ccs> <20200812200019.GY3982@worktop.programming.kicks-ass.net> In-Reply-To: <20200812200019.GY3982@worktop.programming.kicks-ass.net> From: Ard Biesheuvel Date: Thu, 13 Aug 2020 10:36:05 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2] module: Harden STRICT_MODULE_RWX To: Peter Zijlstra Cc: Jessica Yu , Szabolcs Nagy , Will Deacon , Mauro Carvalho Chehab , Linux Kernel Mailing List , Thomas Gleixner , Kees Cook , Josh Poimboeuf , Miroslav Benes , Mark Rutland , nd Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 12 Aug 2020 at 22:00, Peter Zijlstra wrote: > > On Wed, Aug 12, 2020 at 06:37:57PM +0200, Ard Biesheuvel wrote: > > I know there is little we can do at this point, apart from ignoring > > the permissions - perhaps we should just defer the w^x check until > > after calling module_frob_arch_sections()? > > My earlier suggestion was to ignore it for 0-sized sections. Only they are 1 byte sections in this case. We override the sh_type and sh_flags explicitly for these sections at module load time, so deferring the check seems like a reasonable alternative to me.