OpenBSD Journal
Home : : Add Story : : Archives : : About : : Create Account : : Login :
Android's C Library Has 173 Files of Unchanged OpenBSD Code
Contributed by tbert on Mon May 5 14:19:30 2014 (GMT)
from the good-diffs-make-good-neighbors dept.

On may 2, 2014, a message with the somewhat arcane subject libc: #define to remove support for %n from printf(3)? from the main Android libc maintainer turned up on tech@, where part of the lead in was,

i maintain Android's C library which, as you may know, contains a lot of OpenBSD code. i've been working to clean up our mess and get us back in sync with upstream, and currently have 173 files that are exactly the same as current upstream OpenBSD. (more than we have from the other two BSDs put together.)

There's more after the fold:

the one thing i've had pushback on is that by switching to the current upstream source i've effectively added support for printf(3)'s %n to Android, which our security guys are not happy about. Android has never supported %n before.

ideally i'd like to have no differences between Android and OpenBSD in the shared source files, because i've seen what a mess things were when we diverged (and how many bugs went unfixed in Android despite having been fixed for years upstream). so rather than start back on the slippery slope of adding Android-specific hacks, i wondered if you'd consider adding #ifndef REMOVE_PERCENT_N_SUPPORT (or whatever) around the implementation of %n in lib/libc/stdio/vfprintf.c and lib/libc/stdio/vfwprintf.c.

you already have stuff like FLOATING_POINT and PRINTF_WIDE_CHAR so there's some precedent here.

thoughts? (assuming this is the right list. if not, please point me in the right direction.)

--elliott

The thread goes on with suggestions from Bob Beck (beck@) and others that OpenBSD tends to prefer removing knobs rather than put more in, and so there may be other ways to fix the perceived problem and help our downstream Android developers.

The change was subsequently committed:

CVSROOT:	/cvs
Module name:	src
Changes by:	deraadt@cvs.openbsd.org	2014/05/03 06:36:45

Modified files:
	lib/libc/stdio : vfprintf.c vfwprintf.c 

Log message:
Add #ifndef NO_PRINTF_PERCENT_N.  Since we are fully standardized, we
don't use disable %n ourselves.  But Google's Android libc is based
on our libc....  Giving them an easy knob to disable this dangerous
feature easily make their job easier without making our job any harder.
Request from Elliott @ google

It's nice to see good code (and security-consciousness!) being exported to other projects.

[topicopenbsd]

<< Doing some interesting OpenBSD work? EuroBSDCon 2014 wants to hear from you! | Reply | Flattened | Expanded | Privsep Debugging Support: /var/crash/$programname, sysctl-Managed, Added >>

Threshold: Help

Related Links
more by tbert


  Re: Android's C Library Has 173 Files of Unchanged OpenBSD Code (mod 0/50)
by Anonymous Coward (138.190.32.7) on Tue May 6 13:45:20 2014 (GMT)
  A wise decision. thanks!
  [ Show thread ] [ Reply to this comment ] [ Mod Up ] [ Mod Down ]

  Re: Android's C Library Has 173 Files of Unchanged OpenBSD Code (mod -3/47)
by Anonymous Coward (91.66.44.147) on Tue May 6 14:01:54 2014 (GMT)
  Well but not all of them are up2date. Specialy the arc4random for example.

It is still nice to see that they try to catch up now.
  [ Show thread ] [ Reply to this comment ] [ Mod Up ] [ Mod Down ]

  Re: Android's C Library Has 173 Files of Unchanged OpenBSD Code (mod 2/48)
by brynet (Brynet) (@openbsd.org) on Tue May 6 15:37:07 2014 (GMT)
http://brynet.biz.tm/
  Android Bionic has committed this now as well.

https://android.googlesource.com/platform/bionic.git/+/e2341d08fa4a4e0c22056c410fd34d3f93e06017%5E%21/
  [ Show thread ] [ Reply to this comment ] [ Mod Up ] [ Mod Down ]

  Re: Android's C Library Has 173 Files of Unchanged OpenBSD Code (mod -5/39)
by mxffiles (218.11.246.179) on Tue Feb 7 07:05:33 2017 (GMT)
  This is a very good post which I really enjoy reading. It is not every day that I have the possibility to see something like this. Software mxf Software mxf converter free download to convert HD camcorder files. ts converter convert ts video files to avi, mp4, wmv, mov mts to avi mp4 mov mkv iMovie, FCP/FCE with mts converter, so to convert mts files for your PC and mobiles. mod converter and convert tod files just free download mod video converter. m2ts
  [ Show thread ] [ Reply to this comment ] [ Mod Up ] [ Mod Down ]

[ Home | Add Story | Archives | Polls | About ]

Copyright © 2004-2008 Daniel Hartmeier. All rights reserved. Articles and comments are copyright their respective authors, submission implies license to publish on this web site. Contents of the archive prior to April 2nd 2004 as well as images and HTML templates were copied from the fabulous original deadly.org with Jose's and Jim's kind permission. Some icons from slashdot.org used with permission from Kathleen. This journal runs as CGI with httpd(8) on OpenBSD, the source code is BSD licensed. Search engine is ht://Dig. undeadly \Un*dead"ly\, a. Not subject to death; immortal. [Obs.]