Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp4164532pxa; Mon, 10 Aug 2020 02:26:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyKxdYmeZXdk7fn3yBr842Kc2ydLy4oOFu572yW5No2nSbrgpX6PM3IAK9pK5hq1BsIk9Kx X-Received: by 2002:a05:6402:456:: with SMTP id p22mr19573488edw.177.1597051608993; Mon, 10 Aug 2020 02:26:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597051608; cv=none; d=google.com; s=arc-20160816; b=0ON9ZYHN/wx8ECG+gwdC0L4cpBHvL7+b88OP1vg+TGvzbafsZ8QZ7Ckcrg07+nRw/H XMaHVVzZYOk3tSSXARSwZmZw//tnvm8hGxV92P9Lm1EiHLptp04In06ynMclxJTIMTHA +H4GOMNPQDt3xuSnooTh6KeDeoqULyJ9N3aI2JdSSi0CE8IaoGKRVHzmKRcgApzpLZb9 1GS/Gbmg/3aihJIrIIeyihi1/S67TYnWLbCCIKoqBJSjQZnmjsK/H42lwBl4APnjy9Y1 e/d0l4bQay5boaIQvh41Y8LcA+lG4Gt+pZfrAq8mL1UbAuNswAGk7pN91NN6peliOyjL iV0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=o0Jm5T73NxdKZ8JVifqnwBnk1Fc+ZKyhG5TVD0Jg280=; b=HSrbMw1tUOHv5mQ2wp175BoY9i7TofJZkvza5CI4Nso9m2W6DU+BiPNNpinUnY+BrK w0+RNGCc4B7d5ubl4Hjx+x4bOoFAJ+T6bslOsbYpczDvXm2m2edsTT2U3pkToqYvNHS4 /twxuSy0pzgJrZVfFH0FbqTPN2qnwAz+9Ai/F1agl4w9T9+9FMGZpkbC2FCFt2tUf+M/ dj8O1/4vtkVuXEBFNcHO4HsjCitF8rnq2V1iDbStqZXbmTvaJEajsoYQz9iCCszD8FaM S7VJI+hcHFfOE+4j9tfHIIh9BF/8fxvvLNKI8H9d6B6xSu9N/qIRVju+E4DAoSVdoDDQ V6wA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Bhn8xKcr; 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 cz8si10078792edb.455.2020.08.10.02.26.26; Mon, 10 Aug 2020 02:26:48 -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=Bhn8xKcr; 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 S1726688AbgHJJZ3 (ORCPT + 99 others); Mon, 10 Aug 2020 05:25:29 -0400 Received: from mail.kernel.org ([198.145.29.99]:38050 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725846AbgHJJZ2 (ORCPT ); Mon, 10 Aug 2020 05:25:28 -0400 Received: from linux-8ccs (p57a236d4.dip0.t-ipconnect.de [87.162.54.212]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B385020709; Mon, 10 Aug 2020 09:25:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597051528; bh=hCWECxFulMLwx8A0QXoIH8ZqwiSK3iOXC6sfqduEbWQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Bhn8xKcrtJdNa0bXWMuLr2Op5DtNK695AGw2c3S/pEKU0OqAwwZPV6EnxjssOG5du J4YOikaRuyj2U/dBtc1ZdlqvfIg7xt9/haoz5NzjohEd5LiBwC0GFtLMo9+zh4dkSg xLc5D1H0LCMM7doOq46I3OI4IEtvVN8x3+Lfoqpk= Date: Mon, 10 Aug 2020 11:25:23 +0200 From: Jessica Yu To: Mauro Carvalho Chehab , h@linux-8ccs Cc: Peter Zijlstra , linux-kernel@vger.kernel.org, Thomas Gleixner , keescook@chromium.org, Josh Poimboeuf , Miroslav Benes Subject: Re: [PATCH v2] module: Harden STRICT_MODULE_RWX Message-ID: <20200810092523.GA8612@linux-8ccs> References: <20200403171303.GK20760@hirez.programming.kicks-ass.net> <20200808101222.5103093e@coco.lan> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <20200808101222.5103093e@coco.lan> X-OS: Linux linux-8ccs 5.8.0-rc6-lp150.12.61-default+ x86_64 User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org +++ Mauro Carvalho Chehab [08/08/20 10:12 +0200]: [snip] >Right now, what happens is: > > # modprobe wlcore > modprobe: ERROR: could not insert 'wlcore': Exec format error > >This seems to be failing for all modules, as doesn't show anything >probed. > >Btw, IMO, it would be useful to have some pr_debug() infra in order to >explain why insmod is failing, or to have more error codes used there, >as nothing was printed at dmesg. That makes harder to debug issues >there. I ended losing a lot of time yesterday rebuilding the Kernel >and checking the FS, before deciding to add some printks inside the >Kernel ;-) > >In order for modprobe to start working again, I had to apply this >dirty hack: > > >diff --git a/kernel/module.c b/kernel/module.c >index 910a57640818..10d590dc48ad 100644 >--- a/kernel/module.c >+++ b/kernel/module.c >@@ -2051,11 +2051,12 @@ static int module_enforce_rwx_sections(Elf_Ehdr *hdr, Elf_Shdr *sechdrs, > const unsigned long shf_wx = SHF_WRITE|SHF_EXECINSTR; > int i; > >+#if 0 > for (i = 0; i < hdr->e_shnum; i++) { > if ((sechdrs[i].sh_flags & shf_wx) == shf_wx) > return -ENOEXEC; > } >- >+#endif > return 0; > } > All this hunk does it reject loading modules that have any sections that have both the writable and executable flags. You're saying it's happening for all modules on your setup - I am curious as to which sections have both these flags - what does readelf -S tell you? Thanks, Jessica