Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1m2vM1-0008Cg-Iy for mharc-grub-devel@gnu.org; Mon, 12 Jul 2021 08:48:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43734) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m2vLz-000847-OK for grub-devel@gnu.org; Mon, 12 Jul 2021 08:48:07 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:60018) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m2vLy-0007vH-5A for grub-devel@gnu.org; Mon, 12 Jul 2021 08:48:07 -0400 Received: from pps.filterd (m0127361.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 16CCY0Mp069150; Mon, 12 Jul 2021 08:48:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=subject : to : cc : references : from : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=pp1; bh=SvVDCj8C02waGXclHKwbkiv5HS6iroCCmUzN0I0p2js=; b=hgMZhsdj6lD/jXX4BBks4WDkoXKkWTksWPySnhxEoIU/uTspR58ou+jDr38WAAFDbpXs rO7Ofs+t4ahtP8/jzGVG2MnthbrPkzmVGD5pcGFG41hnwMn24CDydl0QiLBAXpZrf915 KjLa2ndYO8p+xStb/kO81RDjHF5NdyK+ZxcXmzODIzIog24CihgHTTSifyL7g8j0riJ2 WVgjOcaCHZFjUAWlnEWkrBfeqSquDmjAfYFGvgiEWltvALg/uXKjJ49Qm8yqpPkSW9qV r+sKTo63S+kMU3Z12Mfvic4Tr9Gc1rJHJP70ZCHsXdGdZ2ZjamcN2OdBlpXoBKLqMDHM /w== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 39qrsxrvtr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 12 Jul 2021 08:48:04 -0400 Received: from m0127361.ppops.net (m0127361.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 16CCYDa3070945; Mon, 12 Jul 2021 08:48:04 -0400 Received: from ppma01wdc.us.ibm.com (fd.55.37a9.ip4.static.sl-reverse.com [169.55.85.253]) by mx0a-001b2d01.pphosted.com with ESMTP id 39qrsxrvtb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 12 Jul 2021 08:48:04 -0400 Received: from pps.filterd (ppma01wdc.us.ibm.com [127.0.0.1]) by ppma01wdc.us.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 16CChRfU024664; Mon, 12 Jul 2021 12:48:03 GMT Received: from b03cxnp08028.gho.boulder.ibm.com (b03cxnp08028.gho.boulder.ibm.com [9.17.130.20]) by ppma01wdc.us.ibm.com with ESMTP id 39q36ab15d-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 12 Jul 2021 12:48:03 +0000 Received: from b03ledav004.gho.boulder.ibm.com (b03ledav004.gho.boulder.ibm.com [9.17.130.235]) by b03cxnp08028.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 16CCm2GA35586472 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 12 Jul 2021 12:48:02 GMT Received: from b03ledav004.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6B9D47805F; Mon, 12 Jul 2021 12:48:02 +0000 (GMT) Received: from b03ledav004.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1D31D7805E; Mon, 12 Jul 2021 12:48:02 +0000 (GMT) Received: from [9.47.158.152] (unknown [9.47.158.152]) by b03ledav004.gho.boulder.ibm.com (Postfix) with ESMTP; Mon, 12 Jul 2021 12:48:01 +0000 (GMT) Subject: Re: [PATCH v2 07/22] dl: provide a fake grub_dl_set_persistent for the emu target To: The development of GNU GRUB , Daniel Axtens Cc: rashmica.g@gmail.com, alastair@d-silva.org, nayna@linux.ibm.com References: <20210630084031.2663622-1-dja@axtens.net> <20210630084031.2663622-8-dja@axtens.net> From: Stefan Berger Message-ID: Date: Mon, 12 Jul 2021 08:48:01 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <20210630084031.2663622-8-dja@axtens.net> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: NisqQS2My1fDFNwlZjwGw5j8i6xXA1kl X-Proofpoint-GUID: 6EVqNJQgvy8_H3n5yZM6e199HEy0rx9i X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391, 18.0.790 definitions=2021-07-12_07:2021-07-12, 2021-07-12 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 suspectscore=0 mlxscore=0 bulkscore=0 lowpriorityscore=0 adultscore=0 impostorscore=0 spamscore=0 phishscore=0 priorityscore=1501 clxscore=1015 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2107120099 Received-SPF: pass client-ip=148.163.158.5; envelope-from=stefanb@linux.ibm.com; helo=mx0b-001b2d01.pphosted.com X-Spam_score_int: -34 X-Spam_score: -3.5 X-Spam_bar: --- X-Spam_report: (-3.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, NICE_REPLY_A=-1.479, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jul 2021 12:48:08 -0000 On 6/30/21 4:40 AM, Daniel Axtens wrote: > Trying to start grub-emu with a module that calls grub_dl_set_persistent > will crash because grub-emu fakes modules and passes NULL to the module > init function. > > Provide an empty function for the emu case. > > Fixes: ee7808e2197c (dl: Add support for persistent modules) > Signed-off-by: Daniel Axtens Reviewed-by: Stefan Berger > --- > include/grub/dl.h | 11 +++++++++++ > 1 file changed, 11 insertions(+) > > diff --git a/include/grub/dl.h b/include/grub/dl.h > index b3753c9ca262..5decbe2f2fb9 100644 > --- a/include/grub/dl.h > +++ b/include/grub/dl.h > @@ -243,11 +243,22 @@ grub_dl_get (const char *name) > return 0; > } > > +#ifdef GRUB_MACHINE_EMU > +/* > + * Under grub-emu, modules are faked and NULL is passed to GRUB_MOD_INIT. > + * So we fake this out to avoid a NULL deref. > + */ > +static inline void > +grub_dl_set_persistent (grub_dl_t mod __attribute__((unused))) > +{ > +} > +#else > static inline void > grub_dl_set_persistent (grub_dl_t mod) > { > mod->persistent = 1; > } > +#endif > > static inline int > grub_dl_is_persistent (grub_dl_t mod)