-
Notifications
You must be signed in to change notification settings - Fork 203
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[LibOS] time zone is incorrect in syscall gettimeofday()
or glibc localtime()
or bash command date
#466
Comments
If you add this to CI-Example bash manifest.template, the result is correct:
Similar happens to the C example. However, tz_minuteswest is always 60. Not sure why. |
Looking at shim_do_gettimeofday(), tz is never touched, hence the initial value 60 is always there. Is it because this argument is obsolete or a bug? |
Yes, The workaround works for localtime and date. Native app doesn't need a TZ env to get time zone, OS doesn't provide TZ env, neither. |
TZ env is only needed for the bash -c case. C sample code runs fine without it. If TZ is not set, when using "bash -c date", it will try to open /etc/localtime, e.g. /usr/local/etc/localtime. This doesn't seem correct... |
The root cause is the glibc comes with Gramine has a different TZDEFAULT macro:
This is introduced in glibc Makeconfig:
So there are 3 options to get the correct timezone: 1. set TZ environment variable in the manifest, 2. copy /etc/localtime to /etc/localtime 3. change the setting of sysconfdir when building glibc. |
@lejunzhu @llly Looks like we have two separate issues here:
For the first issue, is this anything critical? From what I see, For the second issue, I would prefer our patched Glibc to be built in the same way as the system-wide Glibc is built.
@lejunzhu Do you know why |
This is because glibc's Makeconfig will prepend $prefix to sysconfdir by default:
And we set $prefix in compile.sh at
But I don't know how to quickly fix it. Actually, if I set "/home/daniel/local" as Gramine prefix, I will find about 10 places in libc.so pointing to this directory:
All these paths look suspicious and probably can't be found when running inside Gramine. Maybe we should specify $install_root instead of $prefix when building and installing glibc? |
From what I read, |
If we really care, other settings should be considered (now or sometime in the future), like @dimakuv In the wiki page you linked, I think they simply forgot about But I don't understand why we need to mimic system's glibc 1:1, because we're really an alternative OS and alternative distribution. We should be compatible, yes, but we're not under obligation to copy everything. Yes, |
Then I vote for this! Nice and contained.
Well, we debate on this for the last 4-5 years :) Glibc is not a stand-alone library, it depends on a bunch of scattered text files (like this
We currently use option 2, but simply because it is easier (just tinker with the manifest file). And with this GitHub issue, we see that at least sometimes, our patched Glibc doesn't do option 1 nor option 2 by default, but it defaults to something totally meaningless. So since we're currently doing option 2, we should do it uniformly. |
Actually, why do we configure Glibc As a user, I would expect the glibc in Gramine to use paths like |
Because we can map allowed files 1:1 and nothing should break. We'd have to document a canonical mount that should be expected in compatible manifests. We probably can change the approach if you think that would be better. |
What do you mean? For this to make sense, we would have to mount Gramine install dir under the same path inside Gramine. AFAICT, we never do that, we only mount the Gramine install dir under |
If we don't do that and it still works, then I suppose there isn't any reason. |
Currently, I can use
to workaround this issue until |
Sorry, if this offtopic or something... I don't know this project here, but I came across this thread, when troubleshooting a similar issue in my toolchain. |
Description of the problem
Current Gramine doesn't take care of time zone. The requests for time with time zone is incorrect and inconsistent.
Steps to reproduce
timedatectl set-timezone
on Ubuntu.bash -c date
in CI-Example.Expected results
Actual results
Additional information
We can see that all time become UTC time, while
tz_minuteswest
doesn't reflect UTC time.Gramine commit hash
e37f773
The text was updated successfully, but these errors were encountered: