Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp1802676ybk; Mon, 11 May 2020 04:46:15 -0700 (PDT) X-Google-Smtp-Source: APiQypLRrcG7NZ9fXfYWRkBUtqsDyxy9uGad962RKs5ZYJcViGHBAs1+8Q1ue0T03SpNZBlxtZV+ X-Received: by 2002:a17:906:1389:: with SMTP id f9mr5648991ejc.209.1589197575720; Mon, 11 May 2020 04:46:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589197575; cv=none; d=google.com; s=arc-20160816; b=i4HghPfmzo/0db9+A58Gv6FfHmJLsBZPRqxGVJ1NtuFQ/y9ltH6Llyp4ajhADh+psW Ydn523Wr6ARdz2VoIZRc9/KrdiG8KkC9sr+6GM1/ugblehY7+FjHr0zBNw/IC5TrKWVk 3ngYxK3mxUlyQ5o2ig2H4XjzPHUIpJy0cGriJXUjnTAvT2j6dNdCNCo2PYy0Mg/ncC5i GUTPWv8jst2dMpweEZ23SE2pS2JmxL6Pq3XmH2mTPz8rKfGrAYIBNbggi+5yYuaY3Sep /HcYSnXUKIYTU/z6kYKkM9eKlooPSqD3tTHbzSU68WAXJXYKaa8S5+hh/0BepxM5LUDd bW9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date; bh=5zPirTn56lWX1KKNtBCpgsz3EfNDLmSU2mZ1qtB51MY=; b=krKvMIdEpfnBQzBt5P9apAseCcbautV2bDgpNT6ECQZ3Tjqo8cfa/7kGlPqMDNh/kU RExmz+3tFRKF5RfWNHsW3AhhJtmWFA1tK3Hap+2Su0IBsPaINL5JEfxd7F+mnVTCKkeS r1Jsizb4L/pgaLtRxjNlHh4Qhs0kVc7pdeBng+IV2CD9TJl4KAn6eiUtIkeaGFLOjeZy BKJaxrjwJhG39T1gvemkfP0p/ovMF8/yMIPnKa/AfnLJzWu6VsfJ+H4E9FQeaQgJ0e11 P5EvkVMgpkO3+Jw/kVfR12ZylKV+pTrRoxoW+0h7USCxZALQogdKlurcuz+SmaUI8qep K2Lw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y10si6641864ede.45.2020.05.11.04.45.51; Mon, 11 May 2020 04:46:15 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729564AbgEKLns (ORCPT + 99 others); Mon, 11 May 2020 07:43:48 -0400 Received: from mx2.suse.de ([195.135.220.15]:48916 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727873AbgEKLnr (ORCPT ); Mon, 11 May 2020 07:43:47 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 9EA4FADC1; Mon, 11 May 2020 11:43:48 +0000 (UTC) Date: Mon, 11 May 2020 13:43:44 +0200 (CEST) From: Miroslav Benes To: Stephen Rothwell cc: Jiri Kosina , Josh Poimboeuf , Petr Mladek , Joe Lawrence , Jessica Yu , Linux Next Mailing List , Linux Kernel Mailing List , Peter Zijlstra Subject: Re: linux-next: manual merge of the livepatching tree with the modules tree In-Reply-To: <20200508180524.6995b07e@canb.auug.org.au> Message-ID: References: <20200508180524.6995b07e@canb.auug.org.au> User-Agent: Alpine 2.21 (LSU 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 8 May 2020, Stephen Rothwell wrote: > Hi all, > > Today's linux-next merge of the livepatching tree got a conflict in: > > kernel/module.c > > between commits: > > db991af02f11 ("module: break nested ARCH_HAS_STRICT_MODULE_RWX and STRICT_MODULE_RWX #ifdefs") > 5c3a7db0c7ec ("module: Harden STRICT_MODULE_RWX") > > from the modules tree and commit: > > e6eff4376e28 ("module: Make module_enable_ro() static again") > > from the livepatching tree. > > I fixed it up (see below) and can carry the fix as necessary. This > is now fixed as far as linux-next is concerned, but any non trivial > conflicts should be mentioned to your upstream maintainer when your tree > is submitted for merging. You may also want to consider cooperating > with the maintainer of the conflicting tree to minimise any particularly > complex conflicts. > > -- > Cheers, > Stephen Rothwell > > diff --cc kernel/module.c > index c69291362676,a26343ea4d50..000000000000 > --- a/kernel/module.c > +++ b/kernel/module.c > @@@ -2055,29 -2023,20 +2042,30 @@@ static void module_enable_nx(const stru > frob_writable_data(&mod->init_layout, set_memory_nx); > } > > +static int module_enforce_rwx_sections(Elf_Ehdr *hdr, Elf_Shdr *sechdrs, > + char *secstrings, struct module *mod) > +{ > + const unsigned long shf_wx = SHF_WRITE|SHF_EXECINSTR; > + int i; > + > + for (i = 0; i < hdr->e_shnum; i++) { > + if ((sechdrs[i].sh_flags & shf_wx) == shf_wx) > + return -ENOEXEC; > + } > + > + return 0; > +} > + > #else /* !CONFIG_STRICT_MODULE_RWX */ > +/* module_{enable,disable}_ro() stubs are in module.h */ The line should go away too as part of the final conflict resolution, but we'll have to deal with that later while sending pull requests. Otherwise it looks good. Thanks Miroslav > static void module_enable_nx(const struct module *mod) { } > + static void module_enable_ro(const struct module *mod, bool after_init) {} > -#endif /* CONFIG_STRICT_MODULE_RWX */ > -static void module_enable_x(const struct module *mod) > +static int module_enforce_rwx_sections(Elf_Ehdr *hdr, Elf_Shdr *sechdrs, > + char *secstrings, struct module *mod) > { > - frob_text(&mod->core_layout, set_memory_x); > - frob_text(&mod->init_layout, set_memory_x); > + return 0; > } > -#else /* !CONFIG_ARCH_HAS_STRICT_MODULE_RWX */ > -static void module_enable_nx(const struct module *mod) { } > -static void module_enable_x(const struct module *mod) { } > -#endif /* CONFIG_ARCH_HAS_STRICT_MODULE_RWX */ > - > +#endif /* CONFIG_STRICT_MODULE_RWX */ > > #ifdef CONFIG_LIVEPATCH > /* >