[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH for-4.17 v3 14/15] tools/ocaml/xenstored/syslog_stubs.c: avoid potential NULL dereference


  • To: Edwin Torok <edvin.torok@xxxxxxxxxx>
  • From: Christian Lindig <christian.lindig@xxxxxxxxxx>
  • Date: Wed, 9 Nov 2022 14:08:38 +0000
  • Accept-language: en-GB, en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=D+1SJ/LS3q3ZNh2nTusBVG7/wuQd6qdFq2Yr7cWM90U=; b=i+xqWIrDCGsvANkjv/k6mavb523aPNxQMfEalo+gHSeKPXitiZjuRCVjRN2yNY84nTYDOXisAWn/UHjvTiAEAlTYis2hwlm5vyZuVHiUAmGWoGIunp49IpMEwcqCZch3VVDIMVewXOq2i8x2dX0VBzdC1ywC/ax5VMBBG5qZvCKzOfMpJrAu8snPehDuIe99SOB4Q2xmDR20LPC+w+totV2QVnkB/QPbBiQC+rgk2ez6FGgjFf43+gSIAZel2MvugLCp/Apo2hHbkRoRzaSqsXlwU2sczPWBs96qgzuUDj+vwctUfqC/FAlbRl/kXcXUoYjHNKeuQxQjSuWLeYHuYA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AmMYVqueOcWHHWktdgFgsISVEVGpaemuggWGESM6qpwUPfw4xvL8KCYfR4hU8+hjkkP849w89PAw3u1//achKOaR55838Orz02bJ0Ak7mIHRpp8AcnGNbylzHcbHR2Jb2uUnB5oK78LY09YcvW2M4uE3iLxPuwigj2sHM0HXCQDnbS3TuCwUum7kCBB+W3tOkOHQNOjRkpgrwJluiTgcT6+bUswqOWls/IF4qlYkp4X3MCb2uiI2xWRdrrZA04IQn3OYfpJflWAleDo5bIRQPUo6hzgjMPaHA3XGhCcJ0nGlxAkttDjIpspXEdAQflHQSWPN4M2j4iyuO01ZbVDy8Q==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Henry Wang <Henry.Wang@xxxxxxx>, David Scott <dave@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Anthony Perard <anthony.perard@xxxxxxxxxx>
  • Delivery-date: Wed, 09 Nov 2022 14:09:00 +0000
  • Ironport-data: A9a23:cBtFs60uVhJQIPBu+/bD5exwkn2cJEfYwER7XKvMYLTBsI5bp2cHx mQZXD/UPq2KMDb1Ldl+YYSx9EgAsZfWmtZjHQI9pC1hF35El5HIVI+TRqvS04F+DeWYFR46s J9OAjXkBJppJpMJjk71atANlVEliefTAOK5ULSfUsxIbVcMYD87jh5+kPIOjIdtgNyoayuAo tq3qMDEULOf82cc3lk8tuTS9nuDgNyo4GlC5wVmNKgR1LPjvyJ94Kw3dPnZw0TQGuG4LsbiL 87fwbew+H/u/htFIrtJRZ6iLyXm6paLVeS/oiI+t5qK23CulQRrukoPD9IOaF8/ttm8t4sZJ OOhF3CHYVxB0qXkwIzxWvTDes10FfUuFLTveRBTvSEPpqFvnrSFL/hGVSkL0YMkFulfJjhE1 eEKKjM2ZxGFo9+HwZyqE8IzmZF2RCXrFNt3VnBI6xj8VKxjZK+ZBqLA6JlfwSs6gd1IEbDGf c0FZDFzbRPGJRpSJlMQD5F4l+Ct7pX9W2QA9BTJ+uxpvS6PkWSd05C0WDbRUteKX8ROgkeRo CTC/mL1Ax4yP92D0zuVtHmrg4cjmAurA99PTefgqJaGhnWDxDI/DAwICGG0uNv+sUCSUO5NB A89r39GQa8asRbDosPGdw21pjuIswARX/JUEvYm80edx6zM+QGbC2MYCDlbZ7QOlMIwXy1s6 VaPkPvgHzkpu7qQIVqR/6mZhSm/Mi8UKSkFfyBsZRQBy8nupsc0lB2nczp4OKu8j9mwHC6qx TmP9XI6n+9L0ZNN0Lin91fahT7qvoLOUgM++gTQWCSi8x99Y4mmIYev7DA38Mp9EWpQdXHZ1 FBspiRUxLlm4U2l/MBVfNgwIQ==
  • Ironport-hdrordr: A9a23:BDMUyqAgj5KKKAXlHegasceALOsnbusQ8zAXPh9KJCC9I/bzqy nxpp8mPEfP+U0ssHFJo6HiBEDyewKnyXcV2/haAV7GZmXbUQSTXeZfBOfZogEIXheOjtK1tp 0QPpSWaueAa2SS5PySiGbXLz9j+qj/zEnCv5a9854Zd3APV0gW1XYdNu/0KC1LbTgDIaB8OI uX58JBqTblU28QdN6HCn4MWPWGj8HXlbr9CCR2SCIP2U2rt3eF+bT6Gx+X0lM1SDVU24ov9m DDjkjQ+rijifem0RXRvlWjoai+2eGRi+erNvb8yfT9GQ+cyDpAo74RHoFqiQpF4N1HLmxa1O Uk7S1QePiboEmhA11d6SGdpzUIlgxep0MKgGXo/0fLsIj3Qik3BNFGgp8cehzF61A4tNU5y6 5T2XmF3qAnRC8pDEzGlqf1vjxR5z2JSEAZ4Jgupm0aVZFbZK5arIQZ8k8QGJAcHDji4IRiFO V1FsnT6PtfbFvfNhnizyJS6c3pWm52EgaNQ0AEtMDQ2z9KnGphx09dwMAEhH8P+J80VpEB7e XZNaZjkq1IU6YtHOpALfZERdHyBn3GQBrKPm7XKVP7FLsfM3aIsJLz6KVd3pDfRHXJ9upGpH 3saiIqiYdpQTOeNSSn5uw6zjndBGOgQD/q1sZSo5Bkp7yUfsuYDRG+
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHY84hV+zekFcwy5E+YRPoUo8Fj+K42onCA
  • Thread-topic: [PATCH for-4.17 v3 14/15] tools/ocaml/xenstored/syslog_stubs.c: avoid potential NULL dereference



On 8 Nov 2022, at 15:34, Edwin Török <edvin.torok@xxxxxxxxxx> wrote:

If we are out of memory then strdup may return NULL, and passing NULL to
syslog may cause a crash.

Avoid this by using `caml_stat_strdup` which will raise an OCaml out of
memory exception instead.
This then needs to be paired with caml_stat_free.

Signed-off-by: Edwin Török <edvin.torok@xxxxxxxxxx>
---
Reason for inclusion in 4.17:
- fixes a bug in out of memory situations

Changes since v2:
- new in v3
---
tools/ocaml/xenstored/syslog_stubs.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)

Acked-by: Christian Lindig <christian.lindig@xxxxxxxxxx>


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.