Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 270274 - sys-libs/glibc-2.10.1 glibc-2.5-hardened-configure-picdefault.patch fails on hardened
Summary: sys-libs/glibc-2.10.1 glibc-2.5-hardened-configure-picdefault.patch fails on ...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: The Gentoo Linux Hardened Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-05-18 11:19 UTC by Matt
Modified: 2009-10-01 19:18 UTC (History)
8 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
output of the failed patch (glibc-2.5-hardened-configure-picdefault.patch-11066.out,5.12 KB, text/plain)
2009-05-18 11:28 UTC, Matt
Details
Fixed for glibc 2.10 (glibc-2.10-hardened-configure-picdefault.patch,865 bytes, patch)
2009-05-18 12:06 UTC, Magnus Granberg
Details | Diff
Fixed for glibc 2.10 (glibc-2.10-hardened-inittls-nosysenter.patch,8.62 KB, patch)
2009-05-18 12:07 UTC, Magnus Granberg
Details | Diff
emerge --info (emerge_--info.txt,10.18 KB, text/plain)
2009-05-18 14:44 UTC, Magnus Granberg
Details
ssp-compat patch for __guard NOT TESTED (glibc-2.10-hardened-ssp-compat.patch,4.69 KB, patch)
2009-05-24 22:49 UTC, Magnus Granberg
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Matt 2009-05-18 11:19:07 UTC
the glibc-2.5-hardened-configure-picdefault.patch patch fails to apply when trying to build glibc with the hardened use-flag / hardened gcc / hardened profile

Reproducible: Always

Steps to Reproduce:
1. emerge glibc -1
2.
3.

Actual Results:  
>>> Unpacking source...                                                                    
 * Checking gcc for __thread support ...                                             [ ok ]
 * Checking kernel version (2.6.29 >= 2.6.9) ...                                     [ ok ]
 * Checking linux-headers version (2.6.29 >= 2.6.9) ...                              [ ok ]
>>> Unpacking glibc-2.10.1.tar.bz2 to /var/tmp/portage/sys-libs/glibc-2.10.1/work          
>>> Unpacking glibc-libidn-2.10.1.tar.bz2 to /var/tmp/portage/sys-libs/glibc-2.10.1/work/glibc-2.10.1                                                                                 
>>> Unpacking glibc-2.10.1-patches-1.tar.bz2 to /var/tmp/portage/sys-libs/glibc-2.10.1/work
 * Applying Gentoo Glibc Patchset 2.10.1-1 ...                                             
 *   0030_all_glibc-respect-env-CPPFLAGS.patch ...                                   [ ok ]
 *   0040_all_glibc-i586-chk.patch ...                                               [ ok ]
 *   0070_all_glibc-i386-x86_64-revert-clone-cfi.patch ...                           [ ok ]
 *   0085_all_glibc-disable-ldconfig.patch ...                                       [ ok ]
 *   1010_all_glibc-queue-header-updates.patch ...                                   [ ok ]
 *   1030_all_glibc-manual-no-perl.patch ...                                         [ ok ]
 *   1040_all_2.3.3-localedef-fix-trampoline.patch ...                               [ ok ]
 *   1055_all_glibc-resolv-dynamic.patch ...                                         [ ok ]
 *   1070_all_glibc-fadvise64_64.patch ...                                           [ ok ]
 *   1073_all_glibc-ldbl-nexttowardf.patch ...                                       [ ok ]
 *   1075_all_glibc-section-comments.patch ...                                       [ ok ]
 *   1080_all_glibc-no-inline-gmon.patch ...                                         [ ok ]
 *   1085_all_glibc-2.9-check_native-headers.patch ...                               [ ok ]
 *   1090_all_glibc-2.3.6-fix-pr631.patch ...                                        [ ok ]
 *   1095_all_glibc-2.9-assume-pipe2.patch ...                                       [ ok ]
 *   1100_all_glibc-2.3.3-china.patch ...                                            [ ok ]
 *   1103_all_glibc-new-valencian-locale.patch ...                                   [ ok ]
 *   1130_all_glibc-2.4-undefine-__i686.patch ...                                    [ ok ]
 *   1160_all_glibc-2.8-nscd-one-fork.patch ...                                      [ ok ]
 *   3000_all_2.3.6-dl_execstack-PaX-support.patch ...                               [ ok ]
 *   3010_all_2.3.3_pre20040117-pt_pax.patch ...                                     [ ok ]
 *   3020_all_glibc-tests-sandbox-libdl-paths.patch ...                              [ ok ]
 *   5021_all_2.9-fnmatch.patch ...                                                  [ ok ]
 *   5063_all_glibc-dont-build-timezone.patch ...                                    [ ok ]
 *   5070_all_glibc-2.7-cross-compile-nptl.patch ...                                 [ ok ]
 *   6120_all_ppc-glibc-2.9-atomic.patch ...                                         [ ok ]
 *   6418_all_sh-glibc-2.9-set-fpscr-proto.patch ...                                 [ ok ]
 *   6645_all_glibc-mips_shn_undef-hack.patch ...                                    [ ok ]
 * Done with patching                                                                      
 * Using GNU config files from /usr/share/gnuconfig                                        
 *   Updating scripts/config.sub                                                     [ ok ]
 *   Updating scripts/config.guess                                                   [ ok ]
 * Patching to get working PIE binaries on PIE (hardened) platforms                        
 * Applying glibc-2.5-hardened-pie.patch ...                                         [ ok ]
 * Applying glibc-2.5-hardened-configure-picdefault.patch ...                              

 * Failed Patch: glibc-2.5-hardened-configure-picdefault.patch !
 *  ( /usr/gentoo/portage_old/sys-libs/glibc/files/2.5/glibc-2.5-hardened-configure-picdefault.patch )                                                                                
 *                                                                                         
 * Include in your bugreport the contents of:                                              
 *                                                                                         
 *   /var/tmp/portage/sys-libs/glibc-2.10.1/temp/glibc-2.5-hardened-configure-picdefault.patch-11066.out                                                                              

 * 
 * ERROR: sys-libs/glibc-2.10.1 failed.
 * Call stack:                         
 *               ebuild.sh, line   49:  Called src_unpack
 *             environment, line 3590:  Called eblit-run 'src_unpack'
 *             environment, line 1188:  Called eblit-run-maybe 'eblit-src_unpack-post'
 *             environment, line 1192:  Called eblit-src_unpack-post                  
 *             environment, line 1200:  Called epatch '/usr/gentoo/portage_old/sys-libs/glibc/files/2.5/glibc-2.5-hardened-configure-picdefault.patch'                                
 *             environment, line 1945:  Called die                                         
 * The specific snippet of code:                                                           
 *                   die "Failed Patch: ${patchname}!";                                    
 *  The die message:                                                                       
 *   Failed Patch: glibc-2.5-hardened-configure-picdefault.patch!                          
 *                                                                                         
 * If you need support, post the topmost build error, and the call stack if relevant.      
 * A complete build log is located at '/var/log/portage/sys-libs:glibc-2.10.1:20090518-111408.log'.                                                                                   
 * The ebuild environment file is located at '/var/tmp/portage/sys-libs/glibc-2.10.1/temp/environment'.


Expected Results:  
it should have applied cleanly
Comment 1 Matt 2009-05-18 11:28:37 UTC
Created attachment 191646 [details]
output of the failed patch
Comment 2 Magnus Granberg gentoo-dev 2009-05-18 12:06:45 UTC
Created attachment 191653 [details, diff]
Fixed for glibc 2.10
Comment 3 Magnus Granberg gentoo-dev 2009-05-18 12:07:39 UTC
Created attachment 191654 [details, diff]
Fixed for glibc 2.10
Comment 4 Sebastian Luther (few) 2009-05-18 12:58:19 UTC
emerge --info please.
Comment 5 Magnus Granberg gentoo-dev 2009-05-18 14:44:18 UTC
Created attachment 191673 [details]
emerge --info
Comment 6 Matt 2009-05-19 09:11:01 UTC
that did it !

Thanks a lot Magnus =)

you guys are FAST ^^

should I set it to "FIXED" or wait for another (gentoo)dev to attend and do it ?

Comment 7 Magnus Granberg gentoo-dev 2009-05-19 15:17:22 UTC
(In reply to comment #6)
> that did it !
> 
> Thanks a lot Magnus =)
> 
> you guys are FAST ^^
> 
> should I set it to "FIXED" or wait for another (gentoo)dev to attend and do it
> ?
> 
yes if get commited.
Comment 8 Juergen Rose 2009-05-21 20:45:57 UTC
I tried the patch of Magnus too, but it fails again with:
...
* Applying glibc-2.5-hardened-configure-picdefault.patch ...

 * Failed Patch: glibc-2.5-hardened-configure-picdefault.patch !
 *  ( /usr/local/portage/sys-libs/glibc/files/2.5/glibc-2.5-hardened-configure-picdefault.patch )
 * 
 * Include in your bugreport the contents of:
 * 
 *   /var/tmp/portage/sys-libs/glibc-2.10.1-r1/temp/glibc-2.5-hardened-configure-picdefault.patch-10059.out

in glibc-2.5-hardened-configure-picdefault.patch-10059.out I find:
***** glibc-2.5-hardened-configure-picdefault.patch *****

=========================================================

PATCH COMMAND:	 patch -p0 -g0 -E --no-backup-if-mismatch < /usr/local/portage/sys-libs/glibc/files/2.5/glibc-2.5-hardened-configure-picdefault.patch

=========================================================
patching file configure.in
Hunk #1 FAILED at 2145.
1 out of 1 hunk FAILED -- saving rejects to file configure.in.rej
patching file configure
Hunk #1 FAILED at 7698.
1 out of 1 hunk FAILED -- saving rejects to file configure.rej
=========================================================
,,,

Comment 9 Matt 2009-05-21 21:11:42 UTC
no it doesn't ;) (for me)

Juergen, you are sure you changed the lines in the ebuild and added a folder called 2.10 in the files subdirectory with those 2 files in it ?

cause it still reads glibc-2.5* but the new patches are called glibc-2.10*
Comment 10 Petr Polezhaev 2009-05-24 11:38:56 UTC
I've make an minimalistic ebuild-package for this patch (thanks to Magnus Granberg!), but it have to much files to post them into bugzilla.

You can find ebuild into my overlay via git:
git clone git://vcs.niifaq.ru/portage
or via ftp
wget -r ftp://ftp.niifaq.ru/pub/portage/sys-libs/glibc/

Links above are hosted on homeserver, so it could be inaccessible sometimes, so everybody welcome to rehost it on any more stable resource (such as github or google-code).
Comment 11 Petr Polezhaev 2009-05-24 19:25:19 UTC
I have to state, that upgrading my server to new glibc broke it's system. This message now appears everywhere:
relocation error: screen: symbol __guard, version GLIBC_2.3.2 not defined in file libc.so.6 with link time reference

So, maybe it would be wise to wait untill glibc would be properly patched by hardened team, I suppose this patch issue some kind of another funny hardened joke: it's acting as package.mask =)
Comment 12 Magnus Granberg gentoo-dev 2009-05-24 22:00:33 UTC
Gentoo patchset is missing the ssp-compat.patch that support the older __guard symbols for < gcc 4.1
We have mask glibc 2.10 in the hardened profile.
Comment 13 Magnus Granberg gentoo-dev 2009-05-24 22:49:30 UTC
Created attachment 192348 [details, diff]
ssp-compat patch for __guard NOT TESTED

This patch is NOT TESTED
Comment 14 Mark Loeser (RETIRED) gentoo-dev 2009-05-25 00:27:18 UTC
@hardened: Please check these patches and apply if fine.
Comment 15 Juergen Rose 2009-05-25 08:20:00 UTC
I created an overlay /usr/local/portage/sys-libs/glibc/, copied there  glibc-2.10.1.ebuild to glibc-2.10.1-r1.ebuild, created a /usr/local/portage/sys-libs/glibc/files/2.10 directory, put the two patches into that directory:
root@mouse:/usr/local/portage/sys-libs/glibc(10)# ll /usr/local/portage/sys-libs/glibc/files/2.10/
total 16
-rw-r--r-- 1 root root  865 May 25 00:23 glibc-2.10-hardened-configure-picdefault.patch
-rw-r--r-- 1 root root 8823 May 21 15:26 glibc-2.10-hardened-inittls-nosysenter.patch

added two lines after the end of the other patch lines
epatch "${FILESDIR}"/2.10/glibc-2.10-hardened-inittls-nosysenter.patch 
after the other epatch lines:

root@mouse:/root(5)# diff -C 3 /usr/local/portage/sys-libs/glibc/glibc-2.10.1-r1.ebuild  /usr/local/portage/sys-libs/glibc/glibc-2.10.1.ebuild

diff -C 3 /usr/local/portage/sys-libs/glibc/glibc-2.10.1-r1.ebuild  /usr/local/portage/sys-libs/glibc/glibc-2.10.1.ebuild
*** /usr/local/portage/sys-libs/glibc/glibc-2.10.1-r1.ebuild    Mon May 25 02:01:10 2009
--- /usr/local/portage/sys-libs/glibc/glibc-2.10.1.ebuild       Mon May 18 06:41:59 2009
***************
*** 186,195 ****
                cd "${S}"
                einfo "Patching to get working PIE binaries on PIE (hardened) platforms"
                gcc-specs-pie && epatch "${FILESDIR}"/2.5/glibc-2.5-hardened-pie.patch
!               epatch "${FILESDIR}"/2.5/glibc-2.5-hardened-configure-picdefault.patch
!               epatch "${FILESDIR}"/2.7/glibc-2.7-hardened-inittls-nosysenter.patch
!               epatch "${FILESDIR}"/2.10/glibc-2.10-hardened-configure-picdefault.patch
!               epatch "${FILESDIR}"/2.10/glibc-2.10-hardened-inittls-nosysenter.patch
  
                einfo "Installing Hardened Gentoo SSP handler"
                cp -f "${FILESDIR}"/2.6/glibc-2.6-gentoo-stack_chk_fail.c \
--- 186,193 ----
                cd "${S}"
                einfo "Patching to get working PIE binaries on PIE (hardened) platforms"
                gcc-specs-pie && epatch "${FILESDIR}"/2.5/glibc-2.5-hardened-pie.patch
!               epatch "${FILESDIR}"/2.5/glibc-2.5-hardened-configure-picdefault.patch
!               epatch "${FILESDIR}"/2.7/glibc-2.7-hardened-inittls-nosysenter.patch
  
                einfo "Installing Hardened Gentoo SSP handler"
                cp -f "${FILESDIR}"/2.6/glibc-2.6-gentoo-stack_chk_fail.c \


run 'ebuild glibc-2.10.1-r1.ebuild digest' in that directory. And then 'emerge -vD glibc' fails with the described error.

Then I commented out the first two patch lines and now I can emerge glibc-2.10.1
on a hardened system.
Thanks
Comment 16 Nadim Kobeissi 2009-07-22 12:03:39 UTC
Two months fixed and still not in portage? What the hell?
Comment 17 Petr Polezhaev 2009-07-22 12:26:32 UTC
There is still an issue with _guard symbols.
Fix was in blacklisting glibc. If you still want to use it, you may add a patch for youself and recompile the whole system to get rid of old symbols.

I presume, that there is a lot of work with new glibc and hardened, so I suppose, that unmasking it at begining was an error.
Comment 18 Nadim Kobeissi 2009-07-29 08:41:38 UTC
This bug's a serious issue for those who converted their make.profile to hardened from another profile, since it stamps down portage/revdep-rebuild/etc with it always trying to downgrade glibc then stopping itself so that it doesn't break the system. The solution is to simply add:
<=sys-libs/glibc-2.9_p20081201-r2
To /etc/portage/package.mask, but that still doesn't fix revdep-rebuild wanting to re-emerge glibc to fix some dependencies.
Comment 19 SpanKY gentoo-dev 2009-09-07 05:03:32 UTC
complaining will get you nowhere in bugzilla.  if you want to actually help, test the hardened-ssp-compat patch.  i didnt feel like updating it when i bumped glibc to 2.10.
Comment 20 Jory A. Pratt gentoo-dev 2009-09-20 02:27:04 UTC
New patches are in main tree. The package.mask for glibc-2.10.1 is to remain in place per gengor. If a user wishses to test and finds a bug please open a new bug report with all avaliable data.
Comment 21 SpanKY gentoo-dev 2009-09-20 05:40:13 UTC
that statement isnt terribly clear.  does glibc-2.10.1 now cleanly unpack for hardened users ?
Comment 22 Xake 2009-09-20 08:11:49 UTC
(In reply to comment #21)
> that statement isnt terribly clear.  does glibc-2.10.1 now cleanly unpack for
> hardened users ?
> 

It does for me.
Comment 23 Jory A. Pratt gentoo-dev 2009-09-20 13:31:28 UTC
(In reply to comment #21)
> that statement isnt terribly clear.  does glibc-2.10.1 now cleanly unpack for
> hardened users ?
> 

Yes 2.10.1 unpacks fine for hardened now.
Comment 24 SpanKY gentoo-dev 2009-09-22 15:10:54 UTC
thanks for checking
Comment 25 Nadim Kobeissi 2009-10-01 16:23:59 UTC
The following lines need to be removed from /var/cvsroot/gentoo-x86/profiles/hardened/linux/package.mask:
# Patch fails, mask for now. Bug #270274.
>=sys-libs/glibc-2.10

Because as it is now, doing an emerge --sync will still mask 2.10.1:
!!! One of the following masked packages is required to complete your request:
- sys-libs/glibc-2.10.1 (masked by: package.mask)
/usr/portage/profiles/hardened/linux/package.mask:
# Patch fails, mask for now. Bug #270274.
Comment 26 Gordon Malm (RETIRED) gentoo-dev 2009-10-01 19:18:04 UTC
(In reply to comment #25)
> The following lines need to be removed from
> /var/cvsroot/gentoo-x86/profiles/hardened/linux/package.mask:
> # Patch fails, mask for now. Bug #270274.
> >=sys-libs/glibc-2.10
> 
> Because as it is now, doing an emerge --sync will still mask 2.10.1:
> !!! One of the following masked packages is required to complete your request:
> - sys-libs/glibc-2.10.1 (masked by: package.mask)
> /usr/portage/profiles/hardened/linux/package.mask:
> # Patch fails, mask for now. Bug #270274.
> 

Mask was dropped by SpanKY ~2hours ago (from the time of this writing).  Will be gone on your next emerge --sync.