Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp917815ybl; Fri, 24 Jan 2020 11:58:04 -0800 (PST) X-Google-Smtp-Source: APXvYqyabjkW/C6j46rtPy/e7xTzbrEP/e85h+WSfo5ElEf1+pu0wsMl2p6qhuY7pQ8/FDUWHa8h X-Received: by 2002:a05:6830:1d59:: with SMTP id p25mr4040821oth.308.1579895884774; Fri, 24 Jan 2020 11:58:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579895884; cv=none; d=google.com; s=arc-20160816; b=zkrRC/kxswbDyYvaRobH9IKTjVAVCMKlNQjAe7FeQprJpPlEXbh3xnb5pHIiCjfoaI +5EGLUbhYHODOzq0JqyOxT28lSjbzH0HSYqVhLk95JVdmbp9ai6H6z0PmyClrysU1h4x xrTHsF1u6ivsi9xMKL5yv5Fxf+2GRAPkPXqDDcppNCoGgVOtT9hBGC8imo00UfPY9T9D W7SWnqTeK4a9sE41y8kiyJd0nQvcnqEk48F9V7F0U2eo3olSi0l6xQqIoIFv4lkE1kGK xxdS7Sb11i24Z82EJviAB51sTPRPwUM7yXq2FPEo42xPDjHB+mLdZ/JdBAhkW7+sL4uT asLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=WPh74pEP+nQ76ELzYt+TrcyRCi7yaoOoadSkrfPnPw0=; b=Ua0vth5CiFt+HuJMnk8atRwap9pIBq8SaebWTrnb3TNTPw5Nd102XMzafb+/+6MLjZ 9djvZ2YEGJKg3sic7/+JZ/0Qw93dhUsK3YAO0Zh+Z/26MV2jnYonZ39eCoChLZGxqxqU 5E1Rdi38q2HTpCHedOWpfLV6Z7EYliwgin1fa1z+oNXHBh88MeHGKH5HWZrZgIO+fFAh SDTpct9lv09R8ZirtXQ05fjj/7gPmD8Zm1wigVsPPu07t5u58PCqEQ9WfT1K0RS0/7Iv A8AZuU8FitX1q0SuM9KaR6mHvlNd9ZiDp70vwH+L9ljL7WIdWYt8ik6tCT8hiaFoV8ur fl0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rasmusvillemoes.dk header.s=google header.b=UiiEOmI5; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i8si3092795otp.254.2020.01.24.11.57.52; Fri, 24 Jan 2020 11:58:04 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@rasmusvillemoes.dk header.s=google header.b=UiiEOmI5; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390651AbgAXLlz (ORCPT + 99 others); Fri, 24 Jan 2020 06:41:55 -0500 Received: from mail-lj1-f178.google.com ([209.85.208.178]:40855 "EHLO mail-lj1-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390001AbgAXLQW (ORCPT ); Fri, 24 Jan 2020 06:16:22 -0500 Received: by mail-lj1-f178.google.com with SMTP id n18so2049245ljo.7 for ; Fri, 24 Jan 2020 03:16:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rasmusvillemoes.dk; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=WPh74pEP+nQ76ELzYt+TrcyRCi7yaoOoadSkrfPnPw0=; b=UiiEOmI5crrZFnXah+iBEOCV1kFA6HM7uH0AeaaVeCmEY0JQFlbkI5t8sr83qk61jO ENI1Xm1UUUGXlAoQn+AgsSPXkmL1Hx34lQhSF7FiDCi+8GlB7JdN5aVzcdCM/RbQbz0T gr+P+irrrT+iCw23HnU+FbiaxS5z0yDBgxLkk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=WPh74pEP+nQ76ELzYt+TrcyRCi7yaoOoadSkrfPnPw0=; b=WvdgzlQ4b9zCkglQ3OhahnLeoLoeTAUvryWDkjuGve3rAFGVAgosCQBvi2Zvf8E9Pc wOSJkIfy4tumY7cqiVsmeG4WOr4mwYLLJxgxmegu8E5Zf/hC5R1A3g0WzateUSMSMem8 vhj3ixtEbf/FxJFnMJzxCztZw0DRaYY2rLX7WfsCTnhW214JNFYxLFh9yW1tANGzmq7s nxF9rNJbZMpUB1hDb3H1Z7RGueQVPzPsPnVvgksDGQvqaP1uk9TLv7379oPSUac5PlI+ fzVha6i5ZckWshLqnKBDMK2+61EewF36KTjabPqaROQjw7Tj7SCuuWe1EsH2TYNhLmz/ Ltyg== X-Gm-Message-State: APjAAAW1iee1OKR8wHCjYBKprggfwZ3zQrIQqBE4IdRJ54lotbagjaH1 LbaEZDgDg662DSVn4a6KgxTNHHe9J8MLik9O X-Received: by 2002:a2e:7a07:: with SMTP id v7mr1853505ljc.271.1579864580100; Fri, 24 Jan 2020 03:16:20 -0800 (PST) Received: from [172.16.11.50] ([81.216.59.226]) by smtp.gmail.com with ESMTPSA id t1sm2947207lji.98.2020.01.24.03.16.18 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 24 Jan 2020 03:16:19 -0800 (PST) Subject: Re: vmlinux ELF header sometimes corrupt To: Michael Ellerman , LKML Cc: Linux Kbuild mailing list , "linuxppc-dev@lists.ozlabs.org" References: <71aa76d0-a3b8-b4f3-a7c3-766cfb75412f@rasmusvillemoes.dk> <875zh1i0wj.fsf@mpe.ellerman.id.au> From: Rasmus Villemoes Message-ID: Date: Fri, 24 Jan 2020 12:16:17 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.2 MIME-Version: 1.0 In-Reply-To: <875zh1i0wj.fsf@mpe.ellerman.id.au> Content-Type: text/plain; charset=windows-1252 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 24/01/2020 11.50, Michael Ellerman wrote: > Rasmus Villemoes writes: >> I'm building for a ppc32 (mpc8309) target using Yocto, and I'm hitting a >> very hard to debug problem that maybe someone else has encountered. This >> doesn't happen always, perhaps 1 in 8 times or something like that. >> >> The issue is that when the build gets to do "${CROSS}objcopy -O binary >> ... vmlinux", vmlinux is not (no longer) a proper ELF file, so naturally >> that fails with >> >> powerpc-oe-linux-objcopy:vmlinux: file format not recognized >> >> >> Any ideas? > > Not really sorry. Haven't seen or heard of that before. > > Are you doing a parallel make? If so does -j 1 fix it? Hard to say, I'll have to try that a number of times to see if it can be reproduced with that setting. > If it seems like sortextable is at fault then strace'ing it would be my > next step. I don't think sortextable is at fault, that was just my first "I know that at least pokes around in the ELF file". I do "cp vmlinux vmlinux.before_sort" and "cp vmlinux vmlinux.after_sort", and both of those copies are proper ELF files - and the .after_sort is identical to the corrupt vmlinux apart from vmlinux ending up with its ELF header wiped. So it's something that happens during some later build step (Yocto has a lot of steps), perhaps "make modules" or "make modules_install" or something ends up somehow deciding "hey, vmlinux isn't quite uptodate, let's nuke it". I'm not even sure it's a Kbuild problem, but I've seen the same thing happen using another meta-build system called oe-lite, which is why I'm not primarily suspecting the Yocto logic. Rasmus