All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Preserve build IDs
@ 2008-04-14 22:41 Lubomir Kundrak
  2008-04-15 13:35 ` Robert Millan
  0 siblings, 1 reply; 6+ messages in thread
From: Lubomir Kundrak @ 2008-04-14 22:41 UTC (permalink / raw)
  To: The development of GRUB 2

[-- Attachment #1: Type: text/plain, Size: 758 bytes --]

This will make Fedora packagers have good sleep. I think we discussed
this already on the list. Rationale behind disabling build-ids
completely was that it caused images to grow a lot. Correct solution is
to disable it from images only and let it exists in elf files for
debugging purposes.

2008-04-15  Lubomir Kundrak  <lkundrak@redhat.com>

	* aclocal.m4 (grub_PROG_OBJCOPY_ABSOLUTE): take only .text
	section into account, newer toolchains generate unique build ids
	* configure.ac: remove the test for --build-id=none acceptance,
	we want build ids to bre preserved
	* genmk.rb: add -R .note.gnu.build-id to objcopy, so build id
	far from other sections don't cause the raw binary images grow
	size

-- 
Lubomir Kundrak (Red Hat Security Response Team)

[-- Attachment #2: grub-1.95-buildid.patch --]
[-- Type: text/x-patch, Size: 1719 bytes --]

diff -urp grub-1.96.orig/aclocal.m4 grub-1.96/aclocal.m4
--- grub-1.96.orig/aclocal.m4	2008-04-15 00:32:05.000000000 +0200
+++ grub-1.96/aclocal.m4	2008-04-15 00:15:04.000000000 +0200
@@ -61,7 +61,7 @@ for link_addr in 2000 8000 7C00; do
   else
     AC_MSG_ERROR([${CC-cc} cannot link at address $link_addr])
   fi
-  if AC_TRY_COMMAND([${OBJCOPY-objcopy} -O binary conftest.exec conftest]); then :
+  if AC_TRY_COMMAND([${OBJCOPY-objcopy} --only-section=.text -O binary conftest.exec conftest]); then :
   else
     AC_MSG_ERROR([${OBJCOPY-objcopy} cannot create binary files])
   fi
diff -urp grub-1.96.orig/configure.ac grub-1.96/configure.ac
--- grub-1.96.orig/configure.ac	2008-04-15 00:32:05.000000000 +0200
+++ grub-1.96/configure.ac	2008-04-15 00:33:20.000000000 +0200
@@ -237,16 +237,6 @@ if test "x$target_m32" = x1; then
   TARGET_LDFLAGS="$TARGET_LDFLAGS -m32"
 fi
 
-AC_MSG_CHECKING([whether the linker accepts `--build-id=none'])
-save_LDFLAGS="$LDFLAGS"
-LDFLAGS="$LDFLAGS -Wl,--build-id=none"
-AC_TRY_LINK(, , build_id_flag=yes, build_id_flag=no)
-AC_MSG_RESULT([$build_id_flag])
-LDFLAGS="$save_LDFLAGS"
-if test "x$build_id_flag" = xyes; then
-  TARGET_LDFLAGS="$TARGET_LDFLAGS -Wl,--build-id=none"
-fi
-
 #
 # Compiler features.
 #
diff -urp grub-1.96.orig/genmk.rb grub-1.96/genmk.rb
--- grub-1.96.orig/genmk.rb	2008-04-15 00:32:05.000000000 +0200
+++ grub-1.96/genmk.rb	2008-04-15 00:15:04.000000000 +0200
@@ -57,7 +57,7 @@ class Image
 MOSTLYCLEANFILES += #{deps_str}
 
 #{@name}: #{exe}
-	$(OBJCOPY) -O binary -R .note -R .comment $< $@
+	$(OBJCOPY) -O binary -R .note -R .comment -R .note.gnu.build-id $< $@
 
 #{exe}: #{objs_str}
 	$(TARGET_CC) -o $@ $^ $(TARGET_LDFLAGS) $(#{prefix}_LDFLAGS)

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Preserve build IDs
  2008-04-14 22:41 [PATCH] Preserve build IDs Lubomir Kundrak
@ 2008-04-15 13:35 ` Robert Millan
  2008-04-15 19:04   ` Pavel Roskin
  0 siblings, 1 reply; 6+ messages in thread
From: Robert Millan @ 2008-04-15 13:35 UTC (permalink / raw)
  To: The development of GRUB 2

On Tue, Apr 15, 2008 at 12:41:50AM +0200, Lubomir Kundrak wrote:
> This will make Fedora packagers have good sleep. I think we discussed
> this already on the list. Rationale behind disabling build-ids
> completely was that it caused images to grow a lot. Correct solution is
> to disable it from images only and let it exists in elf files for
> debugging purposes.
> 
> 2008-04-15  Lubomir Kundrak  <lkundrak@redhat.com>
> 
> 	* aclocal.m4 (grub_PROG_OBJCOPY_ABSOLUTE): take only .text
> 	section into account, newer toolchains generate unique build ids
> 	* configure.ac: remove the test for --build-id=none acceptance,
> 	we want build ids to bre preserved
> 	* genmk.rb: add -R .note.gnu.build-id to objcopy, so build id
> 	far from other sections don't cause the raw binary images grow
> 	size

Looks good to me.  Pavel will probably know better though.

-- 
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call… if you are unable to speak?
(as seen on /.)



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Preserve build IDs
  2008-04-15 13:35 ` Robert Millan
@ 2008-04-15 19:04   ` Pavel Roskin
  2008-04-17 11:51     ` Lubomir Kundrak
  2008-04-17 14:14     ` Robert Millan
  0 siblings, 2 replies; 6+ messages in thread
From: Pavel Roskin @ 2008-04-15 19:04 UTC (permalink / raw)
  To: The development of GRUB 2


On Tue, 2008-04-15 at 15:35 +0200, Robert Millan wrote:
> On Tue, Apr 15, 2008 at 12:41:50AM +0200, Lubomir Kundrak wrote:
> > This will make Fedora packagers have good sleep. I think we discussed
> > this already on the list. Rationale behind disabling build-ids
> > completely was that it caused images to grow a lot. Correct solution is
> > to disable it from images only and let it exists in elf files for
> > debugging purposes.
> > 
> > 2008-04-15  Lubomir Kundrak  <lkundrak@redhat.com>
> > 
> > 	* aclocal.m4 (grub_PROG_OBJCOPY_ABSOLUTE): take only .text
> > 	section into account, newer toolchains generate unique build ids
> > 	* configure.ac: remove the test for --build-id=none acceptance,
> > 	we want build ids to bre preserved
> > 	* genmk.rb: add -R .note.gnu.build-id to objcopy, so build id
> > 	far from other sections don't cause the raw binary images grow
> > 	size
> 
> Looks good to me.  Pavel will probably know better though.

Looks good to me too.  There is a bug in objcopy if it's used without
stripping the build ID.  But if we are stripping it, there should be no
problem with it.

-- 
Regards,
Pavel Roskin



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Preserve build IDs
  2008-04-15 19:04   ` Pavel Roskin
@ 2008-04-17 11:51     ` Lubomir Kundrak
  2008-04-17 19:14       ` Pavel Roskin
  2008-04-17 14:14     ` Robert Millan
  1 sibling, 1 reply; 6+ messages in thread
From: Lubomir Kundrak @ 2008-04-17 11:51 UTC (permalink / raw)
  To: The development of GRUB 2


On Tue, 2008-04-15 at 15:04 -0400, Pavel Roskin wrote:
> On Tue, 2008-04-15 at 15:35 +0200, Robert Millan wrote:
> > On Tue, Apr 15, 2008 at 12:41:50AM +0200, Lubomir Kundrak wrote:
> > > This will make Fedora packagers have good sleep. I think we discussed
> > > this already on the list. Rationale behind disabling build-ids
> > > completely was that it caused images to grow a lot. Correct solution is
> > > to disable it from images only and let it exists in elf files for
> > > debugging purposes.
> > > 
> > > 2008-04-15  Lubomir Kundrak  <lkundrak@redhat.com>
> > > 
> > > 	* aclocal.m4 (grub_PROG_OBJCOPY_ABSOLUTE): take only .text
> > > 	section into account, newer toolchains generate unique build ids
> > > 	* configure.ac: remove the test for --build-id=none acceptance,
> > > 	we want build ids to bre preserved
> > > 	* genmk.rb: add -R .note.gnu.build-id to objcopy, so build id
> > > 	far from other sections don't cause the raw binary images grow
> > > 	size
> > 
> > Looks good to me.  Pavel will probably know better though.
> 
> Looks good to me too.  There is a bug in objcopy if it's used without
> stripping the build ID.  But if we are stripping it, there should be no
> problem with it.

Actually that turned to not being a bug, if I recall correctly. It was
just that in plain flat binary files there's really no way to express
emptiness other by padding with zeroes.

However this is irrelevant since we no longer include that in the plain
binary files. There's little use of it anyways, as it would not be
possible to look it up in the file, given it resides in own section in
ELF, and plain binaries really have no sections.

Thanks,
-- 
Lubomir Kundrak (Red Hat Security Response Team)




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Preserve build IDs
  2008-04-15 19:04   ` Pavel Roskin
  2008-04-17 11:51     ` Lubomir Kundrak
@ 2008-04-17 14:14     ` Robert Millan
  1 sibling, 0 replies; 6+ messages in thread
From: Robert Millan @ 2008-04-17 14:14 UTC (permalink / raw)
  To: The development of GRUB 2

On Tue, Apr 15, 2008 at 03:04:26PM -0400, Pavel Roskin wrote:
> 
> On Tue, 2008-04-15 at 15:35 +0200, Robert Millan wrote:
> > On Tue, Apr 15, 2008 at 12:41:50AM +0200, Lubomir Kundrak wrote:
> > > This will make Fedora packagers have good sleep. I think we discussed
> > > this already on the list. Rationale behind disabling build-ids
> > > completely was that it caused images to grow a lot. Correct solution is
> > > to disable it from images only and let it exists in elf files for
> > > debugging purposes.
> > > 
> > > 2008-04-15  Lubomir Kundrak  <lkundrak@redhat.com>
> > > 
> > > 	* aclocal.m4 (grub_PROG_OBJCOPY_ABSOLUTE): take only .text
> > > 	section into account, newer toolchains generate unique build ids
> > > 	* configure.ac: remove the test for --build-id=none acceptance,
> > > 	we want build ids to bre preserved
> > > 	* genmk.rb: add -R .note.gnu.build-id to objcopy, so build id
> > > 	far from other sections don't cause the raw binary images grow
> > > 	size
> > 
> > Looks good to me.  Pavel will probably know better though.
> 
> Looks good to me too.  There is a bug in objcopy if it's used without
> stripping the build ID.  But if we are stripping it, there should be no
> problem with it.

Ok, I checked that in.

-- 
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call… if you are unable to speak?
(as seen on /.)



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Preserve build IDs
  2008-04-17 11:51     ` Lubomir Kundrak
@ 2008-04-17 19:14       ` Pavel Roskin
  0 siblings, 0 replies; 6+ messages in thread
From: Pavel Roskin @ 2008-04-17 19:14 UTC (permalink / raw)
  To: The development of GRUB 2

On Thu, 2008-04-17 at 13:51 +0200, Lubomir Kundrak wrote:

> Actually that turned to not being a bug, if I recall correctly. It was
> just that in plain flat binary files there's really no way to express
> emptiness other by padding with zeroes.

I don't want to start a protracted discussion about binutils here, but
it's a bug in my opinion.  objcopy is supposed to understand the
optional role of build ID and strip it if it cannot be presented in the
output as a build ID, rather than convert is to piece of binary data
followed by megabytes of "emptiness".

> However this is irrelevant since we no longer include that in the plain
> binary files. There's little use of it anyways, as it would not be
> possible to look it up in the file, given it resides in own section in
> ELF, and plain binaries really have no sections.

Agreed.

-- 
Regards,
Pavel Roskin



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2008-04-17 19:14 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-14 22:41 [PATCH] Preserve build IDs Lubomir Kundrak
2008-04-15 13:35 ` Robert Millan
2008-04-15 19:04   ` Pavel Roskin
2008-04-17 11:51     ` Lubomir Kundrak
2008-04-17 19:14       ` Pavel Roskin
2008-04-17 14:14     ` Robert Millan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.