From: Ian Campbell Subject: Re: [PATCH] [v3] libxl: Add API to retrieve domain console tty Date: Fri, 1 Jun 2012 11:09:30 +0100 Message-ID: <1338545370.17466.66.camel@zakaz.uk.xensource.com> References: <3496f86000b80595b34a.1338535311@linux-x12> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <3496f86000b80595b34a.1338535311@linux-x12> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Bamvor Jian Zhang Cc: Stefano Stabellini , "jfehlig@suse.com" , Ian Jackson , "xen-devel@lists.xen.org" List-Id: xen-devel@lists.xenproject.org On Fri, 2012-06-01 at 08:21 +0100, Bamvor Jian Zhang wrote: > BUT, NOT update strdup to libxl__strdup. bacause libxl__strdup(0, > tty) will lead to null pointer access in CTX maco. I haven't looked at the rest of the patch you but thought I'd pick up on this now since we have at least one existing libxl__strdup(0, ..) in b_info->blkdev_start = libxl__strdup(0, "xvda"); so we need to decide what to do in general. libxl__strdup wants the CTX so it can complain via the logs on malloc failure. This looks like a problem even with the functions which take a "gc_opt" (i.e. where gc==NULL is explicitly supposed to be allowed). libxl__alloc_failed() could take a gc_opt instead of a ctx and only log if it is non-null. It already also logs via stderr, since this is a catastrophic failure from which we won't return. We could also have a process-global libxl_alloc_failure_hook(const char *argh) to allow the calling application to have some chance to log via its own routines... IanJ -- you added all this, what do you think? Ian.